# montymobile1/devdox-ai-portal-api architecture

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

- Interactive diagram: https://gitdiagram.com/montymobile1/devdox-ai-portal-api
- Repository: https://github.com/montymobile1/devdox-ai-portal-api

## Overview

DevDox AI Portal API serves the portal’s user-management and development workflows: authenticate requests, manage Git credentials, browse/select repositories, and request repository analysis. Routes delegate to domain services; repository analysis records pending state and enqueues processing work. The graph also preserves documented preference storage and token-usage analytics, whose implementation is not shown in the sampled source. Relationships use the README and source-index references; unshown integration details are omitted rather than inferred.

Main entry points: [`devdox/app/routes`](https://github.com/montymobile1/devdox-ai-portal-api/tree/main/devdox/app/routes) (API routes), [`devdox/app/main.py`](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/main.py) (FastAPI application), [`devdox/app/services/git_tokens.py`](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/services/git_tokens.py) (Git token management), [`devdox/app/services/repository.py`](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/services/repository.py) (Repository services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and contracts"]
  node_app["FastAPI application<br/>[main.py]"]
  node_routes["API routes"]
  node_schemas["Request and response schemas"]
  node_responses["Response formatting<br/>[api_response.py]"]
  node_errors["Exception handling"]
end

subgraph group_identity["Identity and credentials"]
  node_auth["Request authentication<br/>[auth.py]"]
  node_webhooks["User webhooks<br/>[webhooks.py]"]
  node_git_tokens["Git token management<br/>[git_tokens.py]"]
  node_encryption["Secret encryption<br/>[encryption.py]"]
end

subgraph group_repositories["Repository workflow"]
  node_repo_service["Repository services<br/>[repository.py]"]
  node_git_manager["Provider selection<br/>[git_managers.py]"]
  node_analysis_queue["Analysis job queue<br/>[supabase_queue.py]"]
end

subgraph group_platform["Persistence and integrations"]
  node_supabase[("Supabase storage")]
  node_preferences["User preferences"]
  node_usage["Token usage analytics"]
end

node_portal(("Portal frontend"))
node_clerk["Clerk identity service"]
node_git_providers["Git providers"]
node_context["Context generation service"]

node_portal -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_routes
node_routes -->|"authenticates requests"| node_auth
node_routes -->|"validates payloads"| node_schemas
node_routes -->|"formats responses"| node_responses
node_app -->|"registers handlers"| node_errors
node_auth -->|"verifies identity"| node_clerk
node_routes -->|"delegates token management"| node_git_tokens
node_git_tokens -->|"encrypts credentials"| node_encryption
node_git_tokens -->|"validates provider token"| node_git_providers
node_routes -->|"delegates repository work"| node_repo_service
node_repo_service -->|"selects provider components"| node_git_manager
node_repo_service -->|"enqueues analysis"| node_analysis_queue
node_webhooks -->|"creates user records"| node_supabase
node_webhooks -->|"encrypts user salt"| node_encryption
node_app -->|"persists portal data"| node_supabase
node_analysis_queue -->|"queues analysis tasks"| node_context
node_preferences -->|"stores preferences"| node_supabase
node_usage -->|"stores usage data"| node_supabase

click node_app "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/main.py"
click node_routes "https://github.com/montymobile1/devdox-ai-portal-api/tree/main/devdox/app/routes"
click node_schemas "https://github.com/montymobile1/devdox-ai-portal-api/tree/main/devdox/app/schemas"
click node_responses "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/utils/api_response.py"
click node_errors "https://github.com/montymobile1/devdox-ai-portal-api/tree/main/devdox/app/exceptions"
click node_auth "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/utils/auth.py"
click node_webhooks "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/routes/webhooks.py"
click node_git_tokens "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/services/git_tokens.py"
click node_encryption "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/utils/encryption.py"
click node_repo_service "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/services/repository.py"
click node_git_manager "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/utils/git_managers.py"
click node_analysis_queue "https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/services/supabase_queue.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_routes,node_schemas,node_responses,node_errors,node_portal toneBlue
class node_auth,node_webhooks,node_git_tokens,node_encryption toneAmber
class node_repo_service,node_git_manager,node_analysis_queue toneMint
class node_supabase,node_preferences,node_usage toneRose
class node_clerk,node_git_providers,node_context toneIndigo
```

## Components

### API and contracts

- [FastAPI application](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/main.py): `devdox/app/main.py`
- [API routes](https://github.com/montymobile1/devdox-ai-portal-api/tree/main/devdox/app/routes): `devdox/app/routes`
- [Request and response schemas](https://github.com/montymobile1/devdox-ai-portal-api/tree/main/devdox/app/schemas): `devdox/app/schemas`
- [Response formatting](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/utils/api_response.py): `devdox/app/utils/api_response.py`
- [Exception handling](https://github.com/montymobile1/devdox-ai-portal-api/tree/main/devdox/app/exceptions): `devdox/app/exceptions`

### Identity and credentials

- [Request authentication](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/utils/auth.py): `devdox/app/utils/auth.py`
- [User webhooks](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/routes/webhooks.py): `devdox/app/routes/webhooks.py`
- [Git token management](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/services/git_tokens.py): `devdox/app/services/git_tokens.py`
- [Secret encryption](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/utils/encryption.py): `devdox/app/utils/encryption.py`

### Repository workflow

- [Repository services](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/services/repository.py): `devdox/app/services/repository.py`
- [Provider selection](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/utils/git_managers.py): `devdox/app/utils/git_managers.py`
- [Analysis job queue](https://github.com/montymobile1/devdox-ai-portal-api/blob/main/devdox/app/services/supabase_queue.py): `devdox/app/services/supabase_queue.py`

### Persistence and integrations

- **Supabase storage**
- **User preferences**
- **Token usage analytics**

### Other components

- **Portal frontend**
- **Clerk identity service**
- **Git providers**
- **Context generation service**

## Connections

- Portal frontend → FastAPI application: sends requests (evidence: `README.md`)
- FastAPI application → API routes: mounts routes (evidence: `devdox/app/main.py`)
- API routes → Request authentication: authenticates requests (evidence: `devdox/app/routes/repos.py`)
- API routes → Request and response schemas: validates payloads (evidence: `devdox/app/routes/repos.py`)
- API routes → Response formatting: formats responses (evidence: `devdox/app/routes/repos.py`)
- FastAPI application → Exception handling: registers handlers (evidence: `devdox/app/main.py`)
- Request authentication → Clerk identity service: verifies identity (evidence: `devdox/app/utils/auth.py`)
- API routes → Git token management: delegates token management (evidence: `devdox/app/routes/git_tokens.py`)
- Git token management → Secret encryption: encrypts credentials (evidence: `devdox/app/services/git_tokens.py`)
- Git token management → Git providers: validates provider token (evidence: `devdox/app/services/git_tokens.py`)
- API routes → Repository services: delegates repository work (evidence: `devdox/app/routes/repos.py`)
- Repository services → Provider selection: selects provider components (evidence: `devdox/app/services/repository.py`)
- Repository services → Analysis job queue: enqueues analysis (evidence: `devdox/app/services/repository.py`)
- User webhooks → Supabase storage: creates user records (evidence: `devdox/app/routes/webhooks.py`)
- User webhooks → Secret encryption: encrypts user salt (evidence: `devdox/app/routes/webhooks.py`)
- FastAPI application → Supabase storage: persists portal data (evidence: `README.md`)
- Analysis job queue → Context generation service: queues analysis tasks (evidence: `README.md`)
- User preferences → Supabase storage: stores preferences (evidence: `README.md`)
- Token usage analytics → Supabase storage: stores usage data (evidence: `README.md`)
