Skip to main content
A complete coding convention template for production Next.js applications with oRPC API layer, Drizzle ORM, and PostgreSQL.

Download Template

Download as ZIP and extract to .trellis/spec/

What’s Included

CategoryFilesCoverage
Frontend12 filesComponents, hooks, state, oRPC, AI SDK, CSS
Backend10 filesoRPC router, database, auth, performance, logging
Guides3 filesCross-layer thinking, pre-implementation
Shared4 filesTypeScript, code quality, dependencies
Pitfalls5 filesPostgreSQL, build system, mobile CSS

Template Structure

spec/
├── frontend/
│   ├── index.md
│   ├── components.md
│   ├── hooks.md
│   ├── state-management.md
│   ├── orpc-usage.md
│   ├── authentication.md
│   ├── ai-sdk-integration.md
│   └── ...

├── backend/
│   ├── index.md
│   ├── orpc-usage.md
│   ├── database.md
│   ├── authentication.md
│   ├── performance.md
│   └── ...

├── guides/
│   ├── pre-implementation-checklist.md
│   ├── cross-layer-thinking-guide.md
│   └── ...

├── shared/
│   ├── typescript.md
│   ├── code-quality.md
│   ├── dependencies.md
│   └── ...

├── big-question/
│   ├── postgres-json-jsonb.md
│   ├── sentry-nextintl-conflict.md
│   └── ...

└── README.md

Key Topics

Frontend

  • Next.js 15 App Router with React 19
  • oRPC client + React Query integration
  • Server Components vs Client Components
  • Authentication with better-auth
  • Vercel AI SDK (useChat, tool calls, streaming)
  • TailwindCSS 4 + Radix UI patterns

Backend

  • oRPC router, procedures, and middleware
  • Drizzle ORM + PostgreSQL (N+1 prevention, transactions, JSON/JSONB)
  • better-auth server configuration
  • Performance patterns (concurrency, caching, rate limiting)
  • Structured logging with Sentry

Guides

  • Pre-implementation checklist (search before write)
  • Cross-layer thinking for Next.js full-stack changes

Common Pitfalls

  • PostgreSQL json vs jsonb with Drizzle ORM
  • Sentry + next-intl plugin conflict
  • Turbopack vs Webpack flexbox differences
  • WebKit tap highlight on mobile

Usage

  1. Download the ZIP file
  2. Extract to your project’s .trellis/spec/ directory
  3. Replace @your-app/* placeholders with your monorepo package paths
  4. Customize for your specific conventions
  5. Remove sections that don’t apply

View on GitHub

Browse the template source code