# kumarianetham-bot/nexdb architecture

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

- Interactive diagram: https://gitdiagram.com/kumarianetham-bot/nexdb
- Repository: https://github.com/kumarianetham-bot/nexdb

## Overview

NexDB is an AI-assisted database design workspace. Users sign in, create or explore shared Debs, edit SQL and a schema canvas, request AI assistance, and collaborate with teammates. The graph separates the React experience from the FastAPI domain modules and shared AI/RAG services. README capabilities are included even where implementation was not sampled; relationships for those areas are documented rather than inferred from module names.

Main entry points: [`frontend/src/App.jsx`](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/App.jsx) (React routes), [`backend/main.py`](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/main.py) (FastAPI application), [`backend/modules/ai_review/services.py`](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/ai_review/services.py) (AI skill orchestration), [`frontend/src/pages/Workspace.jsx`](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Workspace.jsx) (SQL and schema canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Workspace interface"]
  node_app["React routes<br/>[App.jsx]"]
  node_welcome["Welcome and onboarding<br/>[Welcome.jsx]"]
  node_dashboard["Dashboard and discovery<br/>[Dashboard.jsx]"]
  node_workspace_ui["SQL and schema canvas<br/>[Workspace.jsx]"]
  node_team_ui["Team space<br/>[TeamSpace.jsx]"]
end

subgraph group_identity["Identity and profile"]
  node_auth_context["Authentication state<br/>[AuthContext.jsx]"]
  node_auth_api["Auth API client<br/>[auth.js]"]
  node_auth_routes["Auth routes and service<br/>[router.py]"]
  node_user_routes["Profile and avatar<br/>[router.py]"]
  node_auth_repo["Auth repository<br/>[repository.py]"]
end

subgraph group_debs["Schema workspaces"]
  node_debs_api["Debs API client<br/>[debs.js]"]
  node_debs_routes["Debs routes and service<br/>[router.py]"]
  node_debs_store[("Debs repository and models<br/>[repository.py]")]
end

subgraph group_ai["AI assistance"]
  node_ai_ui["AI review panel<br/>[Workspace.jsx]"]
  node_ai_routes["AI review routes<br/>[router.py]"]
  node_ai_service["AI skill orchestration<br/>[services.py]"]
  node_ai_skills["SQL assistance skills"]
  node_ai_client["AI provider client<br/>[client.py]"]
  node_rag["Knowledge retrieval<br/>[retriever.py]"]
  node_rag_store[("Vector knowledge store<br/>[repository.py]")]
end

subgraph group_collab["Team collaboration"]
  node_team_routes["Collaboration routes<br/>[router.py]"]
  node_team_service["Messages and comments<br/>[services.py]"]
  node_team_store[("Collaboration repository<br/>[repository.py]")]
end

node_user(("Workspace user"))
node_api["FastAPI application<br/>[main.py]"]
node_postgres[("PostgreSQL and pgvector")]
node_redis[("Redis")]
node_ai_provider["AI provider"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_welcome
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_workspace_ui
node_app -->|"routes to"| node_team_ui
node_welcome -.->|"supports sign-in"| node_auth_context
node_auth_context -->|"calls"| node_auth_api
node_auth_api -.->|"sends auth requests"| node_auth_routes
node_auth_routes -->|"registered by"| node_api
node_auth_routes -->|"uses"| node_auth_repo
node_dashboard -.->|"browses workspaces"| node_debs_api
node_workspace_ui -.->|"edits schema"| node_debs_api
node_debs_api -.->|"sends workspace requests"| node_debs_routes
node_debs_routes -->|"registered by"| node_api
node_debs_routes -->|"delegates"| node_debs_store
node_debs_store -.->|"reads and writes"| node_postgres
node_workspace_ui -->|"requests assistance"| node_ai_ui
node_ai_ui -.->|"submits analysis"| node_ai_routes
node_ai_routes -->|"registered by"| node_api
node_ai_routes -->|"delegates"| node_ai_service
node_ai_service -->|"invokes skills"| node_ai_skills
node_ai_service -->|"uses"| node_ai_client
node_ai_skills -->|"calls"| node_ai_client
node_ai_client -->|"requests completions"| node_ai_provider
node_ai_service -->|"uses for chat"| node_rag
node_rag -->|"retrieves rules"| node_rag_store
node_rag_store -->|"queries vectors"| node_postgres
node_team_ui -.->|"uses collaboration"| node_team_routes
node_team_routes -->|"registered by"| node_api
node_team_routes -->|"delegates"| node_team_service
node_team_service -.->|"persists messages"| node_team_store
node_api -->|"initializes pool"| node_redis

click node_app "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/App.jsx"
click node_welcome "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Welcome.jsx"
click node_dashboard "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Dashboard.jsx"
click node_workspace_ui "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Workspace.jsx"
click node_team_ui "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/TeamSpace.jsx"
click node_auth_context "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_api "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/api/auth.js"
click node_auth_routes "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/auth/router.py"
click node_user_routes "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/users/router.py"
click node_debs_api "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/api/debs.js"
click node_debs_routes "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/debs/router.py"
click node_debs_store "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/debs/repository.py"
click node_ai_ui "https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Workspace.jsx"
click node_ai_routes "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/ai_review/router.py"
click node_ai_service "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/ai_review/services.py"
click node_ai_skills "https://github.com/kumarianetham-bot/nexdb/tree/main/backend/modules/ai_review/skills"
click node_ai_client "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/shared/ai/client.py"
click node_rag "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/shared/rag/retriever.py"
click node_rag_store "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/shared/rag/repository.py"
click node_team_routes "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/collaboration/router.py"
click node_team_service "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/collaboration/services.py"
click node_team_store "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/collaboration/repository.py"
click node_api "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/main.py"
click node_auth_repo "https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/auth/repository.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_welcome,node_dashboard,node_workspace_ui,node_team_ui,node_user toneBlue
class node_auth_context,node_auth_api,node_auth_routes,node_user_routes,node_auth_repo,node_postgres,node_redis toneAmber
class node_debs_api,node_debs_routes,node_debs_store,node_api toneMint
class node_ai_ui,node_ai_routes,node_ai_service,node_ai_skills,node_ai_client,node_rag,node_rag_store toneRose
class node_team_routes,node_team_service,node_team_store,node_ai_provider toneIndigo
```

## Components

### Workspace interface

- [React routes](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Welcome and onboarding](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Welcome.jsx): `frontend/src/pages/Welcome.jsx`
- [Dashboard and discovery](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [SQL and schema canvas](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Workspace.jsx): `frontend/src/pages/Workspace.jsx`
- [Team space](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/TeamSpace.jsx): `frontend/src/pages/TeamSpace.jsx`

### Identity and profile

- [Authentication state](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auth API client](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/api/auth.js): `frontend/src/api/auth.js`
- [Auth routes and service](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/auth/router.py): `backend/modules/auth/router.py`
- [Profile and avatar](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/users/router.py): `backend/modules/users/router.py`
- [Auth repository](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/auth/repository.py): `backend/modules/auth/repository.py`

### Schema workspaces

- [Debs API client](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/api/debs.js): `frontend/src/api/debs.js`
- [Debs routes and service](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/debs/router.py): `backend/modules/debs/router.py`
- [Debs repository and models](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/debs/repository.py): `backend/modules/debs/repository.py`

### AI assistance

- [AI review panel](https://github.com/kumarianetham-bot/nexdb/blob/main/frontend/src/pages/Workspace.jsx): `frontend/src/pages/Workspace.jsx`
- [AI review routes](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/ai_review/router.py): `backend/modules/ai_review/router.py`
- [AI skill orchestration](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/ai_review/services.py): `backend/modules/ai_review/services.py`
- [SQL assistance skills](https://github.com/kumarianetham-bot/nexdb/tree/main/backend/modules/ai_review/skills): `backend/modules/ai_review/skills`
- [AI provider client](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/shared/ai/client.py): `backend/shared/ai/client.py`
- [Knowledge retrieval](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/shared/rag/retriever.py): `backend/shared/rag/retriever.py`
- [Vector knowledge store](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/shared/rag/repository.py): `backend/shared/rag/repository.py`

### Team collaboration

- [Collaboration routes](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/collaboration/router.py): `backend/modules/collaboration/router.py`
- [Messages and comments](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/collaboration/services.py): `backend/modules/collaboration/services.py`
- [Collaboration repository](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/modules/collaboration/repository.py): `backend/modules/collaboration/repository.py`

### Other components

- **Workspace user**
- [FastAPI application](https://github.com/kumarianetham-bot/nexdb/blob/main/backend/main.py): `backend/main.py`
- **PostgreSQL and pgvector**
- **Redis**
- **AI provider**

## Connections

- Workspace user → React routes: uses (evidence: `README.md`)
- React routes → Welcome and onboarding: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Dashboard and discovery: routes to (evidence: `frontend/src/App.jsx`)
- React routes → SQL and schema canvas: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Team space: routes to (evidence: `frontend/src/App.jsx`)
- Welcome and onboarding → Authentication state: supports sign-in (evidence: `README.md`)
- Authentication state → Auth API client: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- Auth API client → Auth routes and service: sends auth requests (evidence: `README.md`)
- Auth routes and service → FastAPI application: registered by (evidence: `backend/main.py`)
- Auth routes and service → Auth repository: uses (evidence: `backend/modules/auth/router.py`)
- Dashboard and discovery → Debs API client: browses workspaces (evidence: `README.md`)
- SQL and schema canvas → Debs API client: edits schema (evidence: `README.md`)
- Debs API client → Debs routes and service: sends workspace requests (evidence: `README.md`)
- Debs routes and service → FastAPI application: registered by (evidence: `backend/main.py`)
- Debs routes and service → Debs repository and models: delegates (evidence: `backend/modules/debs/router.py`)
- Debs repository and models → PostgreSQL and pgvector: reads and writes
- SQL and schema canvas → AI review panel: requests assistance (evidence: `README.md`)
- AI review panel → AI review routes: submits analysis (evidence: `README.md`)
- AI review routes → FastAPI application: registered by (evidence: `backend/main.py`)
- AI review routes → AI skill orchestration: delegates (evidence: `backend/modules/ai_review/router.py`)
- AI skill orchestration → SQL assistance skills: invokes skills (evidence: `backend/modules/ai_review/services.py`)
- AI skill orchestration → AI provider client: uses (evidence: `backend/modules/ai_review/services.py`)
- SQL assistance skills → AI provider client: calls (evidence: `backend/modules/ai_review/skills/review.py`)
- AI provider client → AI provider: requests completions (evidence: `backend/shared/ai/client.py`)
- AI skill orchestration → Knowledge retrieval: uses for chat (evidence: `backend/modules/ai_review/services.py`)
- Knowledge retrieval → Vector knowledge store: retrieves rules (evidence: `backend/shared/rag/retriever.py`)
- Vector knowledge store → PostgreSQL and pgvector: queries vectors (evidence: `backend/shared/rag/repository.py`)
- Team space → Collaboration routes: uses collaboration (evidence: `README.md`)
- Collaboration routes → FastAPI application: registered by (evidence: `backend/main.py`)
- Collaboration routes → Messages and comments: delegates (evidence: `backend/modules/collaboration/router.py`)
- Messages and comments → Collaboration repository: persists messages
- FastAPI application → Redis: initializes pool (evidence: `backend/main.py`)
