How to Extend

LaunchFast is a founding state, not a finished product. You will add features. This page explains how to do so while maintaining correctness.

The extension principle

Add features by following existing patterns, not by introducing new mechanisms. The codebase has opinions. Adopt them.

Adding a new route

  1. Create file in app/routes/ following flat file convention
  2. Use existing layout routes where applicable
  3. Follow the loader/action pattern from similar routes
  4. Use existing utilities from app/utils/

Adding a database table

  1. Update schema in prisma/schema.prisma
  2. Run npx prisma migrate dev to create migration
  3. Access data only through db.server.ts
  4. Never modify existing migrations

Adding authentication

Authentication is already implemented. To protect new routes:

  1. Use requireUserId(request) in loader/action
  2. Use userHasRole(user, role) for role-based access
  3. Do not create alternative auth mechanisms

Adding a third-party service

  1. Add API key to env.server.ts (never client-accessible)
  2. Create server-only module: services/[name].server.ts
  3. Use fetch directly instead of adding SDK dependencies when simple
  4. Add MSW handlers for testing

Adding UI components

  1. Check if component exists in app/ui/
  2. Use npx shadcn@latest add [component] for shadcn components
  3. Follow existing component patterns and naming
  4. Use existing design tokens (colors, spacing, typography)

What not to do

These actions violate correctness:

  • Creating alternative ways to access the database
  • Implementing a second authentication system
  • Adding multi-cloud abstraction layers
  • Building a plugin or extension mechanism
  • Exposing server environment variables to the client

When patterns don't fit

If you need something that doesn't fit existing patterns:

  1. Verify the need is real, not speculative
  2. Consider if it belongs in a separate service
  3. If adding to the codebase, document the deviation
  4. Update CLAUDE.md to include new constraints