Template Guides
Step-by-step guides for scaffolding common structures
Overview
These templates provide step-by-step instructions for creating common structures in the application. Each template is a comprehensive guide that walks you through the entire process with real code examples.
Templates are designed to be:
- Prescriptive - Follow exact steps to avoid missing critical pieces
- Comprehensive - Cover all files, configurations, and post-creation tasks
- Example-driven - Show real code patterns used throughout the codebase
- Checklist-based - Verify completion with built-in checklists
Available Templates
Core Structure Templates
Create New Feature
Complete feature module using the 5-file pattern with schema, functions, hooks, fields, and prompts
Create New Page
Add a new page with declarative routing, translations, and navigation integration
Create Database Table
Define a Drizzle table with RLS policies, indexes, and proper relationships
Create tRPC Router
Build a type-safe API router with CRUD operations and rate limiting
Add Translations
Add i18n translation keys across all locale files with proper structure
When to Use Each Template
Use new-feature when:
- Creating a new domain entity (e.g., api-keys, notifications, projects)
- Need full CRUD operations with forms and dialogs
- Building a feature that requires database operations and UI
Use new-page when:
- Adding a new route to the application
- Creating dashboard pages, settings pages, or public pages
- Need proper routing with SEO and navigation integration
Use new-table when:
- Adding a new database entity
- Need RLS security policies
- Creating relationships between entities
Use new-router when:
- Building a new API endpoint
- Need type-safe server procedures
- Want to expose REST endpoints via OpenAPI
Use add-translation when:
- Adding new UI text or messages
- Creating page-specific translations
- Need to support multiple languages
Template Workflow
Most features follow this sequence:
- Create Database Table - Define data structure
- Create Feature Module - Implement business logic
- Create tRPC Router - Expose API endpoints
- Create Page - Build UI for the feature
- Add Translations - Internationalize content
Not all features require all steps. Simple pages may only need steps 4-5, while API-only features may skip step 4.
Template Conventions
All templates follow these conventions:
- File paths are absolute - Always start from
src/ - Names use consistent casing - kebab-case for files, PascalCase for components, camelCase for functions
- Checklists are mandatory - Complete all items before considering the work done
- Examples show real patterns - Code samples come from actual features in the codebase
Getting Help
If you need clarification on any template:
- Check the relevant documentation in
/docs - Look at existing features in
src/featuresfor reference - Review the pattern documentation in
/content/docs/patterns
Before starting: Always read the Prerequisites section of each template to ensure you have all the information needed.