Skip to content

Tier System

All features live in their access tier, not by component type. This enables code splitting, security isolation, and predictable structure. The authoritative spec is src/tiers/ARCHITECTURE.md.

src/tiers/
  users/    ← All authenticated-user features (main platform) — LARGEST TIER
  public/   ← Unauthenticated: public trader profiles, certificate verify
  admin/    ← Admin-only: trainer plans, commissions, cert templates
  landing/  ← Marketing / landing pages

Feature directory structure

Every feature is tiers/[tier]/features/[name]/:

components/   ← Feature-specific UI components
hooks/        ← Feature-specific data hooks (supabase.rpc lives here)
pages/        ← Route-level page components
services/     ← EF call wrappers (supabase.functions.invoke lives here)
utils/        ← Pure computation functions
tests/        ← 4-layer test suite (mandatory, co-located)
index.js      ← Barrel exports

Feature groups (nesting)

edge-builder/ is a feature group, not a flat feature. Its sub-features each follow the structure above one level deeper:

tiers/users/features/edge-builder/
  trade-planner/  psychology-builder/  risk-radar/
  session-review/ habit-tracker/       trade-journal/
  config/         ← edgeBuilderConfig.js (authoritative EDGE_FN registry)

Cross-tier import rules

  • users/ cannot import from admin/.
  • public/ cannot import from users/ or admin/.
  • All tiers can import from global src/components/ and src/lib/.
  • Features import UI from their own tier's components/ui/, not global ui/ directly — see Frontend.

See also: Frontend architecture · Features index.