Architecture

The app uses thin App Router entrypoints, feature-owned domains, shared infrastructure boundaries, and explicit server/client separation.

On this page
Implementation reference3 areas

These Product code locations explain how the documented behavior is implemented. Expand them when you are ready to customize or maintain this area.

Route entrypoints

App Router files should wire metadata, request/response behavior, and delegation only.

  • src/app/docs/page.tsx
  • src/app/api/billing/checkout/route.ts
  • src/app/api/webhooks/stripe/billing/route.ts

Feature modules

Product behavior lives under feature folders with server, UI, shared, persistence, schemas, and services as needed.

  • src/features/billing/server/checkout/service.ts
  • src/features/notifications/server/outbox/services/worker.ts

Infrastructure boundaries

Auth, Supabase, navigation, rate limits, SEO, logging, and uploads stay in lib when multiple domains use them.

  • src/lib/auth/rbac/nav-config.ts
  • src/lib/supabase/server.ts
  • src/lib/security/rate-limit/policy.ts

Reference paths are relative to the Shipflash-Product checkout.

Server and client boundary rule

  1. 1

    Route receives the request

    Route files collect framework-specific inputs and pass stable app-owned parameters to server services.

    Relevant Product code
    • src/app/api/billing/checkout/route.ts
  2. 2

    Server service owns behavior

    Services validate input, enforce auth or policy, call persistence, invoke providers, and return app-owned results.

    Relevant Product code
    • src/features/billing/server/checkout/service.ts
  3. 3

    Persistence owns data access

    Database reads and writes stay in feature-owned persistence or query files so UI and routes do not assemble PostgREST behavior directly.

    Relevant Product code
    • src/features/settings/server/persistence/settings.ts
  4. 4

    UI owns presentation

    Feature UI renders state and actions without importing server-only provider logic.

    Relevant Product code
    • src/features/settings/ui/website-form.tsx