Skip to main content

Source Directory (src/)

The src/ directory contains all application source code organized by functionality and concern.

src/
├── actions/ # Server actions for mutations
├── app/ # Next.js App Router pages, layouts, and API routes
├── components/ # React components (UI, domain features, sidebar routes)
├── context/ # React Context providers
├── hooks/ # Custom React hooks
├── lib/ # Utility libraries, Supabase clients, permission helpers
├── middleware/ # Legacy route pipelines and validators (reference only)
├── services/ # Data access layer (incl. accessCheck/)
├── types/ # TypeScript type definitions
└── middleware.ts # Next.js Edge middleware entry point

Permission gating runs in two places today:

  1. Edge middleware.ts keeps the Supabase session in sync and redirects unauthenticated requests to /auth/sign-in.
  2. Route-group layouts ((team-layout) and (campaign-layout)) plus per-page requireAccess(...) calls handle team/campaign access and per-permission-key gates. The route-pipeline files in src/middleware/** are dormant reference code — they are not invoked by middleware.ts today.