# almamun4901/the-whisper architecture

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

- Interactive diagram: https://gitdiagram.com/almamun4901/the-whisper
- Repository: https://github.com/almamun4901/the-whisper

## Overview

WhisperChain+ is an anonymous messaging platform: users register and authenticate, senders choose approved receivers and send encrypted messages using round-based pseudonymous tokens, and receivers read or flag messages. Moderators manage flagged content, tokens, warnings, and bans; administrators approve accounts and inspect audit logs. The graph preserves the documented encryption, RBAC, token, and audit capabilities. Backend route wiring and several frontend interactions are only partially sampled, so uncertain links are omitted; dashed links mark documented but unsampled subsystem relationships.

Main entry points: [`frontend/src/App.tsx`](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/App.tsx) (Route shell), [`database/database.py`](https://github.com/almamun4901/the-whisper/blob/main/database/database.py) (Application database), [`backend/routes/message_routes.py`](https://github.com/almamun4901/the-whisper/blob/main/backend/routes/message_routes.py) (Message routes), [`auth/jwt_auth.py`](https://github.com/almamun4901/the-whisper/blob/main/auth/jwt_auth.py) (JWT authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_app["Route shell<br/>[App.tsx]"]
  node_registration["Registration<br/>[Register.tsx]"]
  node_sender_ui["Send message<br/>[SendMessage.tsx]"]
  node_inbox_ui["Inbox<br/>[Inbox.tsx]"]
  node_dashboard_ui["User dashboard<br/>[Dashboard.tsx]"]
  node_moderator_ui["Moderator console"]
  node_admin_ui["Admin dashboard<br/>[AdminDashboard.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Auth routes<br/>[auth_routes.py]"]
  node_registration_api["Registration and approval<br/>[main.py]"]
  node_jwt["JWT authentication<br/>[jwt_auth.py]"]
  node_rbac["Role access control<br/>[rbac.py]"]
  node_user_api["User and receiver API<br/>[user_routes.py]"]
end

subgraph group_messaging["Anonymous messaging"]
  node_key_management["Key management<br/>[key_management.py]"]
  node_key_decryption["Key decryption UI<br/>[KeyDecryption.tsx]"]
  node_message_api["Message routes<br/>[message_routes.py]"]
  node_message_crypto["Message encryption<br/>[message_crypto.py]"]
  node_tokens["Anonymous tokens<br/>[token_manager.py]"]
  node_e2e["End-to-end encryption<br/>[e2e_encryption.py]"]
end

subgraph group_oversight["Moderation and audit"]
  node_moderation["Moderation routes"]
  node_moderation_logic["Moderation logic<br/>[moderation.py]"]
  node_admin_audit["Admin and audit API<br/>[main.py]"]
end

subgraph group_storage["Persistence"]
  node_store[("Application database<br/>[database.py]")]
  node_models["Domain records<br/>[models.py]"]
end

node_person(("Platform user"))

node_person -->|"uses"| node_app
node_app -->|"routes to"| node_registration
node_app -->|"routes to"| node_sender_ui
node_app -->|"routes to"| node_inbox_ui
node_app -->|"routes to"| node_dashboard_ui
node_app -->|"routes to"| node_moderator_ui
node_app -->|"routes to"| node_admin_ui
node_app -.->|"routes to"| node_key_decryption
node_person -->|"registers"| node_registration_api
node_person -.->|"authenticates"| node_auth_routes
node_registration_api -->|"reads/writes"| node_store
node_registration_api -->|"generates keys"| node_key_management
node_registration_api -->|"creates records"| node_models
node_auth_routes -.->|"uses"| node_jwt
node_user_api -->|"authenticates"| node_jwt
node_user_api -->|"queries"| node_store
node_user_api -->|"queries"| node_models
node_jwt -->|"loads users"| node_store
node_jwt -->|"queries users"| node_models
node_rbac -.->|"uses"| node_jwt
node_person -->|"composes"| node_sender_ui
node_sender_ui -.->|"sends request"| node_message_api
node_message_api -->|"authenticates"| node_jwt
node_message_api -->|"validates tokens"| node_tokens
node_message_api -->|"encrypts messages"| node_message_crypto
node_message_api -->|"reads/writes"| node_store
node_message_api -->|"queries messages"| node_models
node_person -->|"reads messages"| node_inbox_ui
node_inbox_ui -.->|"fetches inbox"| node_message_api
node_key_decryption -.->|"decrypts keys"| node_key_management
node_person -->|"moderates"| node_moderator_ui
node_moderator_ui -.->|"requests actions"| node_moderation
node_moderation -->|"verifies moderator"| node_jwt
node_moderation -->|"freezes tokens"| node_tokens
node_moderation -->|"reads/writes"| node_store
node_moderation -->|"queries records"| node_models
node_moderation_logic -->|"manages tokens"| node_tokens
node_moderation_logic -->|"accesses data"| node_store
node_person -->|"administers"| node_admin_ui
node_admin_ui -.->|"requests approval"| node_admin_audit
node_admin_audit -->|"reads/writes"| node_store
node_admin_audit -->|"queries records"| node_models
node_store -->|"uses schema"| node_models

click node_app "https://github.com/almamun4901/the-whisper/blob/main/frontend/src/App.tsx"
click node_registration "https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/Register.tsx"
click node_sender_ui "https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/SendMessage.tsx"
click node_inbox_ui "https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/Inbox.tsx"
click node_dashboard_ui "https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/Dashboard.tsx"
click node_moderator_ui "https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/ModeratorDashboard.tsx"
click node_admin_ui "https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/admin/AdminDashboard.tsx"
click node_auth_routes "https://github.com/almamun4901/the-whisper/blob/main/backend/routes/auth_routes.py"
click node_registration_api "https://github.com/almamun4901/the-whisper/blob/main/backend/main.py"
click node_jwt "https://github.com/almamun4901/the-whisper/blob/main/auth/jwt_auth.py"
click node_rbac "https://github.com/almamun4901/the-whisper/blob/main/auth/rbac.py"
click node_user_api "https://github.com/almamun4901/the-whisper/blob/main/backend/routes/user_routes.py"
click node_key_management "https://github.com/almamun4901/the-whisper/blob/main/encryption/key_management.py"
click node_key_decryption "https://github.com/almamun4901/the-whisper/blob/main/frontend/src/components/KeyDecryption.tsx"
click node_message_api "https://github.com/almamun4901/the-whisper/blob/main/backend/routes/message_routes.py"
click node_message_crypto "https://github.com/almamun4901/the-whisper/blob/main/encryption/message_crypto.py"
click node_tokens "https://github.com/almamun4901/the-whisper/blob/main/encryption/token_manager.py"
click node_e2e "https://github.com/almamun4901/the-whisper/blob/main/encryption/e2e_encryption.py"
click node_moderation "https://github.com/almamun4901/the-whisper/blob/main/backend/routes/moderator_routes.py"
click node_moderation_logic "https://github.com/almamun4901/the-whisper/blob/main/backend/moderation.py"
click node_admin_audit "https://github.com/almamun4901/the-whisper/blob/main/backend/main.py"
click node_store "https://github.com/almamun4901/the-whisper/blob/main/database/database.py"
click node_models "https://github.com/almamun4901/the-whisper/blob/main/database/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_app,node_registration,node_sender_ui,node_inbox_ui,node_dashboard_ui,node_moderator_ui,node_admin_ui,node_person toneBlue
class node_auth_routes,node_registration_api,node_jwt,node_rbac,node_user_api toneAmber
class node_key_management,node_key_decryption,node_message_api,node_message_crypto,node_tokens,node_e2e toneMint
class node_moderation,node_moderation_logic,node_admin_audit toneRose
class node_store,node_models toneIndigo
```

## Components

### User interface

- [Route shell](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Registration](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/Register.tsx): `frontend/src/pages/Register.tsx`
- [Send message](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/SendMessage.tsx): `frontend/src/pages/SendMessage.tsx`
- [Inbox](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/Inbox.tsx): `frontend/src/pages/Inbox.tsx`
- [User dashboard](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Moderator console](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/ModeratorDashboard.tsx): `frontend/src/pages/ModeratorDashboard.tsx`
- [Admin dashboard](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/pages/admin/AdminDashboard.tsx): `frontend/src/pages/admin/AdminDashboard.tsx`

### Identity and access

- [Auth routes](https://github.com/almamun4901/the-whisper/blob/main/backend/routes/auth_routes.py): `backend/routes/auth_routes.py`
- [Registration and approval](https://github.com/almamun4901/the-whisper/blob/main/backend/main.py): `backend/main.py`
- [JWT authentication](https://github.com/almamun4901/the-whisper/blob/main/auth/jwt_auth.py): `auth/jwt_auth.py`
- [Role access control](https://github.com/almamun4901/the-whisper/blob/main/auth/rbac.py): `auth/rbac.py`
- [User and receiver API](https://github.com/almamun4901/the-whisper/blob/main/backend/routes/user_routes.py): `backend/routes/user_routes.py`

### Anonymous messaging

- [Key management](https://github.com/almamun4901/the-whisper/blob/main/encryption/key_management.py): `encryption/key_management.py`
- [Key decryption UI](https://github.com/almamun4901/the-whisper/blob/main/frontend/src/components/KeyDecryption.tsx): `frontend/src/components/KeyDecryption.tsx`
- [Message routes](https://github.com/almamun4901/the-whisper/blob/main/backend/routes/message_routes.py): `backend/routes/message_routes.py`
- [Message encryption](https://github.com/almamun4901/the-whisper/blob/main/encryption/message_crypto.py): `encryption/message_crypto.py`
- [Anonymous tokens](https://github.com/almamun4901/the-whisper/blob/main/encryption/token_manager.py): `encryption/token_manager.py`
- [End-to-end encryption](https://github.com/almamun4901/the-whisper/blob/main/encryption/e2e_encryption.py): `encryption/e2e_encryption.py`

### Moderation and audit

- [Moderation routes](https://github.com/almamun4901/the-whisper/blob/main/backend/routes/moderator_routes.py): `backend/routes/moderator_routes.py`
- [Moderation logic](https://github.com/almamun4901/the-whisper/blob/main/backend/moderation.py): `backend/moderation.py`
- [Admin and audit API](https://github.com/almamun4901/the-whisper/blob/main/backend/main.py): `backend/main.py`

### Persistence

- [Application database](https://github.com/almamun4901/the-whisper/blob/main/database/database.py): `database/database.py`
- [Domain records](https://github.com/almamun4901/the-whisper/blob/main/database/models.py): `database/models.py`

### Other components

- **Platform user**

## Connections

- Platform user → Route shell: uses (evidence: `frontend/src/App.tsx`)
- Route shell → Registration: routes to (evidence: `frontend/src/App.tsx`)
- Route shell → Send message: routes to (evidence: `frontend/src/App.tsx`)
- Route shell → Inbox: routes to (evidence: `frontend/src/App.tsx`)
- Route shell → User dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Route shell → Moderator console: routes to (evidence: `frontend/src/App.tsx`)
- Route shell → Admin dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Route shell → Key decryption UI: routes to
- Platform user → Registration and approval: registers (evidence: `backend/main.py`)
- Platform user → Auth routes: authenticates
- Registration and approval → Application database: reads/writes (evidence: `backend/main.py`)
- Registration and approval → Key management: generates keys (evidence: `backend/main.py`)
- Registration and approval → Domain records: creates records (evidence: `backend/main.py`)
- Auth routes → JWT authentication: uses
- User and receiver API → JWT authentication: authenticates (evidence: `backend/routes/user_routes.py`)
- User and receiver API → Application database: queries (evidence: `backend/routes/user_routes.py`)
- User and receiver API → Domain records: queries (evidence: `backend/routes/user_routes.py`)
- JWT authentication → Application database: loads users (evidence: `auth/jwt_auth.py`)
- JWT authentication → Domain records: queries users (evidence: `auth/jwt_auth.py`)
- Role access control → JWT authentication: uses
- Platform user → Send message: composes
- Send message → Message routes: sends request
- Message routes → JWT authentication: authenticates (evidence: `backend/routes/message_routes.py`)
- Message routes → Anonymous tokens: validates tokens (evidence: `backend/routes/message_routes.py`)
- Message routes → Message encryption: encrypts messages (evidence: `backend/routes/message_routes.py`)
- Message routes → Application database: reads/writes (evidence: `backend/routes/message_routes.py`)
- Message routes → Domain records: queries messages (evidence: `backend/routes/message_routes.py`)
- Platform user → Inbox: reads messages
- Inbox → Message routes: fetches inbox
- Key decryption UI → Key management: decrypts keys
- Platform user → Moderator console: moderates
- Moderator console → Moderation routes: requests actions
- Moderation routes → JWT authentication: verifies moderator (evidence: `backend/routes/moderator_routes.py`)
- Moderation routes → Anonymous tokens: freezes tokens (evidence: `backend/routes/moderator_routes.py`)
- Moderation routes → Application database: reads/writes (evidence: `backend/routes/moderator_routes.py`)
- Moderation routes → Domain records: queries records (evidence: `backend/routes/moderator_routes.py`)
- Moderation logic → Anonymous tokens: manages tokens (evidence: `backend/moderation.py`)
- Moderation logic → Application database: accesses data (evidence: `backend/moderation.py`)
- Platform user → Admin dashboard: administers
- Admin dashboard → Admin and audit API: requests approval
- Admin and audit API → Application database: reads/writes (evidence: `backend/main.py`)
- Admin and audit API → Domain records: queries records (evidence: `backend/main.py`)
- Application database → Domain records: uses schema (evidence: `database/models.py`)
