The Tech Stack of a One-Man SaaS

Last modified on November 23, 2020

Being an engineer at coronary coronary heart, at any time as quickly as I stare a firm write about their tech stack, I brew a latest cup of espresso, chill out and experience studying the newfound microscopic deal with.

There’s ethical one factor mesmerizing about attending to grab what’s under the hood of totally different contributors’s corporations. It’s adore gossip, however about machine.

A pair of months in the past I began engaged on one other personal analytics provider, a undertaking which has lengthy earlier by means of a kind of iterations, and I've lucky that 400+ web sites have already constructed-in with it, even although it's nonetheless within the early levels.

That’s why, within the an identical spirit as Jake Lazaroff’s Instruments and Products and companies I Employ to Flee My SaaS, I believed it’s now my flip to pause a transient write up of the applied sciences I’m the exhaust of to bustle this distinctive provider.

Languages

Over the years I even have added many programming languages to my toolbelt, however for solo initiatives I even have converged to 2 notably that strike a right stability of productiveness and reliability.

  • Python: So a lot of the backend code is in Python. Which has enabled me to ship substances extremely fast. Furthermore, I exhaust mypy for non-compulsory kind hints, which helps help the codebase manageable.

  • Typescript: I venerable to steer decided of engaged on the frontend as highly effective as I may even. That's except I came upon Typescript about Four years in the past. It ethical makes the full abilities critically higher, and I now exhaust it for all my initiatives at the side of React.

Frameworks and libraries

This guidelines would perchance nicely even had been expansive, as I stand on the shoulders of giants who've printed the expansive quantity of launch-supply code which I depend on. However I may even want to focus on most interesting a handful on account of their vital position within the stack:

  • Django: It be adore a superpower for solo builders. The longer you are employed on this business, the additional you love now not having to reinvent the wheel for the 100th time. A monolithic framework can acquire you principally, principally a good distance. To me, it's about predictable machine that's fast in each technique that issues. At the identical time as you discontinuance up , I talk about additional about this matter on Expend Dead Technology.
  • React: The acquire app for the dashboards is constructed the exhaust of React + Webpack. After the exhaust of Angular for a really very prolonged time, I switched to React which capability of it's ethical a pluggable glimpse layer that may now not acquire within the technique. I exhaust the unbelievable django-react-templatetags to embed the React substances in my Django templates.
  • NextJS: I exhaust it for the touchdown pages, documentation and the weblog which you might be at point out studying. It permits me to re-exhaust assorted React substances, and nonetheless reap the effectivity and internet pages positioning benefits of a statically generated web page.
  • Celery: I exhaust it for any roughly background/scheduled duties. It does have a learning curve for added advanced exhaust-cases, then again it's comparatively official as quickly as the best possible blueprint it really works, and additional importantly when it fails.
  • Bootstrap 4: I constructed a customized theme on high of Bootstrap. It has saved me a kind of time, and there may very well be tons of documentation round it. That's why I picked it.

Databases

I initially saved all recordsdata in a single SQLite database, doing backups supposed making a copy of this file to an object storage adore S3. On the time, it turned greater than ample for the puny web sites I examined Panelbear with. However as I added additional substances and web sites, I wanted additional specialised machine to toughen these substances:

  • Clickhouse: I drawl that is one in each of these applied sciences that over time will flip into ubiquitous. It be in actual fact a uncommon share of machine that enabled me to assemble substances that originally gave the affect very now not really on low-impress {hardware}. I pause intend to jot down a future weblog publish on some lessons realized from working Clickhouse on Kubernetes. So conclude tuned!
  • PostgreSQL: My inch-to relational database. Sane defaults, battle-examined, and deeply constructed-in with Django. For Panelbear, I exhaust it for all utility recordsdata that's now not analytics linked. For the analytics recordsdata, I as a exchange wrote a easy interface for querying Clickhouse inside Django.
  • Redis: I exhaust it for a lot of issues: caching, price-limiting, as a job queue, and as a key/worth retailer with TTL for assorted substances. Rock-stable, and gargantuan documentation.

Deployment

I deal with my infrastructure as cattle as a exchange of pets, issues adore servers and clusters are imagined to technique succor and inch. So if one server will get "sick", I ethical change it with another one. Which technique all of the issues is described as code in a git repo, and I pause now not trade issues by SSH'ing into the servers. You would perchance nicely even assume of it adore a template to clone my full infrastructure with one present into any AWS area/ambiance.

This additionally helps me in case of disaster restoration. I ethical bustle simply a few directions, and a few minutes later my stack has been re-created. This turned notably treasured as quickly as I moved from DigitalOcean, to Linode, and currently to AWS. All the items is described in code, so it's easy to withhold music of what substances I possess, even years later (all corporations have some AWS IAM coverage or VPC subnet lurking round which turned created by means of clicky-clicky on the UI, and now all folks will depend on it).

  • Terraform: I handle most of my cloud infrastructure with Terraform. Things adore EKS clusters, S3 buckets, roles, and RDS cases are declared in my Terraform manifests. The practice is synced to an encrypted S3 bucket to steer decided of getting into into problem in case one factor occurs to my vogue laptop private laptop.
  • Docker: I assemble all of the issues as Docker images. Even stateful substances adore Clickhouse or Redis are packaged and shipped as Docker containers to my cluster. It additionally makes my stack very moveable, as I'll bustle it wherever I'll bustle Docker.
  • Kubernetes: Allowed me to simplify the operational elements vastly. However, I wouldn’t bindly recommend it to all folks, as I already felt completely happy working with it after having the pleasure of putting down a couple of manufacturing fires for my employer by means of the years. I additionally depend on managed selections, which helps lower the burden too.
  • GitHub Actions: In whole I’d exhaust CircleCI within the earlier (which can also be gargantuan), however for this undertaking I choose to exhaust GitHub Actions as a result of it removes one other provider which must have entry to my repositories, and deployment secrets and techniques. However, CircleCI has heaps of right substances, and I nonetheless recommend it.

