# susyanth-10/sentinel architecture

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

- Interactive diagram: https://gitdiagram.com/susyanth-10/sentinel
- Repository: https://github.com/susyanth-10/sentinel

## Overview

SENTINEL is a payment app with fraud and coercion safeguards. Its principal backend workflow accepts a transaction, evaluates risk, then either blocks or requests confirmation, executes a Ghost Mode transfer in an isolated in-memory ledger, or updates the normal account ledger. The sampled frontend provides transfer state and controls; the repository also contains Flutter native launchers, but no Dart application source is present in the tree. Backend route-to-service edges are based on the sampled route excerpt and SOURCE INDEX references; frontend-to-backend wiring is not shown, so no such connection is asserted.

Main entry points: [`backend/main.py`](https://github.com/susyanth-10/sentinel/blob/main/backend/main.py) (API and transaction routes), [`backend/app/database.py`](https://github.com/susyanth-10/sentinel/blob/main/backend/app/database.py) (SQLite access), [`frontend/TransferScreen.jsx`](https://github.com/susyanth-10/sentinel/blob/main/frontend/TransferScreen.jsx) (Transfer screen), [`MOBILE_APP/linux/runner/my_application.cc`](https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/linux/runner/my_application.cc) (Linux Flutter host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client app"]
  node_transfer_ui["Transfer screen<br/>[TransferScreen.jsx]"]
  node_bank_state["Bank transfer state<br/>[BankContext.jsx]"]
  node_linux_boot["Linux launcher<br/>[main.cc]"]
  node_linux_app["Linux Flutter host<br/>[my_application.cc]"]
  node_linux_plugins["Linux plugin registry"]
  node_windows_boot["Windows launcher<br/>[main.cpp]"]
  node_windows_flutter["Windows Flutter host<br/>[flutter_window.cpp]"]
  node_windows_window["Windows windowing<br/>[win32_window.cpp]"]
end

subgraph group_api["API and contracts"]
  node_api_routes["API and transaction routes<br/>[main.py]"]
  node_auth_logic["Authentication helpers<br/>[auth.py]"]
  node_auth_contract["Auth schemas<br/>[auth.py]"]
  node_transaction_contract["Transaction schema<br/>[transaction.py]"]
  node_risk_contract["Risk schema<br/>[risk.py]"]
end

subgraph group_risk["Risk and safeguards"]
  node_risk_engine["Risk assessment<br/>[inference.py]"]
  node_ghost_ledger[("Ghost session ledger")]
end

subgraph group_ledger["Accounts and ledgers"]
  node_customer_model["Customer model<br/>[customer.py]"]
  node_transaction_model["Transaction model<br/>[transaction.py]"]
  node_sqlite[("SQLite access<br/>[database.py]")]
end

node_user(("Payment user"))

node_user -.->|"initiates transfer"| node_transfer_ui
node_transfer_ui -->|"uses state"| node_bank_state
node_linux_boot -->|"starts"| node_linux_app
node_linux_app -->|"registers plugins"| node_linux_plugins
node_windows_boot -->|"creates host"| node_windows_flutter
node_windows_flutter -->|"extends window"| node_windows_window
node_api_routes -->|"uses auth"| node_auth_logic
node_api_routes -->|"validates auth"| node_auth_contract
node_api_routes -->|"validates transfers"| node_transaction_contract
node_api_routes -->|"validates risk input"| node_risk_contract
node_api_routes -->|"assesses risk"| node_risk_engine
node_api_routes -->|"executes shadow transfer"| node_ghost_ledger
node_api_routes -->|"queries and commits"| node_sqlite
node_api_routes -->|"queries customers"| node_customer_model
node_api_routes -->|"queries transactions"| node_transaction_model
node_customer_model -->|"maps to database"| node_sqlite
node_transaction_model -->|"maps to database"| node_sqlite

click node_transfer_ui "https://github.com/susyanth-10/sentinel/blob/main/frontend/TransferScreen.jsx"
click node_bank_state "https://github.com/susyanth-10/sentinel/blob/main/frontend/BankContext.jsx"
click node_linux_boot "https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/linux/runner/main.cc"
click node_linux_app "https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/linux/runner/my_application.cc"
click node_linux_plugins "https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/linux/flutter/generated_plugin_registrant.h"
click node_windows_boot "https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/windows/runner/main.cpp"
click node_windows_flutter "https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/windows/runner/flutter_window.cpp"
click node_windows_window "https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/windows/runner/win32_window.cpp"
click node_api_routes "https://github.com/susyanth-10/sentinel/blob/main/backend/main.py"
click node_auth_logic "https://github.com/susyanth-10/sentinel/blob/main/backend/app/auth.py"
click node_auth_contract "https://github.com/susyanth-10/sentinel/blob/main/backend/app/schemas/auth.py"
click node_transaction_contract "https://github.com/susyanth-10/sentinel/blob/main/backend/app/schemas/transaction.py"
click node_risk_contract "https://github.com/susyanth-10/sentinel/blob/main/backend/app/schemas/risk.py"
click node_risk_engine "https://github.com/susyanth-10/sentinel/blob/main/backend/app/ml/inference.py"
click node_ghost_ledger "https://github.com/susyanth-10/sentinel/blob/main/backend/app/services/ghost_session_service.py"
click node_customer_model "https://github.com/susyanth-10/sentinel/blob/main/backend/app/models/customer.py"
click node_transaction_model "https://github.com/susyanth-10/sentinel/blob/main/backend/app/models/transaction.py"
click node_sqlite "https://github.com/susyanth-10/sentinel/blob/main/backend/app/database.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_transfer_ui,node_bank_state,node_linux_boot,node_linux_app,node_linux_plugins,node_windows_boot,node_windows_flutter,node_windows_window,node_user toneBlue
class node_api_routes,node_auth_logic,node_auth_contract,node_transaction_contract,node_risk_contract toneAmber
class node_risk_engine,node_ghost_ledger toneMint
class node_customer_model,node_transaction_model,node_sqlite toneRose
```

## Components

### Client app

- [Transfer screen](https://github.com/susyanth-10/sentinel/blob/main/frontend/TransferScreen.jsx): `frontend/TransferScreen.jsx`
- [Bank transfer state](https://github.com/susyanth-10/sentinel/blob/main/frontend/BankContext.jsx): `frontend/BankContext.jsx`
- [Linux launcher](https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/linux/runner/main.cc): `MOBILE_APP/linux/runner/main.cc`
- [Linux Flutter host](https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/linux/runner/my_application.cc): `MOBILE_APP/linux/runner/my_application.cc`
- [Linux plugin registry](https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/linux/flutter/generated_plugin_registrant.h): `MOBILE_APP/linux/flutter/generated_plugin_registrant.h`
- [Windows launcher](https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/windows/runner/main.cpp): `MOBILE_APP/windows/runner/main.cpp`
- [Windows Flutter host](https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/windows/runner/flutter_window.cpp): `MOBILE_APP/windows/runner/flutter_window.cpp`
- [Windows windowing](https://github.com/susyanth-10/sentinel/blob/main/MOBILE_APP/windows/runner/win32_window.cpp): `MOBILE_APP/windows/runner/win32_window.cpp`

### API and contracts

- [API and transaction routes](https://github.com/susyanth-10/sentinel/blob/main/backend/main.py): `backend/main.py`
- [Authentication helpers](https://github.com/susyanth-10/sentinel/blob/main/backend/app/auth.py): `backend/app/auth.py`
- [Auth schemas](https://github.com/susyanth-10/sentinel/blob/main/backend/app/schemas/auth.py): `backend/app/schemas/auth.py`
- [Transaction schema](https://github.com/susyanth-10/sentinel/blob/main/backend/app/schemas/transaction.py): `backend/app/schemas/transaction.py`
- [Risk schema](https://github.com/susyanth-10/sentinel/blob/main/backend/app/schemas/risk.py): `backend/app/schemas/risk.py`

### Risk and safeguards

- [Risk assessment](https://github.com/susyanth-10/sentinel/blob/main/backend/app/ml/inference.py): `backend/app/ml/inference.py`
- [Ghost session ledger](https://github.com/susyanth-10/sentinel/blob/main/backend/app/services/ghost_session_service.py): `backend/app/services/ghost_session_service.py`

### Accounts and ledgers

- [Customer model](https://github.com/susyanth-10/sentinel/blob/main/backend/app/models/customer.py): `backend/app/models/customer.py`
- [Transaction model](https://github.com/susyanth-10/sentinel/blob/main/backend/app/models/transaction.py): `backend/app/models/transaction.py`
- [SQLite access](https://github.com/susyanth-10/sentinel/blob/main/backend/app/database.py): `backend/app/database.py`

### Other components

- **Payment user**

## Connections

- Payment user → Transfer screen: initiates transfer
- Transfer screen → Bank transfer state: uses state (evidence: `frontend/TransferScreen.jsx`)
- Linux launcher → Linux Flutter host: starts (evidence: `MOBILE_APP/linux/runner/main.cc`)
- Linux Flutter host → Linux plugin registry: registers plugins (evidence: `MOBILE_APP/linux/runner/my_application.cc`)
- Windows launcher → Windows Flutter host: creates host (evidence: `MOBILE_APP/windows/runner/main.cpp`)
- Windows Flutter host → Windows windowing: extends window (evidence: `MOBILE_APP/windows/runner/flutter_window.cpp`)
- API and transaction routes → Authentication helpers: uses auth (evidence: `backend/main.py`)
- API and transaction routes → Auth schemas: validates auth (evidence: `backend/main.py`)
- API and transaction routes → Transaction schema: validates transfers (evidence: `backend/main.py`)
- API and transaction routes → Risk schema: validates risk input (evidence: `backend/main.py`)
- API and transaction routes → Risk assessment: assesses risk (evidence: `backend/main.py`)
- API and transaction routes → Ghost session ledger: executes shadow transfer (evidence: `backend/main.py`)
- API and transaction routes → SQLite access: queries and commits (evidence: `backend/main.py`)
- API and transaction routes → Customer model: queries customers (evidence: `backend/main.py`)
- API and transaction routes → Transaction model: queries transactions (evidence: `backend/main.py`)
- Customer model → SQLite access: maps to database (evidence: `backend/app/models/customer.py`)
- Transaction model → SQLite access: maps to database (evidence: `backend/app/models/transaction.py`)
