Is ~$18/mo just the price for a small app that needs real database backups?
Built a small internal billing tool for my own business. One user (me), barely any traffic. I keep landing around $18/month for hosting, which is more than I wanted, and I'm trying to figure out if I'm missing something obvious or if that's just what it…
Built a small internal billing tool for my own business. One user (me), barely any traffic. I keep landing around $18/month for hosting, which is more than I wanted, and I'm trying to figure out if I'm missing something obvious or if that's just what it costs? Not a professional developer so apologies if I use any terms wrong. It's a Node app with a React frontend and a Postgres database, runs in Docker. What I actually need: - Postgres where I can restore to a specific point in time, not just last night's backup. It tracks invoices and payments against Stripe, so if I restore a 24 hour old copy my records won't match what Stripe already charged people. That seems like a bad situation to be in. - Somewhere to store generated PDF receipts that doesn't get wiped. These are the actual documents I send customers and I can't just regenerate them later. Seems like a lot of the cheap container hosts have disks that disappear every deploy. - A cron job that runs once a day at a set time in my timezone. It's the billing run, so if it drifts to the wrong side of midnight it processes the wrong day. - Under $20/month. What I don't need: high availability, scaling, or speed. It's one person clicking around a few times a day. If it was down for a few hours nothing bad would happen. What I've already looked at: - Fly.io's managed Postgres is $38/mo on its own, way over budget - Railway's Postgres backups looked like snapshots only, no point in time restore - Supabase Pro is $25 and point in time restore is a $100/mo add-on - Cloud Run, App Runner, DO App Platform — filesystem doesn't stick around, kills the PDF requirement - Cheap VPS running everything myself is like $8, but then I'm responsible for making sure backups actually work, and honestly I'm not sure I'd notice if they quietly stopped Best I've come up with is Fly for the app (cheap if the machine sleeps when idle) plus DigitalOcean managed Postgres at $15, which includes 7 day point in time restore. Is there something cheaper that still lets me actually restore the database? Or is $15$20 ish just what managed Postgres costs and I should stop looking?
已收录讨论
If stripe holds the actual pci data and is the source of truth for payments, i dont see why you need extremely granular/long term backups
I doubt op even needs a real database, if it's a 1 user app just store structured data in a flat file in s3. Could probably get by just using parameter store, that even supports history.
This, I would look at better API integration and back filling data as needed rather then catching each transaction in real time. Little bit of an architecture change will save OP lots.
Your cost is point-in-time recovery. The rest can be run for free. Store pdf in R2/ Tigris and all the "cant store pdf" requirement disappear too
You can host it on AWS and store pdfs in an S3 bucket. With AWS managed Postgres and reserved instances, cost will be around $10~12 per month. If you can do self-managed Postgres the cost will go down a lot. but setting PTR needs some work. Anyway drop a DM, if you need any help in setting this up in AWS.
honestly I'm not sure I'd notice if they quietly stopped That's what alerting is for. One thing to consider since you seem to be aiming for lowest cost, since it's only for you, have you considered just running it on an old PC you have lying around or a Raspberry Pi or something of the likes? Heck bundle it in an Electron app and call it a desktop app. Send PG WALs to some online backup service, done. Can even show a banner when backups are failing to remind you.
Vercel and Supabase have rather generous free tiers. Since you're the sole user, I'm curious what the free tier doesn't cover that you actually need.
When designing these internal tools with low traffic and data, you need to ask if you really need a database. Lots of internal tools, even ones with 100s of employees using it for report generations, etc. can be backed by a storage account/s3. If you are fine fetching just by ID you can just store data in json in a bucket named by such ID (or using tags for more complex search), like a nosql database, or you can use table storage for more SQL-like experience (or sometines it's even feasible to use a table on sharepoint as a storage, but I would not use it for transaction data). In these cases you can set up a ZRS or GRS tier and still pay less than $1/month depending on usage and you should be fine without overeccessive backups (you can still run an occasional backup to cold/archive storage, but the redundancy should take care of it, never had issues)
Aws has serverless aurora database, which might be cheaper then renting a whole database on low usage. Check pricing. Point in time recovery is available with additional cost
Since nobody mentioned it, Neon will give you scale-to-zero Postgres with point in time restore for like 6h standard, and costs pennies to run at low usage.
Why do you need Postgres for a single user app ? Why not SQLite with Litestream writing WAL to S3 ?
AWS RDS with a reservation prepaid at one year comes out to $20 a month with a 5-minute point-in-time recovery. You could also do on-demand utilization and rig up a lambda with the vent bridge with a cron job scheduler to shut the database down and turn it on during your business hours.
Postgres Write Ahead Log is practically PITR. I have mine stored in S3, but for WAL + 2 sets of regular incremental backups across 2 sites it costs like $6/mo I have my actual DBs in Kubernetes, but before that using Postgres directly on a VPS also worked. This would be a lot cheaper than a cloud provider. Yes it may be more flaky if you’re not experienced, but as long as you have monitoring and you don’t need 100% stability/uptime, I think this is a reasonable option. I had more issues with single az AWS RDS than I do with Kubernetes.
Hey, If Stripe is your source of truth regarding payments (as it should), let it be so. Don't try and duplicate Stripe state to outside system like your DB There's quite a few AWS S3 compatible services with very generous free tiers, 10GB of free space for your DB backups can go very far before you need to start paying for anything and you can dump your DB every 30 or 5 minutes, should you really need so Similarly to the storage space, there's some free tiers for compute that should let you to host an app like yours that gets no traffic other than your own use If that's to stay that way, consider hosting it yourself at home/office and exposing it online only via Tailscale, so you could reach it from anywhere and keep it online using resources you're already paying for Let me know if you'd have any further questions around the above.
Look at nosql solutions instead. They have other drawbacks but for low usage they can be very cheap. Cosmos db even includes 7 days of point in time restore for free.
For PITR the floor is usually around ~20/month if you want a managed solution, we also start at 19 or 16 if you pay yearly https://sliplane.io/pricing#managed-postgres
If you already are running docker, why not add that Postgres service there, and figure out how to push the backups to s3 or r2? On Linode that would cost you $5/month + storage.
You can also host postgresql on VM/EC2 for your own and setup PITR backup with pgbackrest
postgres should be able to stash snapshots of transaction logs and replay them against a full restore to get to a point in time recovery. it's a standard rdbms function. but you gotta have the replay logs (ship to object storage maybe?)
Have you considered using Cloudflare workers free? The only thing is you may need to refactor your app slightly to support the workers runtime and SQLite instead of Postgres. Their D1 database gives you 30 day PITR and you could use their R2 object storage for the PDFs https://developers.cloudflare.com/workers/
AWS Lambda + S3 for PDFs + DynamoDB as database
To cut that cost down, you need to change your strategy. The highest costs there are the DB, Backups, Compute. The compute you can save by going to a serverless approach where you get charged per million API calls. This also simplifies your cron job requirements. The DB cost is a hard one to deal with, you can probably save time there using something like DynamoDB or an equivalent, you don't really need PostgreSQL there (it's probably overkill). Backups are a significant cost sink in that aspect if you are backing an SQL database lkke that. Your "source of truth" problem, either use Stripe as the source of truth and pull the state from them if you can, or use Event Sourcing in your system which enables a variety of features you can implement that include reverting events out to go back in time which can provide more granular control over your backup system. Another thing you can look at is automated shutdowns outside of business hours. If you suspend the DB and Compute outside business hours (or when you need access to it) can you save costs that way. Finally, $18/month? That's pretty cheap.
your real cost here is point-in-time recovery, and for a one-user billing tool i'd question whether you even need it. stripe is already the source of truth for what happened to money, so a restore is really 'replay from the stripe api into a fresh db' plus keeping the generated PDFs somewhere durable like R2 or S3. a nightly pg_dump to object storage covers app state and stripe covers the ledger, so paying monthly for continuous PITR to protect data you can reconstruct from stripe is the line item i'd cut.
As for me, google’s firebase is a good choice which can provide free database in firestore and easy login in methods, Nginx front end container and a free hosting for a tiny project. And you can also buy a domain in Cloudflare for your project as well, which is cheap.
Right Id say vercel and vultr.