Getting Started with NestJS: A Framework for Opinionated Backend Development
I like NestJS because it makes decisions for you. In a world where Express gives you a blank canvas and says "good luck," NestJS gives you an architecture...
29 Dec 2023 · 2 min read

I like NestJS because it makes decisions for you. In a world where Express gives you a blank canvas and says "good luck," NestJS gives you an architecture. Controllers, services, modules -- all structured from the start.
It builds on top of Express (or Fastify) and borrows heavily from Angular's architecture. If you have worked with Angular, NestJS will feel familiar. If you have not, the learning curve is worth it for the structure it provides.
Getting Started
Install the CLI and scaffold a project:
npm i -g @nestjs/cli
nest new project-name
The CLI generates a project with an MVC structure out of the box. The entry point is main.ts. The controller handles routes. The service handles business logic.
Start the dev server:
npm run start:dev
Building an Endpoint
Say you need a JSON endpoint for a "cats" resource. One command:
nest g controller cats
This generates cats.controller.ts. Create a service to handle the logic:
import { Injectable, Res } from '@nestjs/common'
The separation between controllers and services is enforced by the framework. That is the opinionated part -- and it is a feature, not a limitation.
Why It Matters
On teams, opinions reduce arguments. When the framework dictates project structure, you spend less time debating folder layouts and more time shipping features. New developers onboard faster because every NestJS project looks the same.
The trade-off is flexibility. If you need something truly custom, NestJS constraints can feel restrictive. For most CRUD-heavy backend services, though, the structure pays for itself quickly.
Ehsan Gazar helps software engineers take LLM and agent systems from demo to production. He writes about building LLM systems that hold up in production: evals, tracing, RAG, agent architecture and cost control. He teaches the Senior to Staff AI Engineer cohort on Maven, where engineers learn to design and defend these systems.
Forward Deployed AI Engineering: From Customer Problem to Production Value
A live Maven cohort for engineers: 10 live 90-minute sessions taking one AI engagement from customer problem to production, ending with eight artefacts and a working slice in your own repo.
January cohort starts Tue 12 Jan 2027, Tue & Thu 6:30pm London. Enrolling now, 20 seats, $1,800.
View the live cohortKeep reading
- Your 2027 AI Plan Should Fit on One Page: Six Questions to Answer First
- The AI System Works. So Why Is Nobody Using It?
- If AI Had Existed When Your Workflow Was Designed, Would It Look Like This?
- AI Transformation Is Not Digital Transformation With a New Tool
- Your AI Pilot Saved Time. Why Didn't the Business Change?
- A Chatbot Answers. An Agent Does the Work. Here Is the Difference