HOW CREATE T3 APP
ACTUALLY WORKS
The best way to start a full-stack, typesafe Next.js app. Conventions, patterns, and architecture extracted from the t3-oss/create-t3-app repository by sourcebook.
WHAT_MATTERS
-
→
This is a monorepo — check workspace dependencies before modifying shared code
-
→
Uses tRPC routers for routing — follow this pattern, don't add REST routes directly
-
→
Generated files detected — editing them directly will break builds
-
→
www/src/config.ts is a hub file (imported by 6 files) — changes here ripple everywhere
KEY_FINDINGS
This is a monorepo. Changes may affect multiple packages. Check workspace dependencies before modifying shared code.
HIGHProject strongly prefers path alias imports (@/ or ~/) over relative imports. Use aliases for cross-directory imports.
HIGH61 alias imports vs 17 relative imports in sampled files
Project strongly prefers named exports over default exports. Use `export function` / `export const`, not `export default`.
HIGH82 named vs 16 default exports in sampled files
Use Zod schemas for validation. This is the project's standard validation approach.
HIGH8 files use Zod
Data fetching uses React Query (useQuery/useMutation). Follow this pattern for new data operations.
HIGH9 files
Auth uses better-auth.
HIGH19 files
Styling uses Tailwind CSS utility classes. Custom design tokens defined in www/tailwind.config.ts — use these instead of arbitrary values.
HIGH11 files
Database access uses Prisma. Look for schemas in prisma/schema.prisma.
HIGH8 files
Generated files detected (cli/template/extras/src/app/layout/with-tw.tsx, cli/template/extras/src/pages/index/with-better-auth-trpc.tsx, cli/template/extras/src/pages/index/with-tw.tsx, cli/template/extras/src/app/layout/base.tsx, cli/template/extras/src/app/layout/with-trpc-tw.tsx, ...). Do NOT edit these directly — modify the source/schema they are generated from.
HIGH14 generated files
Route definitions live in: cli/template/extras/src/server/api, cli/template/extras/src/server/api/trpc-pages, cli/template/extras/src/server/api/trpc-app. Add new endpoints here.
HIGH3 route directories
Hub files (most depended on): www/src/config.ts (imported by 6 files). Changes here have the widest blast radius.
HIGH+ 2 MORE FINDINGS (MEDIUM CONFIDENCE)
API endpoints use tRPC routers. Follow this pattern for new routes.
MED5 files use tRPC routers
UI components live in: www/src/components. Add new components here.
MED1 component directories