# Module Dependencies High-level dependency graph for the `src/` module structure. Arrows point from consumer to consumed module. ```mermaid flowchart LR subgraph Entry[Entry Points] INDEX["src/index.ts
Express server bootstrap"] CLI["src/cli/index.ts
Commander 23 commands"] end subgraph App[Application Layer] CR["composition-root.ts
DI wiring, provider setup"] PS["provider-status.ts
health reporting"] MW["middleware/
auth, error, security,
rate-limit, request-log"] end subgraph Core[Core Business Logic] PIP["pipeline/
5-stage orchestrator"] SC["scoring/
Engine + 4 signals + weights"] TM["trademark/
USPTO + EUIPO gate"] PORT["portfolio/
Manager + reports + drop logic"] SV["services/
auto-listing, etc."] end subgraph Jobs[Async Job System] JW["jobs/worker.ts
Poll + dispatch"] JH["jobs/handlers/
12 handlers"] end subgraph API[REST API] API["api/index.ts
Express Router"] ROUTES["api/routes/
34 route modules"] PUB["api/public-router.ts
Public scoring pages
SSR + OG tags"] VIEWS["api/views/
SSR HTML templates"] end subgraph DB[Database Layer] DBI["db/provider/
DatabaseProvider interface"] SQLITE["db/provider/sqlite-adapter.ts"] PG["db/provider/postgres-adapter.ts"] REPO["db/repositories/
35 repositories"] MIG["db/migrations/
versioned DDL"] end subgraph Providers[External Providers] PROV["providers/
dns, rdap, whois
keyword, comps, trademark
registrar, listing"] end subgraph Types[Shared Types] TYPES["types/"] end subgraph Utils[Utilities] UTIL["utils/"] LOG["logger.ts"] CFG["config.ts"] end INDEX --> CR INDEX --> API CLI --> CR CR --> PIP CR --> SC CR --> TM CR --> PORT CR --> SV CR --> JW CR --> PROV CR --> DBI CR --> MW CR --> CFG API --> ROUTES API --> PUB API --> MW ROUTES --> CR PUB --> VIEWS PUB --> SC JW --> JH JH --> PIP JH --> SC JH --> PORT JH --> DBI JH --> PROV PIP --> TM PIP --> SC PIP --> PROV PIP --> DBI SC --> PROV SC --> UTIL PORT --> DBI SV --> DBI SV --> PROV ROUTES --> TYPES PIP --> TYPES SC --> TYPES PROV --> TYPES DBI --> TYPES MW --> TYPES DBI --> SQLITE DBI --> PG REPO --> DBI MIG --> SQLITE MIG --> PG style Entry fill:#1a1a2e,stroke:#16213e,color:#eee style App fill:#16213e,stroke:#0f3460,color:#eee style Core fill:#0f3460,stroke:#533483,color:#eee style Jobs fill:#16213e,stroke:#533483,color:#eee style API fill:#0f3460,stroke:#16213e,color:#eee style DB fill:#2d1b69,stroke:#533483,color:#eee style Providers fill:#1a1a2e,stroke:#16213e,color:#ddd style Types fill:#2d1b69,stroke:#533483,color:#eee style Utils fill:#1a1a2e,stroke:#16213e,color:#ddd ``` ## Layer Rules | Layer | Can Depend On | Cannot Depend On | |-------|---------------|------------------| | Core logic (`pipeline/`, `scoring/`, `trademark/`, `portfolio/`) | `types/`, `utils/`, `providers/` (via interfaces) | `api/`, `cli/`, `jobs/` | | Providers (`providers/`) | `types/`, `utils/` | Core logic, `api/`, `cli/` | | API (`api/`) | Core logic, `providers/`, `types/` | `cli/` | | Jobs (`jobs/`) | Core logic, `providers/`, `types/` | `api/`, `cli/` | | CLI (`cli/`) | Core logic, `types/` | `api/` | | Database (`db/`) | `types/` | Core logic, `api/`, `cli/`, `providers/` |