Developers September 29, 2020

Scalable serverless hosting for static client sites?

Martin Fulop @Krakz

Does anyone know a scalable cloud solution to host infinite amount of static client sites with html/css/js?

The application would be similar to visual website builders like Wix or Shopify.

Basically the hosting should scale, let clients use their own domains, allow unlimited sites/domains.

Looking for something similar to Firebase hosting but there you have a limit (around 30) sites max per project.

  1. 7

    Sounds like you want JAMStack hosting?
    The 2 leaders in the space are Netlify and Vercel, there is also Gatsby hosting (if you use Gatsby as a framework)

    Netlify has DNS, SSL, Forms, Serverless functions, CI/CD and more on it's free tier.

    I have yet to see a visual builder in this space, but StackBit comes close or's SliceMachine is getting heading in the right direction.

  2. 5

    I am currently on the same boat for my project

    My findings so far

    1. AWS S3 - its very easy to setup storage and CloudFlare(not cloudfront) CDN. AWS SSL is super expensive $600. But linking domain name with AWS is confusing and headache for me. [Other option is, very cheap compared to AWS S3, Azure, Google Cloud]
    2. DigitalOcean Droplet or Linode with static hosting server is cheap (includes SSL). But I am worried about security issues. 1TB free.
    3. Netlify API for hosting and linking domain. 100 GB download is free.
    4. I am talking to (built by fellow IH user @rabbitsfoot8)
      I don't want to deal with domain setup and hosting issues, if there is a cheaper way to offshore I love to go with them.

    Edit: Few said I am wrong about AWS SSL cert price $600, pls check it.

    1. 2

      Netlify seems promising and others recommended it below as well, currently reading their API docs to learn more about them.

    2. 1

      ACM certificates are free for SSL on AWS. How are you paying $600 for SSL?

      1. 1

        I haven't paid $600 I read from AWS docs that they charge that much amount.

        1. 1

          I think maybe you're viewing the solution being sold by a vendor on the AWS marketplace. Because it is free to use AWS ACM to generate a SSL for your domain. Here's an article showing how to do so; Also know from both personal and professional experience as it is what we use :)

          1. 1

            Thank you for the link, I will check it.

  3. 3

    DNS: Route 53
    Hosting: S3
    CDN: Cloudfront

    Is what I'm sure a lot of these site builders are built on top of, it's pretty much the industry standard and dirt cheap. If you need infrastructure as a service and not just hosting for your own site, then that is what AWS is built for

  4. 2 is an open source project that has been created to allow easy publishing of static web sites and JavaScript web applications (like Angular or React apps) using your own Amazon Web Services account.

  5. 2

    I know a lot of people have suggested building on S3 but might I suggest the following.

    1. get rid of stuff you don't need for all your users
    2. let users opt into things they do need individually
    3. make sure the platform you are building on has the same unit economics as yours
    4. if you are going to go full bespoke then make sure the infrastructure pieces can be defined programatically

    although I haven't built a platform to host / build sites I personally like google-cloud and i think you can use any cloud provider (don't work for or advocate for google cloud necessarily) you want or even a mix but here's why

    1. static content is static, you don't need serverless functions to serve static content, you just need a bucket and maybe a CDN, or maybe SSL.

    2. have an opt-in plan
      the reason I say maybe above is because CDN has different unit economics than serving from a region in a bucket (Google Cloud Storage), SSL is nice but because of the handshaking etc, but can slow down initial page load and can you say definitively that every customer wants SSL or is that just an assumption? for instance will every site support forms or is it just arbitrary static content.

    3. i love vercel myself but it's for a bespoke app/site I'm working on that suits my particular needs, I'm also happy with the unit economics for my goals. but one reason I like Google Cloud is that their pricing model is very generous at the free tier and very reasonable and understandable at scale, you're paying mostly for compute and storage retrieval, write costs are negligible for storage operations but compute time and loading things from storage will eventually cost like any other cloud provider. services like CDN and build automation have slightly different pricing but maybe that should be factored in to your business model and pricing tiers, you also pay more for things that tend to stay on like database servers and stuff but not any more than other providers at scale, you might also not even need these services

    4. you can automate literally all the things on google cloud, it's the same infrastructure as google (the website) itself so it should pretty much handle whatever your needs are and the pricing is better than most other cloud providers, the downside is that you have to do things sorta the way google does things which can be a bit of a learning curve. so some scenario might be as follows

    • building static content - there is a service again that has a very generous free (120 minutes per day) tier called "Cloud Build" that can integrate with anything other CI services can like headless CMS or what have you. you can use whatever static site generator you want as well and 120 minutes per day will build a lot of static sites
    • CDN there's Cloud CDN where you pay per pennies per GB traffic and a few more pennies for cache fills and https cache lookups
    • there's also DNS services and SSL management (self generated or provisioned)
    • identity solutions for SSO
    • all the other things you might want to use to build an application

    but the big thing might be the core aspect of your business which is analytics on all the traffic data you are getting and no matter what cloud provider you choose you probably don't want to be schlepping that data across cloud providers because that can be a lot of data very quickly and can get expensive. gcloud has a bunch of services to analyze that data and make predictions on it

    i think the hardest parts of your task are defining the end product and pricing in detail, identifying the components that you will need to build the end product, and then mapping the unit economics of your cloud provider to the business model of your product, trying to find a provider that ticks the boxes for your MVP might not scale well with your business model and you will find yourself quickly looking for other solutions. building a bespoke product isn't easy no matter what you choose so if you take the time now you might be saving yourself a lot of extra work later

  6. 2

    Because you're hosting static files, you'll have a lot of choice. A lot of CDNs will work for you but some better than others. Of the ones I tried, these are interesting: CloudFront, KeyCDN, Stackpath CDN, Vercel, Netlify. Often the issue comes down to how many sites/domains they allow and how much they charge for additional ones.

    Another aspect is how they validate domain ownership for SSL certificates. Some providers will require you to setup dns records for SSL validation, which is something your customers would then need to do and that is a pain.

    Vercel and Netlify are nice in the aspect that they automatically issue certificates via Let's Encrypt. AFAIK at least netlify lets you upload static files directly via API. They also make custom plans for use-cases that don't fall within the normal limits.

    CloudFront has the advantage of you paying only for what you need, however they have service limitations which you would need to apply to get increased, also the setup would be a bit more tricky. You don't need the $600 SSL option that @prakis mentioned.

    KeyCDN seems pretty user friendly, however charges $1 for every "zone" and if you do a simple setup that would mean one site. Otherwise they are very cheap so this depends on your unit economics.

    Stackpath CDN is very cheap but their API is a mess so if you want to automate things, it's not easy to deal with. They don't charge extra for additional sites, I've had more than a thousand with them and paid $30.

    Essentially you're looking for a service that: 1) doesn't charge too much per domain, 2) automatically provisions SSL certificates (Usually via Let's Encrypt)

    1. 1

      Netlify seem to have a 200 request/minute limit on their API though which doesn't look too good. If multiple users create/update their site at the same time the limit will be consumed quickly.

      1. 1

        Idk the kind of scale your are expecting but on Landen we get ~1000 publishes a day from 21k sites total which is way below the limit. We did contact them back in the day about increasing the limit but ultimately built our own solution so I know they are open to this but not sure what they would charge now.

        1. 1

          The limit counts any CRUD operation and 200 per minute does not seem a lot. Not saying it would be easy to hit that limit but I'm not comfortable having to worry about it in case something works out and I get a traffic spike.

          I did ask them though, and the support lady said prices start from $3k/mo if I'm looking to lift on this limit. I hoped the price could be increased gradually whenever I need to increase the limit.

          I've checked out a few other CDNs, hoping I could do this without Netlify using some kind of cloud storsage + CDN only but they all seem to have a limit on the amount of domains they allow.

          1. 1

            You're definitely right, that's why we eventually built our own system. Nothing seemed to be really made for us. We've been thinking about productizing our hosting system for other builders to use.

            1. 2

              @Felixg If you productize that hosting system I would like to know.

    2. 1

      Thanks that's really helpful!

      Netlify seems to be the best option so far.

      As for the backend of the main application, what would you recommend with Netlify? My plan is to use Cloud Functions + MongoDB Atlas.

      I saw Netlify has cloud functions too. I know these services price ingress/egress traffic differently, not sure if it would make any impact to go with a different service for the backend. Also I'm confused by Netlify's pricing on functions ("$25 per site /month", not sure what would a "site" mean in my case, but I've sent them an email to ask).

      1. 1

        We went the route of proxying dynamic requests so that we can keep the static pages static and have all the dynamic logic on a real server. I have no experience with their cloud functions or mongo db. You could keep things serverless by setting up lambdas on aws with an api gateway or ALB and then proxy your dynamic requests to that endpoint.

  7. 2

    You can use Netlify.

    There is no limit to the amount of sites on the free tier. There is a bandwidth limit, however it is very generous. I use it for most of my static sites. Can't fault them at all!

  8. 2

    Hey Martin, have you checked out Render? (

    It's free for static sites plus lots of goodies like auto SSL, auto deploy from Git, etc.

    1. 1

      This looks really good! Do you know if they have an API like Netlify? I haven't found it in their site.

  9. 2

    Have you considered using Amazon S3?

    Also, it could be a viable solution to use hosted server - they are usually much cheaper with generous limits and configuring simple static hosting with NGINX + custom domains + Let's Encrypt is not that hard. You could be able to host many small sites cheaper.

  10. 1

    I think you should reach out to my business partner Zach, we have a tech startup ( and we’ve built and currently manage hosting environments for a number of projects. If you’re interested I can give you his contact info or forward yours to him.

  11. 1

    Hey Martin I built on AWS which seems similar to what you're looking for. Would a service that takes care of this through some kind of API be interesting to you?

    1. 1

      Hey rabbitsfoot8!

      Thanks for the offer. I have to admit I'm deep in the dark on this topic, but still looking to do this myself.

      I'm really grateful to everyone commenting here because the suggestions seem to be really good starting points to learn more.

Recommended Posts