Please select your packages to see the folder structure of a newly scaffolded app with those selections. Further down, you will find a description of each entry.
prisma folder contains the
schema.prisma file which is used to configure the database connection and the database schema. It is also the location to store migration files and/or seed scripts, if used. See Prisma usage for more information.
public folder contains static assets that are served by the web server. The
favicon.ico file is an example of a static asset.
Used for environment variable validation and type definitions - see Environment Variables.
pages folder contains all the pages of the Next.js application. The
index.tsx file at the root directory of
/pages is the homepage of the application. The
_app.tsx file is used to wrap the application with providers. See Next.js documentation↗ for more information.
api folder contains all the API routes of the Next.js application. See Next.js Api Routes Docs↗ for info on api routes.
[...nextauth].ts file is the NextAuth.js authentication slug route. It is used to handle authentication requests. See NextAuth.js usage for more information on NextAuth.js, and Next.js Dynamic Routes Docs↗ for info on catch-all/slug routes.
[trpc].ts file is the tRPC API entrypoint. It is used to handle tRPC requests. See tRPC usage for more information on this file, and Next.js Dynamic Routes Docs↗ for info on catch-all/slug routes.
server folder is used to clearly separate server-side code from client-side code.
The main entrypoint for server-side authentication logic. Here, we setup the NextAuth.js configuration options, perform module augmentation as well as provide some DX utilities for authentication such as retrieving the user’s session on the server-side. See NextAuth.js usage for more information.
db.ts file is used to instantiate the Prisma client at global scope. See Prisma usage and best practices for using Prisma with Next.js↗ for more information.
api folder contains the tRPC server-side code.
routers folder contains all your tRPC sub-routers.
example.ts file is an example tRPC router utilizing the
publicProcedure helper to demonstrate how to create a public tRPC route.
Depending on your chosen packages this router contains more or less routes to best demonstrate the usage to your needs.
trpc.ts file is the main configuration file for your tRPC back-end. In here we:
- Define context used in tRPC requests. See tRPC usage for more information.
- Export procedure helpers. See tRPC usage for more information.
root.ts file is used to merge tRPC routers and export them as a single router, as well as the router’s type definition. See tRPC usage for more information.
styles folder contains the global styles of the application.
utils folder is used to store commonly re-used utility functions.
api.ts file is the front-end entrypoint to tRPC. See tRPC usage for more information.
.env file is used to store environment variables. See Environment Variables for more information. This file should not be committed to git history.
.env.example file shows example environment variables based on the chosen libraries. This file should be committed to git history.
.eslintrc.cjs file is used to configure ESLint. See ESLint Docs↗ for more information.
next-env.d.ts file ensures Next.js types are picked up by the TypeScript compiler. You should not remove it or edit it as it can change at any time. See Next.js Docs↗ for more information.
next.config.mjs file is used to configure Next.js. See Next.js Docs↗ for more information. Note: The .mjs extension is used to allow for ESM imports.
postcss.config.cjs file is used for Tailwind PostCSS usage. See Tailwind PostCSS Docs↗ for more information.
prettier.config.cjs file is used to configure Prettier to include the prettier-plugin-tailwindcss for formatting Tailwind CSS classes. See the Tailwind CSS blog post↗ for more information.
tsconfig.json file is used to configure TypeScript. Some non-defaults, such as
strict mode, have been enabled to ensure the best usage of TypeScript for Create T3 App and its libraries. See TypeScript Docs↗ or TypeScript Usage for more information.