JOB-EASY
System Design

Architecture

A strict 5-tier vertical slice monolith. No circular dependencies, no hidden state.

0. Composition
Routing & Layouts (app/**)
1. Features
authmonitoringsubscriptions+ 20 more slices
2. Shared
App-aware, domain-free (shared/**)
3. UI Kit
Domain-free UI (components/**, hooks/**)
4. Foundation
Publishable utilities (lib/**, config/**)

The 5-Tier Dependency Flow

Vertical Slicing

Unlike traditional MVC apps where all controllers live in one folder and all models in another, Job-Easy places everything related to a specific domain (e.g., auth) into a single folder. This means the React hooks, Prisma repository calls, UI components, and API controllers for authentication all live together.

Prisma Confinement

Only **/repositories/** and shared/db/* may import Prisma. This strict isolation prevents Prisma from bleeding into the UI, controllers, or client bundles. Four lint-declared escape hatches exist for raw SQL, cross-feature workflows, model registries, and analytics.

Dependency Rules

Features cannot import from other features. If monitoring needs to know about auth, it must go through a strictly defined public barrel file (index.ts or index.server.ts). There are only exactly four explicitly documented and isolated tier violations in the entire platform (e.g., analytics reading across domains).

Admin is an Audience

Admin code lives in features/<domain>/admin/, never in a global features/admin/ folder. The admin panel is treated as an audience of the domain, retaining domain cohesion while utilizing isolated cross-user repositories to prevent tenant-isolation bugs.

No Re-export Barrels

The repo has zero re-export barrels (except the exactly two designated feature indices: index.ts and index.server.ts). You must import files directly (e.g., @/components/ui/button). Never use export *.

Routing Rules

The app/ directory is for routing only. Every route.ts simply guards the request and delegates the logic to a controller in the Feature Layer. Route modules export only HTTP handlers (GET, POST, etc.), never helpers or shared logic.