Journey into MicroServices with NestJS

Journey into MicroServices with NestJS


Recently, I've been contemplating increasingly on how to develop a SaaS product efficiently, aiming to bypass the typical project boilerplate that accompanies each new venture.

You're familiar with the usual suspects: authentication, teams, users, payments, and the admin panel. The admin panel often takes a backseat, as you can manage without one by directly modifying database records, allowing you to concentrate on crafting your NEXT BIG THING—whatever that may be.

In 2023, I noticed a significant pushback against microservices. Critics argue they're not worth the effort, citing increased complexity and wasted time. This sentiment seems partly influenced by DHH, who discussed how Amazon reportedly cut costs by 90% by reverting to a monolithic architecture. This discussion sparked my interest about microservices, a concept I had yet to explore.

Returning to the topic of SaaS projects, I realized that each new 'pet project' required me to recreate the same functionalities: teams, users, roles, authentication, and authorization. DHH's insights ignited my interest in microservices. I've always been intrigued by the idea of building a project based on microservices but lacked a clear use case and the necessary tooling—or so I thought at the time. The prospect of investing time and effort into something more demanding to manage than to develop was unappealing.

Nevertheless, I decided to dedicate time to learning how microservices are developed using the NestJS framework. In doing so, I've chosen the best of both worlds: Constructing a project with a monorepo, yet everything is divided into multiple services, with a shared library of code that is reused as needed. So far, the results have been promising.

Regarding running the project, for the last year, I have been actively managing serverless deployments—Cloud Run and Google Kubernetes—and I'd like to think that I have a pretty good grasp of what to expect and how everything should tie together in a production environment. So, I'm clear on that department.

My primary goal isn't just the independent scalability and deployment of each service. I'm aiming for reusability across different projects to save time in the long run. I'll share more insights on this journey next week