# alharthalhajhussein/core-platform-service architecture

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

- Interactive diagram: https://gitdiagram.com/alharthalhajhussein/core-platform-service
- Repository: https://github.com/alharthalhajhussein/core-platform-service

## Overview

Core-Platform-Service is a FastAPI backend for managing users, companies, agents, knowledge buckets, and monitored conversations. Users enter through API routes; authentication and role-based access checks gate domain services, which implement requests against relational models or proxy selected work to external services. Conversation endpoints also provide real-time WebSocket access. The README identifies PostgreSQL and Redis as backing services; GCS, Telegram, and the RAG engine are evidenced in source. Some routes and services were not sampled, so those subsystem links are included only where the source index or README supports them.

Main entry points: [`src/services`](https://github.com/alharthalhajhussein/core-platform-service/tree/main/src/services) (Domain Services), [`src/main.py`](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/main.py) (FastAPI App), [`src/routers/dependencies.py`](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/dependencies.py) (Auth and RBAC), [`src/routers/agent_router.py`](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/agent_router.py) (Agent Management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Access"]
  node_app["FastAPI App<br/>[main.py]"]
  node_access["Auth and RBAC<br/>[dependencies.py]"]
end

subgraph group_domains["Platform Domains"]
  node_auth["Authentication<br/>[auth_router.py]"]
  node_users["User Management<br/>[user_router.py]"]
  node_admin["Administration<br/>[admin_router.py]"]
  node_sections["Section Management<br/>[section_router.py]"]
  node_agents["Agent Management<br/>[agent_router.py]"]
  node_knowledge["Knowledge Management<br/>[kb_router.py]"]
  node_conversations["Conversation Monitoring"]
  node_overview["Platform Overview<br/>[overview_router.py]"]
  node_internal["Internal API<br/>[internal_api.py]"]
  node_domain_services["Domain Services"]
  node_conversation_service["Conversation Service"]
end

subgraph group_persistence["Persistence"]
  node_models["Relational Domain Models"]
  node_postgres[("PostgreSQL")]
end

subgraph group_infra["Supporting Services"]
  node_redis[("Redis")]
  node_security_helpers["Security Helpers<br/>[security.py]"]
  node_websocket["WebSocket Manager"]
end

subgraph group_integrations["External Integrations"]
  node_rag_proxy["RAG Proxy"]
  node_gcs[("Google Cloud Storage")]
  node_rag_engine["RAG Engine"]
  node_telegram["Telegram API"]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_app
node_app -->|"registers routes"| node_auth
node_app -->|"registers routes"| node_users
node_app -->|"registers routes"| node_admin
node_app -->|"registers routes"| node_sections
node_app -->|"registers routes"| node_agents
node_app -->|"registers routes"| node_knowledge
node_app -->|"registers routes"| node_conversations
node_app -->|"registers routes"| node_overview
node_app -->|"registers routes"| node_internal
node_auth -->|"calls auth service"| node_domain_services
node_users -->|"calls user service"| node_domain_services
node_admin -->|"calls admin service"| node_domain_services
node_sections -->|"calls section service"| node_domain_services
node_agents -->|"calls agent service"| node_domain_services
node_knowledge -->|"calls KB service"| node_domain_services
node_conversations -->|"calls service"| node_conversation_service
node_overview -->|"calls overview service"| node_domain_services
node_auth -->|"uses dependencies"| node_access
node_users -->|"uses dependencies"| node_access
node_admin -->|"uses dependencies"| node_access
node_sections -->|"uses dependencies"| node_access
node_agents -->|"uses dependencies"| node_access
node_knowledge -->|"uses dependencies"| node_access
node_conversations -->|"checks access"| node_access
node_overview -->|"uses dependencies"| node_access
node_access -->|"queries identity and access"| node_models
node_access -->|"checks token blocks"| node_redis
node_domain_services -->|"uses domain records"| node_models
node_conversation_service -->|"reads and updates"| node_models
node_domain_services -->|"persists domain data"| node_postgres
node_conversation_service -->|"persists conversations"| node_postgres
node_domain_services -->|"delegates KB actions"| node_rag_proxy
node_rag_proxy -->|"sends authenticated requests"| node_rag_engine
node_conversation_service -->|"uses file storage"| node_gcs
node_domain_services -->|"uses cache and blocklist"| node_redis
node_domain_services -->|"uses security functions"| node_security_helpers
node_security_helpers -->|"checks blocklist"| node_redis
node_agents -->|"manages live connection"| node_websocket
node_domain_services -->|"registers webhooks"| node_telegram

click node_app "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/main.py"
click node_access "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/dependencies.py"
click node_auth "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/auth_router.py"
click node_users "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/user_router.py"
click node_admin "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/admin_router.py"
click node_sections "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/section_router.py"
click node_agents "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/agent_router.py"
click node_knowledge "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/kb_router.py"
click node_conversations "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/conversation_router.py"
click node_overview "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/overview_router.py"
click node_internal "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/internal_api.py"
click node_domain_services "https://github.com/alharthalhajhussein/core-platform-service/tree/main/src/services"
click node_conversation_service "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/services/conversation_service.py"
click node_rag_proxy "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/services/rag_proxy_service.py"
click node_models "https://github.com/alharthalhajhussein/core-platform-service/tree/main/src/models"
click node_security_helpers "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/helpers/security.py"
click node_websocket "https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/helpers/websocket_manager.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_access,node_client toneBlue
class node_auth,node_users,node_admin,node_sections,node_agents,node_knowledge,node_conversations,node_overview,node_internal,node_domain_services,node_conversation_service toneAmber
class node_models,node_postgres toneMint
class node_redis,node_security_helpers,node_websocket toneRose
class node_rag_proxy,node_gcs,node_rag_engine,node_telegram toneIndigo
```

## Components

### API and Access

- [FastAPI App](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/main.py): `src/main.py`
- [Auth and RBAC](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/dependencies.py): `src/routers/dependencies.py`

### Platform Domains

- [Authentication](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/auth_router.py): `src/routers/auth_router.py`
- [User Management](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/user_router.py): `src/routers/user_router.py`
- [Administration](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/admin_router.py): `src/routers/admin_router.py`
- [Section Management](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/section_router.py): `src/routers/section_router.py`
- [Agent Management](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/agent_router.py): `src/routers/agent_router.py`
- [Knowledge Management](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/kb_router.py): `src/routers/kb_router.py`
- [Conversation Monitoring](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/conversation_router.py): `src/routers/conversation_router.py`
- [Platform Overview](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/overview_router.py): `src/routers/overview_router.py`
- [Internal API](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/routers/internal_api.py): `src/routers/internal_api.py`
- [Domain Services](https://github.com/alharthalhajhussein/core-platform-service/tree/main/src/services): `src/services`
- [Conversation Service](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/services/conversation_service.py): `src/services/conversation_service.py`

### Persistence

- [Relational Domain Models](https://github.com/alharthalhajhussein/core-platform-service/tree/main/src/models): `src/models`
- **PostgreSQL**

### Supporting Services

- **Redis**
- [Security Helpers](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/helpers/security.py): `src/helpers/security.py`
- [WebSocket Manager](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/helpers/websocket_manager.py): `src/helpers/websocket_manager.py`

### External Integrations

- [RAG Proxy](https://github.com/alharthalhajhussein/core-platform-service/blob/main/src/services/rag_proxy_service.py): `src/services/rag_proxy_service.py`
- **Google Cloud Storage**
- **RAG Engine**
- **Telegram API**

### Other components

- **API Client**

## Connections

- API Client → FastAPI App: sends requests (evidence: `src/main.py`)
- FastAPI App → Authentication: registers routes (evidence: `src/main.py`)
- FastAPI App → User Management: registers routes (evidence: `src/main.py`)
- FastAPI App → Administration: registers routes (evidence: `src/main.py`)
- FastAPI App → Section Management: registers routes (evidence: `src/main.py`)
- FastAPI App → Agent Management: registers routes (evidence: `src/main.py`)
- FastAPI App → Knowledge Management: registers routes (evidence: `src/main.py`)
- FastAPI App → Conversation Monitoring: registers routes (evidence: `src/main.py`)
- FastAPI App → Platform Overview: registers routes (evidence: `src/main.py`)
- FastAPI App → Internal API: registers routes (evidence: `src/main.py`)
- Authentication → Domain Services: calls auth service (evidence: `src/routers/auth_router.py`)
- User Management → Domain Services: calls user service (evidence: `src/routers/user_router.py`)
- Administration → Domain Services: calls admin service (evidence: `src/routers/admin_router.py`)
- Section Management → Domain Services: calls section service (evidence: `src/routers/section_router.py`)
- Agent Management → Domain Services: calls agent service (evidence: `src/routers/agent_router.py`)
- Knowledge Management → Domain Services: calls KB service (evidence: `src/routers/kb_router.py`)
- Conversation Monitoring → Conversation Service: calls service (evidence: `src/routers/conversation_router.py`)
- Platform Overview → Domain Services: calls overview service (evidence: `src/routers/overview_router.py`)
- Authentication → Auth and RBAC: uses dependencies (evidence: `src/routers/auth_router.py`)
- User Management → Auth and RBAC: uses dependencies (evidence: `src/routers/user_router.py`)
- Administration → Auth and RBAC: uses dependencies (evidence: `src/routers/admin_router.py`)
- Section Management → Auth and RBAC: uses dependencies (evidence: `src/routers/section_router.py`)
- Agent Management → Auth and RBAC: uses dependencies (evidence: `src/routers/agent_router.py`)
- Knowledge Management → Auth and RBAC: uses dependencies (evidence: `src/routers/kb_router.py`)
- Conversation Monitoring → Auth and RBAC: checks access (evidence: `src/routers/conversation_router.py`)
- Platform Overview → Auth and RBAC: uses dependencies (evidence: `src/routers/overview_router.py`)
- Auth and RBAC → Relational Domain Models: queries identity and access (evidence: `src/routers/dependencies.py`)
- Auth and RBAC → Redis: checks token blocks (evidence: `src/routers/dependencies.py`)
- Domain Services → Relational Domain Models: uses domain records (evidence: `src/services/user_service.py`)
- Conversation Service → Relational Domain Models: reads and updates (evidence: `src/services/conversation_service.py`)
- Domain Services → PostgreSQL: persists domain data (evidence: `src/services/user_service.py`)
- Conversation Service → PostgreSQL: persists conversations (evidence: `src/services/conversation_service.py`)
- Domain Services → RAG Proxy: delegates KB actions (evidence: `src/services/knowledge_bucket_service.py`)
- RAG Proxy → RAG Engine: sends authenticated requests (evidence: `src/services/rag_proxy_service.py`)
- Conversation Service → Google Cloud Storage: uses file storage (evidence: `src/services/conversation_service.py`)
- Domain Services → Redis: uses cache and blocklist (evidence: `src/services/auth_service.py`)
- Domain Services → Security Helpers: uses security functions (evidence: `src/services/auth_service.py`)
- Security Helpers → Redis: checks blocklist (evidence: `src/helpers/security.py`)
- Agent Management → WebSocket Manager: manages live connection
- Domain Services → Telegram API: registers webhooks (evidence: `src/services/agent_service.py`)
