A practical guide to implementing a Fastify modular project — Part 1 Technology Selection

Why Choose Fastify Over NestJS, ExpressJS, and Koa? Based on my experience using ExpressJS to set up projects, the project structure was usually like this: src/ └───── infrastructures/ │ ├── db.js ...

By · · 1 min read

Source: dev.to

Why Choose Fastify Over NestJS, ExpressJS, and Koa? Based on my experience using ExpressJS to set up projects, the project structure was usually like this: src/ └───── infrastructures/ │ ├── db.js │ └── server.js │ ├── middlewares/ │ └── authMiddleware.js │ ├── routes/ │ ├── authRoutes.js │ └── messageRoutes.js │ └── services/ ├── messagesService.js ├── userService.js └── authService.js While planning this modular project, I wanted to try something new that would satisfy my desire for high encapsulation. First, I compared NestJS and ExpressJS: Comparison Item NestJS ExpressJS Goal Advanced full-stack backend framework Lightweight web framework Architectural Style Mandatory MVC + modularity + DI (Inspired by Angular) No architectural constraints, high flexibility Learning Curve 🟠 Moderately high (requires understanding of decorators/dependency injection) 🟢 Low (API is concise and easy to use) TypeScript Support Native support, strongly typed by default Requires manual TS configuration