How linsheng24/express-tsoa-starter works
Project type and purpose
• This is a TypeScript-based backend application starter using Express and TSOA.
• It provides a REST API (and can render EJS views/static assets), manages a relational database via Prisma, and uses PM2 (or Docker) for process management.
File structure
Top-level components and patterns:
• bin/www.ts & server.ts – entrypoints that bootstrap the Express/Tsoa server.
• app.ts – configures the Express app (middleware, routing).
• config/ – loads environment and app configuration.
• controllers/ (TSOA) – defines HTTP routes and delegates to services.
• services/ – business logic layer.
• models/ – domain models or Prisma-generated types.
• prisma/ – schema.prisma and migrations (data layer).
• lib/ – cross-cutting utilities (authentication, DB connection, logger, cron jobs).
• middleware/ – Express middleware (error handling, validation).
• errors/ – centralized error-factory and constants.
• ioc/ – Inversion-of-Control container setup and registrations.
• utils/ – small helpers (encryption, validation).
• views/ & static/ – EJS templates + static assets for server-side rendering or SPA hosting.
• nodemon.json, pm2.config.cjs, Dockerfile – development and deployment orchestration.
README for additional insights
• Starter commands for dev, PM2, database synchronization and migrations.
Diagramming conventions
• Clear, human-readable labels for each component or layer.
– Presentation/API (Express, Controllers)
– Business logic (Services)
– Data layer (Prisma, Database)
– Infrastructure (IOC, Logger, Cron, PM2/Docker)
Thoroughness and clarity
• Cross-cutting utilities (authentication, error handling, logging).
• How configuration, environment variables, and DI registration plug into server startup.