Need project hosting advice

I'm working on a startup project which is essentially just a SvelteKit web application with a public API. It uses Redis and PostgreSQL databases. I have two primary hosting options: - Host everything on a VPS manually - Spread hosting out between tools like CF pages, CF workers, CF D1 storage, CF KV, and more. I need advice on which option YOU would choose in my situation with scaling in mind. My thought process is this: Using Cloudflare's tools I'd pay significantly more, but it would be more reliable, (probably) faster, easier to scale, and be more secure. Hosting on a VPS would be WAY cheaper, but scaling would be complicated, downtime would be a possibility, and I'd be responsible for managing and updating VPS tools. I can afford to spend a couple days setting up a VPS, so set-up time isn't much of a concern. My main concerns are scalability, reliability and price. My project will have no cap to user count, and since it has a free public API I expect a lot of incoming requests. I also expect a lot of database reads / writes. All advice is appreciated, I'm just starting on this project so I can afford to switch stacks easily.
6 Replies
Chaika
Chaika3mo ago
Hey 👋 , Personally I would pick PostgreSql and Redis, and hosting API there, and then Sveltekit on CF Pages if you can. Cloudflare's main database product, D1, is currently in beta and not recommended for production. Additionally, it has hard limits as it is currently a single threaded isolate with 2 GB max. They want you to scale by having mutiple D1 DBs instead of one big one, which is cool but missing a lot of tooling currently to make that possible. CF just currently doesn't have normal database offering that scales infinitely. If you need raw storage, I would rely on R2, R2 + Cache is pretty much unbeatable cost wise and it just works. Of course, some of this is going to depend on exactly what you're building. I think having a hybrid approach is best though and allows you to pick the best pieces from each offering. Self-host DB and API, use CF Pages for Web Application (hard to beat unlimited static requests/ssr which runs everywhere), R2 for generic object storage. And by using such a hybrid approach, you're not vendor locking yourself either. Sveltekit supports a lot of different platforms. R2 supports the S3 API which most storage vendors also support, etc
x03
x033mo ago
Thank you for this rundown, I love the approach you're suggesting. I'm 100% going to use R2 as a bucket store for my SaaS's files and user images. As for Pages, I've had some weird results with it in the past. I have a SvelteKit app already hosted to pages, which does not use workers (i think) and does not integrate any tools like wrangler. Yet I get emails from cloudflare nearly every day stating that I've reached the limit of 100,000 requests for my Pages app. What does this mean exactly?
Chaika
Chaika3mo ago
Pages uses Functions which are Workers under the hood with a bit of magic/extra stuff on top. You get 100k requests/day which is shared among your functions and workers. It doesn't straight cut you off, it's slow to do so/only if you go way above, has been my anecdontal experience. If you're regularly breaching it, you'd probably want to upgrade to Workers Paid though. and Wrangler is Cloudflare's general dev CLI, it does have commands for pages deployment and dev
x03
x033mo ago
Oh makes sense. One last question, if I were to get workers pro or business, does it apply to only one project or all of the projects on my account? I've seen some sources show a max of about 10 projects, with others saying different info
Chaika
Chaika3mo ago
For Workers and functions, there's only two plans: Free Workers Paid For Websites (known internally as Zones), there is Free Pro Business Enterprise Workers Paid is across your entire account. Zone plans are just for that zone What source said a max of 10 projects?
x03
x033mo ago
I faintly remember seeing that in some cloudflare docs page dont remember if it was for workers specifically though let me find it ok I cant find it, i think my brain just made that up xD I'm assuming for workers paid, you pay 5$ per month and it includes ALL of your projects, with pricing increasing as you go oh yeah you said that at the bottom of ur msg didnt read that far 😭 Okay, thanks a ton for your help 🙏
Want results from more Discord servers?
Add your server
More Posts