# ghadayousef/nasaqai_gh architecture

> Architecture diagram of the GitHub repository ghadayousef/nasaqai_gh, 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/ghadayousef/nasaqai_gh
- Repository: https://github.com/ghadayousef/nasaqai_gh

## Overview

This repository is a web application: a React frontend and FastAPI backend, with authentication, a database, object storage, and Nasaq/AI-related domain modules. The user-facing flow enters through frontend routes, calls backend APIs, and reaches domain services and external integrations. The README is empty, so product capabilities are inferred from the source tree; several domain modules were not sampled, and their runtime links are left unverified rather than asserted.

Main entry points: [`app/backend/routers`](https://github.com/ghadayousef/nasaqai_gh/tree/main/app/backend/routers) (API routers), [`app/frontend/src/App.tsx`](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/App.tsx) (React app), [`app/frontend/src/pages`](https://github.com/ghadayousef/nasaqai_gh/tree/main/app/frontend/src/pages) (App pages), [`app/backend/services/auth.py`](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/auth.py) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web frontend"]
  node_webapp["React app<br/>[App.tsx]"]
  node_webpages["App pages"]
  node_blog["Blog pages<br/>[blog-routes.tsx]"]
  node_frontendapi["API client<br/>[api.ts]"]
  node_authcontext["Auth context<br/>[AuthContext.tsx]"]
end

subgraph group_backend["API runtime"]
  node_main["FastAPI app<br/>[main.py]"]
  node_routers["API routers"]
  node_settings["Configuration<br/>[config.py]"]
end

subgraph group_identity["Identity"]
  node_authdep["Auth dependencies<br/>[auth.py]"]
  node_authcore["Token validation<br/>[auth.py]"]
  node_authservice["Auth service<br/>[auth.py]"]
  node_authmodels["Auth models<br/>[auth.py]"]
end

subgraph group_domain["Product services"]
  node_nasaq["Nasaq workspace<br/>[nasaq_core.py]"]
  node_profiles["Profiles<br/>[nasaq_profiles.py]"]
  node_integrations["Integrations"]
  node_payments["Payments<br/>[nasaq_payments.py]"]
  node_usage["Usage tracking<br/>[nasaq_usage.py]"]
  node_whatsapp["WhatsApp messages"]
  node_aihub["AI hub<br/>[aihub.py]"]
end

subgraph group_infra["Data and integrations"]
  node_storage["Object storage<br/>[storage.py]"]
  node_oss["Object storage service"]
  node_dbservice["Database service<br/>[database.py]"]
  node_dbmanager[("Database manager<br/>[database.py]")]
end

node_user(("User"))

node_user -->|"opens"| node_webapp
node_webapp -->|"routes to"| node_webpages
node_webapp -.->|"routes to"| node_blog
node_webpages -.->|"calls"| node_frontendapi
node_authcontext -.->|"provides auth"| node_webapp
node_webpages -.->|"uses"| node_authcontext
node_main -->|"registers"| node_routers
node_routers -.->|"requires auth"| node_authdep
node_authdep -->|"decodes token"| node_authcore
node_routers -->|"delegates auth"| node_authservice
node_authservice -->|"uses tokens"| node_authcore
node_authservice -->|"uses models"| node_authmodels
node_routers -->|"delegates storage"| node_storage
node_storage -->|"calls HTTP API"| node_oss
node_routers -.->|"dispatches domain"| node_nasaq
node_routers -.->|"dispatches profiles"| node_profiles
node_routers -.->|"dispatches integrations"| node_integrations
node_routers -.->|"dispatches payments"| node_payments
node_routers -.->|"dispatches usage"| node_usage
node_routers -.->|"dispatches messages"| node_whatsapp
node_routers -.->|"dispatches AI"| node_aihub
node_main -->|"initializes database"| node_dbservice
node_dbservice -->|"opens sessions"| node_dbmanager
node_dbmanager -->|"reads settings"| node_settings
node_storage -->|"reads credentials"| node_settings

click node_webapp "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/App.tsx"
click node_webpages "https://github.com/ghadayousef/nasaqai_gh/tree/main/app/frontend/src/pages"
click node_blog "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/blog-routes.tsx"
click node_frontendapi "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/lib/api.ts"
click node_authcontext "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/contexts/AuthContext.tsx"
click node_main "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/main.py"
click node_routers "https://github.com/ghadayousef/nasaqai_gh/tree/main/app/backend/routers"
click node_authdep "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/dependencies/auth.py"
click node_authcore "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/core/auth.py"
click node_authservice "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/auth.py"
click node_authmodels "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/models/auth.py"
click node_nasaq "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_core.py"
click node_profiles "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_profiles.py"
click node_integrations "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_integrations.py"
click node_payments "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_payments.py"
click node_usage "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_usage.py"
click node_whatsapp "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_wa_messages.py"
click node_aihub "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/aihub.py"
click node_storage "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/storage.py"
click node_dbservice "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/database.py"
click node_dbmanager "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/core/database.py"
click node_settings "https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/core/config.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_webpages,node_blog,node_frontendapi,node_authcontext,node_user toneBlue
class node_main,node_routers,node_settings toneAmber
class node_authdep,node_authcore,node_authservice,node_authmodels toneMint
class node_nasaq,node_profiles,node_integrations,node_payments,node_usage,node_whatsapp,node_aihub toneRose
class node_storage,node_oss,node_dbservice,node_dbmanager toneIndigo
```

## Components

### Web frontend

- [React app](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/App.tsx): `app/frontend/src/App.tsx`
- [App pages](https://github.com/ghadayousef/nasaqai_gh/tree/main/app/frontend/src/pages): `app/frontend/src/pages`
- [Blog pages](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/blog-routes.tsx): `app/frontend/src/blog-routes.tsx`
- [API client](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/lib/api.ts): `app/frontend/src/lib/api.ts`
- [Auth context](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/frontend/src/contexts/AuthContext.tsx): `app/frontend/src/contexts/AuthContext.tsx`

### API runtime

- [FastAPI app](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/main.py): `app/backend/main.py`
- [API routers](https://github.com/ghadayousef/nasaqai_gh/tree/main/app/backend/routers): `app/backend/routers`
- [Configuration](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/core/config.py): `app/backend/core/config.py`

### Identity

- [Auth dependencies](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/dependencies/auth.py): `app/backend/dependencies/auth.py`
- [Token validation](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/core/auth.py): `app/backend/core/auth.py`
- [Auth service](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/auth.py): `app/backend/services/auth.py`
- [Auth models](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/models/auth.py): `app/backend/models/auth.py`

### Product services

- [Nasaq workspace](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_core.py): `app/backend/services/nasaq_core.py`
- [Profiles](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_profiles.py): `app/backend/services/nasaq_profiles.py`
- [Integrations](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_integrations.py): `app/backend/services/nasaq_integrations.py`
- [Payments](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_payments.py): `app/backend/services/nasaq_payments.py`
- [Usage tracking](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_usage.py): `app/backend/services/nasaq_usage.py`
- [WhatsApp messages](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/nasaq_wa_messages.py): `app/backend/services/nasaq_wa_messages.py`
- [AI hub](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/aihub.py): `app/backend/services/aihub.py`

### Data and integrations

- [Object storage](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/storage.py): `app/backend/services/storage.py`
- **Object storage service**
- [Database service](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/services/database.py): `app/backend/services/database.py`
- [Database manager](https://github.com/ghadayousef/nasaqai_gh/blob/main/app/backend/core/database.py): `app/backend/core/database.py`

### Other components

- **User**

## Connections

- User → React app: opens
- React app → App pages: routes to (evidence: `app/frontend/src/App.tsx`)
- React app → Blog pages: routes to (evidence: `app/frontend/src/App.tsx`)
- App pages → API client: calls (evidence: `app/frontend/src/pages/AuthCallback.tsx`)
- Auth context → React app: provides auth (evidence: `app/frontend/src/contexts/AuthContext.tsx`)
- App pages → Auth context: uses
- FastAPI app → API routers: registers (evidence: `app/backend/main.py`)
- API routers → Auth dependencies: requires auth (evidence: `app/backend/routers/storage.py`)
- Auth dependencies → Token validation: decodes token (evidence: `app/backend/dependencies/auth.py`)
- API routers → Auth service: delegates auth (evidence: `app/backend/routers/auth.py`)
- Auth service → Token validation: uses tokens (evidence: `app/backend/services/auth.py`)
- Auth service → Auth models: uses models (evidence: `app/backend/services/auth.py`)
- API routers → Object storage: delegates storage (evidence: `app/backend/routers/storage.py`)
- Object storage → Object storage service: calls HTTP API (evidence: `app/backend/services/storage.py`)
- API routers → Nasaq workspace: dispatches domain
- API routers → Profiles: dispatches profiles
- API routers → Integrations: dispatches integrations
- API routers → Payments: dispatches payments
- API routers → Usage tracking: dispatches usage
- API routers → WhatsApp messages: dispatches messages
- API routers → AI hub: dispatches AI
- FastAPI app → Database service: initializes database (evidence: `app/backend/main.py`)
- Database service → Database manager: opens sessions (evidence: `app/backend/services/database.py`)
- Database manager → Configuration: reads settings (evidence: `app/backend/core/database.py`)
- Object storage → Configuration: reads credentials (evidence: `app/backend/services/storage.py`)
