Design System

CRUD Pattern Reference

Complete reference implementation for Create, Read, Update, Delete interfaces.

THIS IS THE STANDARD. Copy these patterns for any entity in the codebase. The Contact entity demonstrates all CRUD operations with proper validation, navigation, and state management.

Architecture Notes

Data Layer

Static mock data in lib/crud-pattern/data.ts. Types, helper functions, and status configurations are centralized here.

Form Components

TanStack Form with @stackmates/ui-forms. FormInput and FormSelect handle validation and error display automatically.

UI Components

Button from @stackmates/ui-interactive/atoms. All other UI is vanilla Tailwind for clarity.

Navigation Pattern

List → Detail → Edit → Detail. Create returns to List. URL params for entity IDs: ?id=1

How to Use This Pattern

  1. Copy lib/crud-pattern/data.ts and replace Contact with your entity
  2. Copy each page and update imports to your data file
  3. Update field names, labels, and validation rules
  4. Replace console.log with actual server actions
  5. Update navigation links to match your routes