17
22 Comments

Anyone know how to go about programmatically publishing web pages?

Not sure if my question in the title makes complete sense, but I'm trying to figure out how to programmatically publish a web page for each user.

Each web page will use the same layout & content across every user. Is the correct term for this "no-code"?

Additionally, wondering what the cheapest tech stack would be for this - something that's priced on a # of users/scale basis?

Thanks!

on September 8, 2020
  1. 4

    When you say programmatically publish a web page for each user, do you mean an actual page such as each user getting their own URL on your domain? (for example https://www.indiehackers.com/harlanzw)

    Or do you mean that each user would then get their own website programmatically? (i.e harlanzw.com)

    Also to clarify, are you looking for a no-code solution or are you comfortable with technical recommendations?

    1. 2

      hi! that's a really good question - i guess i am referring to your 1st option (each user getting their own URL on my domain)

      I have to do this programmatically from what I understand, but I've never done a project that involved publishing a new page to an existing domain under a new URL... so I'm a bit lost. :")

      For context, the entire app requires this:
      The users will use an app downloaded from the App Store to enter basic information about themselves, hit Publish, and a new page is published under www.company.com/userName.

      1. 4

        Well, that's good, because that's the easier option :D

        Saying that though there are countless ways that this infrastructure could be setup.

        Do you know what tech stack (frameworks/languages) the website will use?

        If you haven't got to this stage yet, it may be worth coming up with a full spec document for what the website will need to do and what the plans for it are in the future. Planning early on can save massive time down the line when you need to scale out the project

        With the amount you've told us its hard to recommend any specific solution at the moment

        1. 0

          hi - thanks for being so willing to help me with this! i was actually trying to withhold some details because this is for an MVP for a startup :")

          if you wanted/are bored and want to chat, i'm down to chat more 1on1 brief you on the important details I left out. let me know!

          my email is lesleychang@berkeley.edu, twitter @rasreee, whichever your preference is :-) thanks so much

          1. 7

            @harlanzw is providing you the most relevant information in this thread. you'll need more clearly defined specs for a solid answer. just asking for clarification between username.company.com and company.com/username makes a huge difference in how this is approached. I'm "upvoting" his responses via this comment as he didn't just throw out a blanketed "firebase" answer.

    2. 2

      Damn your site is slick.

      1. 1

        Thanks @vladcalin :) I've actually been thinking of redesigning it so thanks for your feedback, maybe I'll settle for some polishing

  2. 3

    I faced this recently and you have a couple of options.

    • Do you want dynamic or static sites?
    • Do you need custom domains with https?

    My first hunch was to use Vercel and serve content with their cloud functions but they have a soft limit of 50 domains per project. I reached their enterprise sales and they offered me to pay $24 per year per extra domain which I think it's a bit absurd.

    If you are versed in AWS you could create S3 static sites dynamically with their API and also configure DNS and certificate creation. You need to be kind of an expert with AWS to make this work and your users will need to understand content will not be published instantly.

    I also experimented using Cloudflare Workers which are great for serving dynamic and static content. Unfortunately to make a domain work with CF it needs to be added to your CF account as a new zone so that workers respond to that domain and you get SSL. They also have an SSL for SaaS offering which solves these issues but it is only available for enterprise customers (I think it starts at $5K per month).

    After months of trying to figure this out, I ended up using Fly.io with a simple Node server that checks the domain and renders content based on that. You users can point their domains using A AAAA CNAME records and they give you an API to create certificates. Each certificate costs $0.1 per month which is very reasonable.

    1. 1

      Iv'e been looking into the CF option lately. Great recommendations! I typically use Azure.

  3. 2

    Simple explanation: you don't normally publish a page for each user, you have a single page (eg. /profile) that dynamically shows different data for each user (eg. profile/rasreee).

    So the profile page itself will be responsible for loading and displaying the data for each distinct user. Now, how this loading and displaying is implemented depends on the solution you go for, how different the data is for each user and where does this data come from.

    1. 1

      thank you! this is helpful :)

  4. 2

    At a high level I end up going for the easiest solution possible (at the time). This is what I do - until I have to tweak it for more performant scenarios or move to non html pages.

    1. Create the template you want
    2. On saving the template (and variable outputs) I dump the template file stream to a CDN as rasreespage.htmlfor example
    3. Then I trigger/automate adding a DNS entry that allows the CDN to accept http requests from any specified domain name (and even domain name paths) and points it to my html page.

    This works for me because I NEVER want to spin up a VM, containers or mess with traditional web page hosting. The CDN can route to any specific page based on my rules engine (which I can also program/automate) with a trigger of some sort.

    I use other scenarios when the pages are non-html such as XML or JSON.

    1. 2

      thanks so much - this is super helpful! :)

  5. 2

    I think this is a pretty simple project and you can do it with basic web tools.

    As noted elsewhere I'd say your first decision is the URL structure. Assuming it's www.example.com/user (definitely the ideal), the next decision is static or dynamic? Static is easier than dynamic in so many ways that I think you should just go with static. Any dynamic elements you can probably do with JS. You can generate the site using a template.

    You don't need a database to do this.

    The way I'd approach this is for the server side to just generate HTML files in a basic filesystem. You could store the user data alongside the HTML in the filesystem.

    For example, assuming the user "doctoreval" you would store the JSON in ./doctoreval/index.json and create HTML in ./doctoreval/index.html and (assuming all the data in the JSON file is public).

    Then, all you need to do is push the filesystem out to a service like netlify and you're done.

    I haven't done this myself, but services like Netlify might have APIs to directly upload HTML without the need for a filesystem, which would be even easier.

  6. 2

    Same questions as @harlanzw. Happy to comment further when there's a bit more context as to what you're trying to achieve.

  7. 1

    Interestingly enough, I've been thinking about this very problem! You'll need to use some sort of templating system. Looks like bubble would serve your needs https://bubble.io/. If that doesn't work out for you, I'd love to hear about the pain points you ran into.

  8. 3

    This comment was deleted 5 years ago

    1. 1

      i think i'm going to go this route!! thank you so much for the rec :)

      just to make sure, do you happen know if this would this work if data (to populate the HTML) were submitted from a mobile device (so no caching to immediately populate the page) and the user were to click on the link immediately after to view the page displaying at the new path?

  9. 2

    This comment was deleted 6 years ago

  10. 2

    This comment was deleted 2 years ago

    1. 3

      I've been using Firebase since Google announced it in 2016 (still maintain a couple of projects) and I would not recommend it for anything other than a quick and dirty prototype.

      It's super easy to go from 0 to 10, but then good luck going from 10 to 100. Specially their databases are quite limited which will hinder product development.

      As a starting point, I would recommend using Firebase (Realtime Database) as a back-end service so that you have some flexibility in how you want to structure your data.

      It's true you do have 100% schema flexibility, but as with any noSQL document based database you are much more restricted in terms of querying compared to a relational database or some hybrid like FaunaDB. In fact, you have to design your queries before you structure the data otherwise you will shoot yourself in the foot. Don't listen to me, see this talk with the head of noSQL at AWS.

      IMO their only worthwhile services are auth and hosting. Even their cloud functions are some of the worst in the market right now.

      1. 2

        Agreed, I merely proposed Firebase as a short term solution. As mentioned below, I think you have to be inventive when it comes to storing data and have a migration path figured out beforehand. It is far from perfect and optimal. I have faced similar issues in the past with Firebase but still believe its nice when you have an idea to play around with. Kinda interested in your recommendation of FaunaDB however. Have you used it in the past? How does it rank?

        1. 3

          Disclaimer: I started using Fauna last year and I ended up freelancing for them writing articles on their blog. These are my own honest opinions though.

          I'm currently using Fauna and very happy with it. I got into it because I was looking for a serverless database precisely because of all the issues I ran with Firebase.

          Data is stored in schemaless document but you have access to relations, joins, ACID transactions, etc. You can pretty much structure your data and queries in any way you need for each use case.

          I'd go as far as saying that their query language FQL is the most flexible and powerful I've ever used. It takes a while to get the hang of it though, and there are not many resources to get started.

          They also have a GraphQL offering which I haven't used but I think it's not mature yet.

          Pros:

          • Serverless
          • Distributed
          • 100% ACID
          • FQL is super powerful
          • Authentication and authorization are solved for you
          • Super cheap to get started

          Cons:

          • Hard to get started with FQL
          • Vendor lock in (unless you use GraphQL)
          • Almost zero tooling around it (clients, migrations, etc)
          • Can get expensive at scale if you're not careful
    2. 1

      hi thanks so much for the helpful pointer! i know my post was quite vague - i was trying to ask for help while respecting confidentiality of my client 😂 surprised people didn't bash me for the level of ambiguity...

      definitely considered Firebase but tried straying away from it because of the many issues i faced once things got more complex, if that makes sense. so many people point out the disadvantages of Firebase these days, but the setup is so easy & i think as long as the data is maintained tactfully migration is easier (?) maybe not.

      actually was considering dynamodb free tier since it offers more than enough storage and queries for the prototype, but i've used dynamodb only once for a learning project and might not be able to set things up properly for handoff after the contract ends

      1. 2

        Happy to help. With Firebase, you have to be a bit inventive when it comes to how you store data and have a migration path figured out in your head. It's not so good for aggregate functions, but you can use counters to work around it. I kinda enjoy the challenge of trying to optimise every little thing. Haven't used DynamoDB in the past so I can't comment on it. Best of luck and keep us posted on your MVP. Would be interested in seeing it :)