Docs
First Steps

First Steps and Core Concepts

In this documentation we will go through the basic concepts and recommended file structure of this adapter, our main goal developing this adapter was to make it synonymous with NestJS and it's opinionated approach and concepts.

đź’ˇ
If you are looking for an installation guide for this adapter, check out our Setup Guide.

Basic File Structure

In NestJS tRPC we take a similar approach to how NestJS implements it's routing system, meaning the file structure should remain similar.

    • app.router.ts
    • app.middleware.ts
    • app.context.ts
    • app.service.ts
    • app.module.ts
    • main.ts
  • Here's a brief overview of those core files:


    app.router.ts
    Comparable to a NestJS controller, a basic router with a single route.
    app.middleware.ts
    Comparable to a NestJS guards or middlewares, its a middleware that can modify
    the request ctx.
    app.context.ts
    A context class that modifies the application context.
    app.service.ts
    A basic service, The same service you will use in any NestJS application.
    app.module.ts
    The root module of the application.
    main.ts
    The entry file of the application which uses the core function NestFactory
    to create a Nest application instance.

    Platform

    As of writing, we only have support for the expressjs driver, while we continue working on the fastify driver.