Goals
For client and startup work, backend code needs to be:
- Easy to onboard new devs
- Simple to deploy
- Easy to extend
My Usual Layout
src/config— env, DB, loggingsrc/modules— one folder per domain (auth, users, orders…)src/modules/*/controller.tssrc/modules/*/service.tssrc/modules/*/model.ts(or Prisma schema)src/routes— wiring routes to controllers
Other Conventions
- All responses go through a small helper (consistent shape)
- Error classes for domain vs validation vs auth errors
- Request validation with Zod or Joi, never “trust the client”
This keeps things boring in a good way — and boring backends scale.
