Understand the recommended file structure for NestJS-tRPC
mainNestJS-tRPC follows the opinionated patterns of NestJS. To maintain consistency with the NestJS ecosystem, it is recommended to organize your files using a structure similar to standard NestJS modules.
Core files typically include:
app.router.ts: Acts like a NestJS controller; defines your tRPC routes.app.middleware.ts: Acts like NestJS guards or middlewares; used to modify the request context (ctx).app.context.ts: A class used to modify the application context.app.service.ts: A standard NestJS service containing business logic.app.module.ts: The root module of your application.main.ts: The application entry point usingNestFactoryto bootstrap the instance.