- Install dependencies
pnpm install- Configure environment
cp .env.example .envEdit .env with your configuration values.
- Run database migrations
pnpm db:migrate- Start development server
pnpm dev| Command | Description |
|---|---|
pnpm dev |
Start dev server with hot-reload |
pnpm build |
Build for production |
pnpm start |
Start production server |
pnpm typecheck |
Type check without building |
pnpm lint |
Check code for issues |
pnpm lint:fix |
Auto-fix lint issues |
pnpm format |
Format code |
pnpm db:migrate |
Run pending migrations |
pnpm db:migrate:new |
Create a new migration file |
src/
├── config/ # App configuration (db, env, redis, logger, etc.)
├── core/
│ ├── errors/ # Custom error classes and error handler
│ ├── events/ # Event subscriber registrations
│ ├── middleware/ # Auth, RBAC, audit, validation, logging
│ ├── services/ # Core services (audit log)
│ └── utils/ # JWT, hashing, pagination, async handler
├── db/
│ └── migrations/ # SQL migration files
├── modules/
│ ├── auth/ # Authentication (register, login, OTP)
├── types/ # TypeScript type declarations
├── utils/ # Cache service, rate limiting
├── app.ts # Express app setup
├── server.ts # Server entry poin
- Create a directory under
src/modules/your-module/ - Add the standard files:
your-module.schema.ts— Zod validation schemasyour-module.service.ts— Business logicyour-module.controller.ts— Request handlersyour-module.routes.ts— Route definitionsyour-module.openapi.ts— Swagger/OpenAPI registration
- Register routes in
src/app.ts - Create a migration:
pnpm db:migrate:new your-migration-name
Swagger UI is available at /docs when the server is running.