Photo by Amélie Mourichon on Unsplash
The 9 Services You Need for a Scalable Startup
5 min read
Manually cloning your repo and running your app on a random digital ocean VPS is not sustainable or scalable. I built a startup as a solo dev that scaled to over 1,000,000 users (with up to 10,000+ concurrent connections) and these are the services that I used to get there (and what it cost me).
Kubernetes (Google Cloud or Digital Ocean)
When I started my project, I used Kubernetes. Many claim it's over-complicated, and, if you don't plan to scale, it probably is. But if you want to build an app that will grow, it will pay off immensely. Not only is it trivial to scale (you can easily scale containers by CPU load with HPAs), it makes setting up new services less of a hassle. For example, in my last project, there was a Python library and a C# library that didn't have replacements in TypeScript, so I simply built wrappers around them and turned them into services. If setting up a service wasn't as trivial, I might've tried to make do with adding to the monolith, even if creating a new service was the right thing to do.
I used Google Cloud at the time. It's fine, but I do want to try Digital Ocean next, since GCloud had a ton of features that I rarely, making their interface more complicated.
Additionally, I was not using Terraform at the time, but I probably would now (since manually applying all the Kubernetes files was error-prone).
P.S. You'll need a container registry so Kubernetes has somewhere to pull your Docker images from. Both GCloud and Digital Ocean support this.
Postgres and Redis
Pick the right tool, of course—if you know NoSQL or another database is right for your project, use that. However, even in the constantly-changing database schemas of the startup world, Postgres (with an ORM that can handle migrations smoothly) is rarely a bad choice.
Redis (or an alternative) is a must-have. You can reduce your Postgres queries five or tenfold with proper caching. Without Redis, your primary database will likely be your largest cost. In addition, it's a must for scaling; I've never had a website go down under Redis load, but I've had many issues with Postgres getting overloaded (unoptimized queries, spike in traffic that maxes out its connections, etc).
New Relic/Datadog and Pagerduty
At some point, something will go wrong. If you have 200 concurrent users on your site for a growing startup, going down for an hour sucks. Going down overnight is terrible. Pager Duty is free for solo devs, so there's not much of an excuse not to use it.
Datadog and New Relic are up to personal preference—I did some research back in 2019 and picked Datadog. I did some research recently and would instead choose New Relic due to its friendly pricing for solo devs. Do your research, but as of right now, it seems to be mainly pricing differences for roughly the same set of features (logging, APM tracing, metrics, etc).
Sentry for frontend errors. Not much to say here; I'm sure there are alternatives, but Sentry works great and has a free plan to get started. Make sure to consistently update your frontend to block unnecessary errors so you don't eat into your quota with false positives.
Redash (Visualize SQL Queries)
You don't need to pick Redash specifically, but anything that will help you visualize queries. It's a pain to make business decisions by writing queries, importing them to Google Sheets or Excel, and then creating graphs.
Github or Gitlab
I chose Gitlab for my last project, simply because it was free for private repos (and I liked the ability to self-host in the future). If you're a solo dev, it doesn't really matter—and you can always transfer from one to the other later. For what it's worth, Github has more free CI/CD minutes than Gitlab.
Redis, Postgres, Kubernetes, and Container Registry pricing are all based on Digital Ocean.
Kubernetes - $48/mo to start (represents two nodes each with 2 vCPUs and 2.5GB of RAM; you may need more or less, this one is hard to predict)
Container Registry - $5/mo
Redis - $15/mo
Postgres - $15/mo (at least, may become $30/mo or $60/mo in the first couple of months depending on your needs)
Pager Duty - Free for solo devs!
New Relic - Free-ish (They charge a reasonable rate for data and a hefty cost per user after the first, so great for solo devs, but pricey as your team scales)
Sentry - Free (You'll likely need to upgrade to $26/mo in the first couple of months)
Redash - $12/mo (Or $0 if you host locally)
GitHub - Free for solo devs!
Total: $95/mo (could be cheaper if you choose lower-cost machines and self-host Redash)
In your first few months, you're probably not making any money, but your costs will go up. Here are some ways to keep them manageable (this could probably be its own article, but whatever, bonus content):
Postgres Storage: Look for cheaper options for write-only data or data that doesn't need to be accessed often (e.g. metrics in longer-term storage, calculated data that could instead be cached, etc)
Postgres CPU/Memory: Cache more
Kubernetes Node CPU/Memory: Optimize your app (duh). Also cache more! E.g. it may be lower cost to host your frontend statically VS running an nginx server in a pod.
Sentry/New Relic/Datadog: Watch what data you're sending—gobs of unnecessary logs or errors can sometimes be forwarded. Setup some kind of ingestion control so you're only intaking 50% or 25% of APM traces.
Container Registry: Delete outdated images.