Infrastructure

I began in a single $5/mo occasion in DigitalOcean, then moved to the managed Kubernetes providing as I turned reinventing the wheel for a kind of issues Kubernetes already gives me out of the sector (provider discovery, TLS certs, load balancing, log rotation, rollout, scaling, fault-tolerance, amongst others).

Unfortunately, I had reliability factors with DigitalOcean's Kubernetes providing, even on greater cases. The cluster API would robotically inch down randomly and now not get nicely, this disrupted a kind of cluster companies together with the load balancer, which translated into downtime for me. I needed to assemble a model distinctive cluster at any time when this happened, and whereas Terraform made it trivial, this turned now not one factor that impressed a kind of self notion about their managed provider. I think their help an eye fixed on airplane turned underprovisioned, which could be roughly comprehensible given the mark.

Unfortunately I turned now not in a position to acquire to the underside of the issue after hundreds of weeks. That's why I determined to switch to Linode, and had precisely zero points all the best possible blueprint through the 1.5 month-lengthy honeymoon that adopted.

However, I latterly moved all but once more, this time to AWS on account of a fairly right deal I purchased. It additionally enabled me to exhaust managed companies adore RDS to dump managing PostgreSQL, which is a mountainous plus. What made all these migrations fairly easy, turned that every one my infrastructure turned described by means of Terraform and Kubernetes manifests. The migrations with out a doubt consisted of a night, some tea, and persistence. However that's for another publish.

  • AWS: Predictable, and tons of managed companies. However, I exhaust it at my beefy-time job, so I did now not should eat too highly effective time figuring issues out. The vital companies I exhaust are EKS, ELB, S3, RDS, IAM and personal VPCs. I may even merely moreover add Cloudfront and Kinesis in the future.
  • Cloudflare: I primarily exhaust it for DDoS security, serving DNS, and offloading edge caching of a kind of static property (at point out shaves off 80% of the egress prices from AWS - their bandwidth pricing is insane!).
  • Let’s Encrypt: Free SSL certificates authority. I exhaust cert-manager in my Kubernetes cluster to robotically educate and renew certificates primarily based on my ingress rules.
  • Namecheap: My area identify registrar of desire. Permits MFA for login which is a predominant safety association. No longer like different registrars, they haven't bowled over me with an expensive renewal each few years. I like them.

Kubernetes substances

The subsequent substances automate tons of the devops work for me. I exhaust hundreds of others too, however simply a few of the numerous ones I exhaust are:

  • ingress-nginx: Rock-stable ingress controller for Kubernetes the exhaust of NGINX as a reverse proxy, and cargo balancer. Sits within the succor of the NLB which controls ingress to the cluster nodes.
  • cert-manager: Mechanically educate/renew TLS certs as outlined in my ingress rules.
  • external-dns: Synchronizes uncovered Kubernetes Products and companies and Ingresses with DNS suppliers (similar to Cloudflare).
  • prometheus-operator: Mechanically screens most of my companies, and exposes dashboards by means of Grafana.
  • flux: GitOps approach to pause steady provide in Kubernetes. Basically pulls and deploys distinctive Docker images as quickly as I launch them.

CLI devices

There’s heaps proper right here, however usually venerable embody:

  • kubectl: To engage with the Kubernetes cluster to see logs, pods and companies, SSH correct into a working container, and heaps others.
  • stern: Multi pod log tailing for Kubernetes. Really useful.
  • htop: Interactive machine course of viewer. Better than “high” in case you quiz me.
  • cURL: Enviornment HTTP requests within the neighborhood, peep headers.
  • HTTPie: Like cURL, however extra easy for JSON APIs.
  • howdy: Load making an try out HTTP endpoints. Presents a efficient latency distribution abstract.

Monitoring

  • Prometheus: Atmosphere nice storage of time sequence recordsdata for monitoring. Tracks your full cluster and app metrics. It turned tons a lot much less expensive than the exhaust of Cloudwatch for app metrics.
  • Grafana: High high quality dashboards for the Prometheus monitoring recordsdata. All dashboards are described in JSON recordsdata and versioned within the git repo.
  • Sentry: Software exception monitoring and aggregation. Notifies when there are unhandled errors with additional metadata.
  • Loki: Log aggregation machine impressed by Prometheus. It’s bundled with the prometheus-operator, and helps me search logs proper through the cluster.

E-mail

  • Fastmail: My different of trade piece of email. Wonderful, and legit.
  • Sendgrid: I exhaust it for transactional emails (piece of email verification, login safety alerts, password reset

Read More

Similar Products:

    None Found

Recent Content