Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Cheap back end for static website
11 points by vmception on July 28, 2021 | hide | past | favorite | 28 comments
Hello, I have a static website that I want to do a couple asnychronous requests for data, used to render some data visualizations.

I could do it on the website's javascript itself, except for the API keys needed to access the third party. So instead I'll put the API keys on the server and get the data and serve the result to the website.

Heroku cost $25/month. I can think of an AWS lambda + database that would theoretically be cheaper, or theoretically more expensive. But what would you guys use?




Without knowing what your tech stack is or what your familiar in, I'd consider Vercel and their serverless functions. They support Node.js, Go, Python and Ruby [1] and also have a very generous free tier in my opinion [2].

[1] https://vercel.com/docs/serverless-functions/supported-langu...

[2] https://vercel.com/docs/platform/limits


that was surprisingly easy for the static site deployment with the Git integration, CDN, SSL, HTTPS out the box

serverless functions require the $20/month plan? hmmmm

but lambda will be free for me, although if I use a database it won't be

edit: the usage limits document you posted says there are serverless functions available for hobby/free tier, but the dashboard says the serverless is only available for pro plan. do they mean the serverless GUI is only available?


Only the "Serverless Function Region" feature, meaning being able to select which specific region a Serverless Function runs in, is only available for Pro Teams.

It seems as if this wasn't clear from the UI. Would you agree? It sounds like you've assumed that it's the entire Serverless Function feature that would not be available.


I personally only used serverless functions in combination with Next.js (which is by Vercel) and there may be are other rules if you don’t use Next.

But reading the docs I’d just copy an example hello world function into my git repository, try to deploy it and check if it works without paying.

Regarding the lambda approach, I personally think lambda functions and especially with the api gateway get too complicated too fast in comparison with a solution like Vercel. I’d definitely recommend an infrastructure as code tool like Terraform if you choose this approach.


yes, I figured it out. had to restructure my node js component into folders oddly, but that worked out fine


$5 Digital Ocean droplet with the one-click NodeJS install: https://marketplace.digitalocean.com/apps/nodejs


I think on a budget it’s hard to beat Cloudflare workers.

I’ve never been a fan of the serverless model, building on AWS Lambda etc, wiring up API gateways, slow cold starts, the hidden extra costs, EGRESS, gateway pricing etc.

Recently trying Cloudflare workers has been a pleasant experience. It’s still early, a few rough edges and limits to work within etc but I’m pretty convinced they are going to disrupt the serverless market. Fastly’s C@E is even more exciting being WASI but although Fastly advertise it as available you cannot go to their website give them your credit card number and use C@E. Likewise when C@E is generally available if the pricing is like the CDN it’ll be a non starter outside of business use.

Back to Cloudflare workers. Generous free tier, good non free tier pricing, static hosting, globally distributed workers by default, fast cold starts, WASM support, KV persistence, hook in to the cache easily, distributed objects for persistence if you can work around limitations. No need wiring up API gateways etc, write a traditional monolithic api with a router.

If you can design around utilising cloudflare it’d likely scale better than any cheap vps. I got a very long way for free with cloudflare then had to pay all of $5 to upgrade my plan as a worker needed 12ms cpu time instead of 10ms as was connecting to an Azure CosmosDb database and I think request signing eat in to my cpu budget.


If your site has less < 5,000 users a month, I can't imagine exceeding Lambda's free tier limit. You definitely want to go serverless if budget's a constraint.


I'm not going to make a new AWS account to take advantage of the free tier


AWS Lambda is (currently) part of the "Always free" tier, with up to 1 million(!) requests per month. (See: https://aws.amazon.com/free/?all-free-tier.sort-by=item.addi...)


wow thanks!

the next question is whether I should have just one lambda call that gets my external data and serves it to the clientside requester

or if I should have one lambda that does gets my external data on a timed job, caches the response in a database, and a separate lambda that reads the response

on AWS it seems the databases are the most expensive thing

guess I could also just cross that bridge when I get there, just feel like I could get spammed to a big bill even if I put in some session variables client side

this is just a static website trying to power a data visualization on semi-live data


I'm on Netlify, but Vercel or Render are also popular options for static websites and jamstack


Literally any shared hosting service, of which there are bazillions. I pay $10 a month on A Small Orange to host a crappy Lektor blog that I publish by Git. What you're describing really needs very little infrastructure.


yeah, looks like Vercel is free for my use case


Take a look at this free serverless options for developer https://freestuff.dev/tags/serverless/


An alternative to consider: Cloudflare Workers + Workers KV. Generous free tier


Try vercel and it works great


that's what I went with, truly amazing, a little counterintuitive but easy to avoid vendor lock as its quirks are only a specific folder structure, which the non-vercel environment can use too, thanks!


Try Glitch, I am hosting some websites there, with $10 a month you can host multiple small sites.

Or pay $5 for a Digital Ocean, but probably needs a little bit more configurations


I'll need to give Glitch hosting another look. When they first launched there were frequent issues with domains not connecting, or SSL issues, or projects would just go down entirely. I hope they've made progress since then because I really want to like Glitch's hosting as much as I love their editor.


$5 DO running a database I manually add could probably be great


hey Vmception! I've been working on a brand new framework that provides exactly what you need, and I'm looking for a few early adopters. hit me up! christian [at] scaffold.ly


I am planning on using AWS S3 with a Lambda for a static site.


render.com for $7 a month.

Digitalocean is $5 but you need to handle all the management that comes with it.

with render you just point it to a github repo and you're done.


Netlify will suit your use case, probably for free


Amazon Web Services or Fly.io or VPS on Digital Ocean


Glitch can run nodejs+static web+hide keys


What about for persistent storage? Looking for something close to free in that department

Database or key/value storage, decent connection performance




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: