# kwang-min-n/fincomply_demo architecture

> Architecture diagram of the GitHub repository kwang-min-n/fincomply_demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kwang-min-n/fincomply_demo
- Repository: https://github.com/kwang-min-n/fincomply_demo

## Overview

FinComply is an on-premises financial-compliance platform: staff submit marketing or terms content for hybrid review, ask citation-grounded regulatory questions, search legal material, analyze regulatory gaps, and manage approvals. The operating React SPA calls the FastAPI backend; services orchestrate domain workflows over replaceable adapters. The graph also retains documented parsing, tracking, and approval capabilities. Some routes and pages are represented by their existing directories because their implementation excerpts were not sampled; those relationships are cited only where documented or shown.

Main entry points: [`src/fincomply/factory.py`](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/factory.py) (Dependency assembly), [`frontend/src/App.tsx`](https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/App.tsx) (React SPA), [`src/fincomply/api/v1`](https://github.com/kwang-min-n/fincomply_demo/tree/main/src/fincomply/api/v1) (Feature routes), [`src/fincomply/services/search_service.py`](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/search_service.py) (Hybrid search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Staff experience"]
  node_spa["React SPA<br/>[App.tsx]"]
  node_reviewui["Review page<br/>[ReviewPage.tsx]"]
  node_searchui["Search page<br/>[SearchPage.tsx]"]
  node_otherpages["Other feature pages"]
  node_client["API client<br/>[client.ts]"]
end

subgraph group_api["API and identity"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_apiapp["FastAPI application<br/>[app.py]"]
  node_routes["Feature routes"]
  node_composition["Dependency assembly<br/>[factory.py]"]
end

subgraph group_workflows["Compliance workflows"]
  node_review["Hybrid review<br/>[review_service.py]"]
  node_rules["Deterministic rules<br/>[json_engine.py]"]
  node_approval["Approval workflow"]
  node_tracker["Regulatory tracker<br/>[tracker_service.py]"]
  node_parsing["Document parsing<br/>[parse.py]"]
end

subgraph group_knowledge["Regulatory knowledge"]
  node_ingest["Document ingestion"]
  node_search["Hybrid search<br/>[search_service.py]"]
  node_rag["Grounded Q&amp;A<br/>[rag_service.py]"]
  node_llm["LLM adapter<br/>[router.py]"]
end

subgraph group_infrastructure["Domain and adapters"]
  node_stores[("Search and vector stores<br/>[base.py]")]
  node_graphstore[("Citation graph<br/>[base.py]")]
  node_lexical[("Lexical index")]
  node_domain["Compliance domain<br/>[models.py]"]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_spa
node_spa -->|"reads identity"| node_auth
node_spa -->|"creates"| node_client
node_spa -->|"routes to"| node_reviewui
node_spa -->|"routes to"| node_searchui
node_spa -->|"routes to"| node_otherpages
node_reviewui -->|"calls"| node_client
node_searchui -->|"calls"| node_client
node_client -->|"HTTP requests"| node_routes
node_apiapp -->|"registers"| node_routes
node_routes -->|"resolves services"| node_composition
node_composition -->|"assembles"| node_review
node_composition -->|"assembles"| node_approval
node_composition -->|"assembles"| node_tracker
node_composition -->|"assembles"| node_ingest
node_composition -->|"assembles"| node_search
node_composition -->|"assembles"| node_rag
node_review -->|"scans first"| node_rules
node_review -->|"requests analysis"| node_llm
node_ingest -->|"indexes chunks"| node_stores
node_ingest -->|"indexes links"| node_graphstore
node_ingest -->|"indexes files"| node_lexical
node_search -->|"retrieves vectors"| node_stores
node_search -->|"expands citations"| node_graphstore
node_search -.->|"retrieves lexical hits"| node_lexical
node_rag -->|"gets evidence"| node_search
node_rag -.->|"generates grounded answer"| node_llm
node_review -.->|"returns findings"| node_domain
node_search -.->|"returns results"| node_domain
node_rag -.->|"returns citations"| node_domain
node_routes -->|"offers parsing"| node_parsing
node_routes -->|"offers tracking"| node_tracker
node_routes -->|"offers decisions"| node_approval

click node_spa "https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/App.tsx"
click node_reviewui "https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/pages/ReviewPage.tsx"
click node_searchui "https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/pages/SearchPage.tsx"
click node_otherpages "https://github.com/kwang-min-n/fincomply_demo/tree/main/frontend/src/pages"
click node_client "https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/api/client.ts"
click node_auth "https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/auth/AuthContext.tsx"
click node_apiapp "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/api/app.py"
click node_routes "https://github.com/kwang-min-n/fincomply_demo/tree/main/src/fincomply/api/v1"
click node_composition "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/factory.py"
click node_review "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/review_service.py"
click node_rules "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/rules/json_engine.py"
click node_approval "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/approval_service.py"
click node_tracker "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/tracker_service.py"
click node_parsing "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/api/v1/parse.py"
click node_ingest "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/ingestion_service.py"
click node_search "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/search_service.py"
click node_rag "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/rag_service.py"
click node_llm "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/llm/router.py"
click node_stores "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/vectorstore/base.py"
click node_graphstore "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/graph/base.py"
click node_lexical "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/searchindex/opensearch_store.py"
click node_domain "https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/domain/models.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_spa,node_reviewui,node_searchui,node_otherpages,node_client,node_staff toneBlue
class node_auth,node_apiapp,node_routes,node_composition toneAmber
class node_review,node_rules,node_approval,node_tracker,node_parsing toneMint
class node_ingest,node_search,node_rag,node_llm toneRose
class node_stores,node_graphstore,node_lexical,node_domain toneIndigo
```

## Components

### Staff experience

- [React SPA](https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Review page](https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/pages/ReviewPage.tsx): `frontend/src/pages/ReviewPage.tsx`
- [Search page](https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/pages/SearchPage.tsx): `frontend/src/pages/SearchPage.tsx`
- [Other feature pages](https://github.com/kwang-min-n/fincomply_demo/tree/main/frontend/src/pages): `frontend/src/pages`
- [API client](https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### API and identity

- [Authentication](https://github.com/kwang-min-n/fincomply_demo/blob/main/frontend/src/auth/AuthContext.tsx): `frontend/src/auth/AuthContext.tsx`
- [FastAPI application](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/api/app.py): `src/fincomply/api/app.py`
- [Feature routes](https://github.com/kwang-min-n/fincomply_demo/tree/main/src/fincomply/api/v1): `src/fincomply/api/v1`
- [Dependency assembly](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/factory.py): `src/fincomply/factory.py`

### Compliance workflows

- [Hybrid review](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/review_service.py): `src/fincomply/services/review_service.py`
- [Deterministic rules](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/rules/json_engine.py): `src/fincomply/adapters/rules/json_engine.py`
- [Approval workflow](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/approval_service.py): `src/fincomply/services/approval_service.py`
- [Regulatory tracker](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/tracker_service.py): `src/fincomply/services/tracker_service.py`
- [Document parsing](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/api/v1/parse.py): `src/fincomply/api/v1/parse.py`

### Regulatory knowledge

- [Document ingestion](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/ingestion_service.py): `src/fincomply/services/ingestion_service.py`
- [Hybrid search](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/search_service.py): `src/fincomply/services/search_service.py`
- [Grounded Q&A](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/services/rag_service.py): `src/fincomply/services/rag_service.py`
- [LLM adapter](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/llm/router.py): `src/fincomply/adapters/llm/router.py`

### Domain and adapters

- [Search and vector stores](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/vectorstore/base.py): `src/fincomply/adapters/vectorstore/base.py`
- [Citation graph](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/graph/base.py): `src/fincomply/adapters/graph/base.py`
- [Lexical index](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/adapters/searchindex/opensearch_store.py): `src/fincomply/adapters/searchindex/opensearch_store.py`
- [Compliance domain](https://github.com/kwang-min-n/fincomply_demo/blob/main/src/fincomply/domain/models.py): `src/fincomply/domain/models.py`

### Other components

- **Staff user**

## Connections

- Staff user → React SPA: uses (evidence: `README.md`)
- React SPA → Authentication: reads identity (evidence: `frontend/src/App.tsx`)
- React SPA → API client: creates (evidence: `frontend/src/App.tsx`)
- React SPA → Review page: routes to (evidence: `frontend/src/App.tsx`)
- React SPA → Search page: routes to (evidence: `frontend/src/App.tsx`)
- React SPA → Other feature pages: routes to (evidence: `frontend/src/App.tsx`)
- Review page → API client: calls (evidence: `frontend/src/pages/ReviewPage.tsx`)
- Search page → API client: calls (evidence: `frontend/src/pages/SearchPage.tsx`)
- API client → Feature routes: HTTP requests (evidence: `frontend/src/api/client.ts`)
- FastAPI application → Feature routes: registers (evidence: `src/fincomply/api/app.py`)
- Feature routes → Dependency assembly: resolves services
- Dependency assembly → Hybrid review: assembles (evidence: `src/fincomply/factory.py`)
- Dependency assembly → Approval workflow: assembles (evidence: `src/fincomply/factory.py`)
- Dependency assembly → Regulatory tracker: assembles (evidence: `src/fincomply/factory.py`)
- Dependency assembly → Document ingestion: assembles (evidence: `src/fincomply/factory.py`)
- Dependency assembly → Hybrid search: assembles (evidence: `src/fincomply/factory.py`)
- Dependency assembly → Grounded Q&A: assembles (evidence: `src/fincomply/factory.py`)
- Hybrid review → Deterministic rules: scans first (evidence: `src/fincomply/services/review_service.py`)
- Hybrid review → LLM adapter: requests analysis (evidence: `src/fincomply/services/review_service.py`)
- Document ingestion → Search and vector stores: indexes chunks (evidence: `src/fincomply/services/ingestion_service.py`)
- Document ingestion → Citation graph: indexes links (evidence: `src/fincomply/services/ingestion_service.py`)
- Document ingestion → Lexical index: indexes files (evidence: `src/fincomply/services/ingestion_service.py`)
- Hybrid search → Search and vector stores: retrieves vectors (evidence: `src/fincomply/services/search_service.py`)
- Hybrid search → Citation graph: expands citations (evidence: `src/fincomply/services/search_service.py`)
- Hybrid search → Lexical index: retrieves lexical hits
- Grounded Q&A → Hybrid search: gets evidence (evidence: `src/fincomply/services/rag_service.py`)
- Grounded Q&A → LLM adapter: generates grounded answer
- Hybrid review → Compliance domain: returns findings
- Hybrid search → Compliance domain: returns results (evidence: `src/fincomply/services/search_service.py`)
- Grounded Q&A → Compliance domain: returns citations (evidence: `src/fincomply/services/rag_service.py`)
- Feature routes → Document parsing: offers parsing (evidence: `README.md`)
- Feature routes → Regulatory tracker: offers tracking (evidence: `README.md`)
- Feature routes → Approval workflow: offers decisions (evidence: `README.md`)
