Frameworks
Express
Generate Express APIs with middleware support and predictable project structure.
Express is the most familiar Node.js web framework. It is a good choice when you want a large ecosystem, simple middleware composition, and conventional request/response handlers.
Choose Express When
- Your team already knows Express
- You want the largest middleware ecosystem
- You are building a traditional REST API
- You want simple
reqandreshandler functions
Generated Entry Points
Express projects generate:
src/
app.ts # creates and configures the Express app
server.ts # starts the HTTP serverapp.ts owns middleware and route mounting. server.ts owns the port and startup behavior.
Route Example
import { Router } from "express";
import { UsersController } from "./users.controller";
const router = Router();
router.get("/", UsersController.getAll);
router.post("/", UsersController.create);
router.get("/:id", UsersController.getById);
router.patch("/:id", UsersController.update);
router.delete("/:id", UsersController.remove);
export default router;Middleware Flow
request
|
v
express.json()
|
v
optional CORS
|
v
API routes
|
v
not found middleware
|
v
optional error handlerOptional Features
| Feature | What it adds |
|---|---|
| CORS | cors package and src/config/cors.ts |
| Env config | dotenv and src/config/env.ts |
| Error handler | shared error classes and middleware |
| Pino logger | pino dependency |
| Zod validation | zod dependency and validator-ready module files |
| Vitest | test script and vitest dependency |
Architecture Notes
- Minimal Express projects use route files with inline handlers.
- Modular Express projects use
src/modules/{feature}. - Layered Express projects use top-level
src/routes,src/controllers,src/services, and related layer folders.