# ankitanahire/aml-investigation-platform architecture

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

- Interactive diagram: https://gitdiagram.com/ankitanahire/aml-investigation-platform
- Repository: https://github.com/ankitanahire/aml-investigation-platform

## Overview

The AML Investigation Platform combines a React investigation interface with a FastAPI banking and monitoring backend. The principal workflow is an authenticated user entering the protected dashboard, whose domain operations cover accounts and transactions; transaction processing also invokes AML monitoring, which creates and exposes alerts for review. Backend routers, services, repositories, and SQLAlchemy models provide the documented layered structure. The README documents authentication, banking, AML, and health capabilities; some route and page implementations were not sampled, so links involving them are omitted unless registration or references are shown.

Main entry points: [`backend/app/main.py`](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/App.jsx`](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/App.jsx) (Page routing), [`frontend/src/services/authService.js`](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/services/authService.js) (API services), [`frontend/src/pages/Login.jsx`](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/pages/Login.jsx) (Login page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Investigation interface"]
  node_webapp["Web entry<br/>[main.jsx]"]
  node_routes["Page routing<br/>[App.jsx]"]
  node_login["Login page<br/>[Login.jsx]"]
  node_authctx["Session context<br/>[AuthContext.jsx]"]
  node_dashboard["Dashboard page<br/>[Dashboard.jsx]"]
  node_investigation_pages["Investigation pages<br/>[Alerts.jsx]"]
  node_frontend_services["API services<br/>[authService.js]"]
  node_http_client["HTTP client<br/>[axios.js]"]
end

subgraph group_api["API routing"]
  node_api_server["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_account_routes["Account routes<br/>[accounts.py]"]
  node_transaction_routes["Transaction routes<br/>[transaction.py]"]
  node_aml_routes["Alert routes<br/>[aml.py]"]
  node_health_routes["Health routes<br/>[health.py]"]
  node_dashboard_routes["Dashboard routes<br/>[dashboard.py]"]
end

subgraph group_domain["Banking and AML"]
  node_account_service["Account operations<br/>[account_service.py]"]
  node_transaction_service["Transaction processing"]
  node_aml_service["AML detection<br/>[aml_service.py]"]
  node_health_service["Health checks<br/>[health_service.py]"]
end

subgraph group_persistence["Persistence and identity"]
  node_account_repo["Account repository"]
  node_transaction_repo["Transaction repository"]
  node_aml_repo["Alert repository<br/>[aml_repository.py]"]
  node_bank_models["Banking records<br/>[accounts.py]"]
  node_aml_model["Alert record<br/>[aml_alert.py]"]
  node_identity["JWT and passwords<br/>[auth.py]"]
  node_users["User record<br/>[user.py]"]
  node_database[("SQL database<br/>[database.py]")]
end

subgraph group_platform["Runtime support"]
  node_middleware["Request middleware"]
  node_exceptions["Exception handling<br/>[handlers.py]"]
  node_logging["Application logging<br/>[logger.py]"]
end

node_operator(("Investigator"))

node_operator -->|"opens"| node_webapp
node_webapp -->|"renders"| node_routes
node_routes -->|"routes to"| node_login
node_routes -->|"routes to"| node_dashboard
node_routes -->|"routes to"| node_investigation_pages
node_login -->|"uses session"| node_authctx
node_authctx -->|"loads profile"| node_frontend_services
node_login -->|"calls login"| node_frontend_services
node_dashboard -->|"loads stats"| node_frontend_services
node_frontend_services -->|"sends requests"| node_http_client
node_api_server -->|"registers"| node_auth_routes
node_api_server -->|"registers"| node_account_routes
node_api_server -->|"registers"| node_transaction_routes
node_api_server -->|"registers"| node_aml_routes
node_api_server -->|"registers"| node_health_routes
node_api_server -->|"registers"| node_dashboard_routes
node_account_routes -->|"delegates"| node_account_service
node_auth_routes -->|"uses"| node_identity
node_aml_routes -->|"queries"| node_aml_repo
node_account_service -->|"reads and writes"| node_account_repo
node_account_service -->|"records activity"| node_transaction_repo
node_transaction_service -->|"processes records"| node_transaction_repo
node_transaction_service -->|"checks activity"| node_aml_service
node_aml_service -->|"stores alerts"| node_aml_repo
node_account_repo -->|"queries"| node_bank_models
node_transaction_repo -->|"queries"| node_bank_models
node_aml_repo -->|"queries"| node_aml_model
node_identity -->|"looks up user"| node_users
node_identity -->|"gets session"| node_database
node_api_server -->|"initializes tables"| node_database
node_api_server -->|"installs"| node_middleware
node_api_server -->|"registers handlers"| node_exceptions
node_api_server -->|"logs startup"| node_logging

click node_webapp "https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/main.jsx"
click node_routes "https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/pages/Login.jsx"
click node_authctx "https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/context/AuthContext.jsx"
click node_dashboard "https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/pages/Dashboard.jsx"
click node_investigation_pages "https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/pages/Alerts.jsx"
click node_frontend_services "https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/services/authService.js"
click node_http_client "https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/api/axios.js"
click node_api_server "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/auth.py"
click node_account_routes "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/accounts.py"
click node_transaction_routes "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/transaction.py"
click node_aml_routes "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/aml.py"
click node_health_routes "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/health.py"
click node_dashboard_routes "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/dashboard.py"
click node_account_service "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/services/account_service.py"
click node_transaction_service "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/services/transaction_service.py"
click node_aml_service "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/services/aml_service.py"
click node_health_service "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/services/health_service.py"
click node_account_repo "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/repositories/account_repository.py"
click node_transaction_repo "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/repositories/transaction_repository.py"
click node_aml_repo "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/repositories/aml_repository.py"
click node_bank_models "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/models/accounts.py"
click node_aml_model "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/models/aml_alert.py"
click node_identity "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/auth/auth.py"
click node_users "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/models/user.py"
click node_database "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/database.py"
click node_middleware "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/middleware/logging_middleware.py"
click node_exceptions "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/exceptions/handlers.py"
click node_logging "https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/logging_config/logger.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_webapp,node_routes,node_login,node_authctx,node_dashboard,node_investigation_pages,node_frontend_services,node_http_client toneBlue
class node_api_server,node_auth_routes,node_account_routes,node_transaction_routes,node_aml_routes,node_health_routes,node_dashboard_routes toneAmber
class node_account_service,node_transaction_service,node_aml_service,node_health_service toneMint
class node_account_repo,node_transaction_repo,node_aml_repo,node_bank_models,node_aml_model,node_identity,node_users,node_database toneRose
class node_middleware,node_exceptions,node_logging,node_operator toneIndigo
```

## Components

### Investigation interface

- [Web entry](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Page routing](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login page](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Session context](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Dashboard page](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Investigation pages](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/pages/Alerts.jsx): `frontend/src/pages/Alerts.jsx`
- [API services](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/services/authService.js): `frontend/src/services/authService.js`
- [HTTP client](https://github.com/ankitanahire/aml-investigation-platform/blob/main/frontend/src/api/axios.js): `frontend/src/api/axios.js`

### API routing

- [FastAPI application](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Account routes](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/accounts.py): `backend/app/routers/accounts.py`
- [Transaction routes](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/transaction.py): `backend/app/routers/transaction.py`
- [Alert routes](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/aml.py): `backend/app/routers/aml.py`
- [Health routes](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/health.py): `backend/app/routers/health.py`
- [Dashboard routes](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/routers/dashboard.py): `backend/app/routers/dashboard.py`

### Banking and AML

- [Account operations](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/services/account_service.py): `backend/app/services/account_service.py`
- [Transaction processing](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/services/transaction_service.py): `backend/app/services/transaction_service.py`
- [AML detection](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/services/aml_service.py): `backend/app/services/aml_service.py`
- [Health checks](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/services/health_service.py): `backend/app/services/health_service.py`

### Persistence and identity

- [Account repository](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/repositories/account_repository.py): `backend/app/repositories/account_repository.py`
- [Transaction repository](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/repositories/transaction_repository.py): `backend/app/repositories/transaction_repository.py`
- [Alert repository](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/repositories/aml_repository.py): `backend/app/repositories/aml_repository.py`
- [Banking records](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/models/accounts.py): `backend/app/models/accounts.py`
- [Alert record](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/models/aml_alert.py): `backend/app/models/aml_alert.py`
- [JWT and passwords](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/auth/auth.py): `backend/app/auth/auth.py`
- [User record](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [SQL database](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/database.py): `backend/app/database.py`

### Runtime support

- [Request middleware](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/middleware/logging_middleware.py): `backend/app/middleware/logging_middleware.py`
- [Exception handling](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/exceptions/handlers.py): `backend/app/exceptions/handlers.py`
- [Application logging](https://github.com/ankitanahire/aml-investigation-platform/blob/main/backend/app/logging_config/logger.py): `backend/app/logging_config/logger.py`

### Other components

- **Investigator**

## Connections

- Investigator → Web entry: opens
- Web entry → Page routing: renders (evidence: `frontend/src/main.jsx`)
- Page routing → Login page: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → Dashboard page: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → Investigation pages: routes to (evidence: `frontend/src/App.jsx`)
- Login page → Session context: uses session (evidence: `frontend/src/pages/Login.jsx`)
- Session context → API services: loads profile (evidence: `frontend/src/context/AuthContext.jsx`)
- Login page → API services: calls login (evidence: `frontend/src/pages/Login.jsx`)
- Dashboard page → API services: loads stats (evidence: `frontend/src/pages/Dashboard.jsx`)
- API services → HTTP client: sends requests (evidence: `frontend/src/services/authService.js`)
- FastAPI application → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Account routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Transaction routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Alert routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Health routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Dashboard routes: registers (evidence: `backend/app/main.py`)
- Account routes → Account operations: delegates (evidence: `backend/app/routers/accounts.py`)
- Authentication routes → JWT and passwords: uses (evidence: `backend/app/routers/auth.py`)
- Alert routes → Alert repository: queries (evidence: `backend/app/routers/aml.py`)
- Account operations → Account repository: reads and writes (evidence: `backend/app/services/account_service.py`)
- Account operations → Transaction repository: records activity (evidence: `backend/app/services/account_service.py`)
- Transaction processing → Transaction repository: processes records (evidence: `backend/app/services/transaction_service.py`)
- Transaction processing → AML detection: checks activity (evidence: `backend/app/services/transaction_service.py`)
- AML detection → Alert repository: stores alerts (evidence: `backend/app/services/aml_service.py`)
- Account repository → Banking records: queries (evidence: `backend/app/repositories/account_repository.py`)
- Transaction repository → Banking records: queries (evidence: `backend/app/repositories/transaction_repository.py`)
- Alert repository → Alert record: queries (evidence: `backend/app/repositories/aml_repository.py`)
- JWT and passwords → User record: looks up user (evidence: `backend/app/auth/auth.py`)
- JWT and passwords → SQL database: gets session (evidence: `backend/app/auth/auth.py`)
- FastAPI application → SQL database: initializes tables (evidence: `backend/app/main.py`)
- FastAPI application → Request middleware: installs (evidence: `backend/app/main.py`)
- FastAPI application → Exception handling: registers handlers (evidence: `backend/app/main.py`)
- FastAPI application → Application logging: logs startup (evidence: `backend/app/main.py`)
