# ojaswip2828/clouddeploy architecture

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

- Interactive diagram: https://gitdiagram.com/ojaswip2828/clouddeploy
- Repository: https://github.com/ojaswip2828/clouddeploy

## Overview

CloudDeploy is a mini-PaaS with an incident-diagnosis Copilot. Its main workflow is user authentication, app creation and ZIP upload, asynchronous deployment, then retrieval of deployment status and URL. Failed builds or crashes can open incidents; users can investigate, review agent proposals, approve or reject destructive actions, and resolve incidents so fixes can be indexed. The graph preserves the documented runbook search and configurable model/embedding providers. Some deployment and Copilot internals were not sampled; uncertain links are omitted or marked unverified.

Main entry points: [`backend/app/copilot/routes.py`](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/routes.py) (Incident API), [`backend/app/deploy/routes.py`](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/routes.py) (App and deployment API), [`backend/app/main.py`](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/auth/routes.py`](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/auth/routes.py) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and identity"]
  node_api["FastAPI application<br/>[main.py]"]
  node_auth["Authentication<br/>[routes.py]"]
  node_security["Token security<br/>[security.py]"]
end

subgraph group_deploy["App deployment"]
  node_deploy_routes["App and deployment API<br/>[routes.py]"]
  node_builder["Image build and run<br/>[builder.py]"]
  node_logs["Deployment logs<br/>[logs.py]"]
  node_monitor["Runtime monitor<br/>[monitor.py]"]
  node_operations["Deployment operations<br/>[operations.py]"]
end

subgraph group_copilot["Incident Copilot"]
  node_incidents["Incident lifecycle<br/>[incidents.py]"]
  node_copilot_routes["Incident API<br/>[routes.py]"]
  node_agent["Investigation agent<br/>[agent.py]"]
  node_tools["Agent tools<br/>[tools.py]"]
  node_rag["Runbook search and indexing<br/>[rag.py]"]
  node_embeddings["Embedding providers"]
  node_llm["LLM providers"]
end

subgraph group_storage["Persistence"]
  node_db[("Database session<br/>[db.py]")]
  node_models[("Domain records<br/>[models.py]")]
end

node_user(("Platform user"))
node_model_service{{"Hosted model services"}}
node_docker{{"Docker engine"}}

node_user -->|"uses"| node_api
node_api -->|"registers routes"| node_auth
node_api -->|"registers routes"| node_deploy_routes
node_api -->|"registers routes"| node_copilot_routes
node_api -->|"starts monitor"| node_monitor
node_auth -->|"uses tokens"| node_security
node_auth -->|"uses session"| node_db
node_auth -->|"reads and writes"| node_models
node_deploy_routes -->|"requires identity"| node_security
node_deploy_routes -->|"uses session"| node_db
node_deploy_routes -->|"reads and writes"| node_models
node_deploy_routes -->|"queues build"| node_builder
node_deploy_routes -->|"reads logs"| node_logs
node_deploy_routes -->|"returns status and URL"| node_user
node_builder -.->|"builds and runs"| node_docker
node_monitor -.->|"opens on failures"| node_incidents
node_copilot_routes -->|"requires identity"| node_security
node_copilot_routes -->|"starts investigation"| node_agent
node_copilot_routes -->|"opens and updates"| node_incidents
node_copilot_routes -->|"indexes resolution"| node_rag
node_copilot_routes -->|"selects embedder"| node_embeddings
node_copilot_routes -->|"selects model"| node_llm
node_copilot_routes -->|"executes approved actions"| node_operations
node_copilot_routes -->|"checks deployment ownership"| node_deploy_routes
node_copilot_routes -->|"uses session"| node_db
node_copilot_routes -->|"reads and writes"| node_models
node_agent -.->|"dispatches tools"| node_tools
node_agent -.->|"searches knowledge"| node_rag
node_agent -.->|"requests completions"| node_model_service
node_llm -.->|"calls provider"| node_model_service
node_embeddings -.->|"creates vectors"| node_model_service
node_rag -->|"embeds runbooks"| node_embeddings

click node_api "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/main.py"
click node_auth "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/auth/routes.py"
click node_security "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/auth/security.py"
click node_db "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/db.py"
click node_models "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/models.py"
click node_deploy_routes "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/routes.py"
click node_builder "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/builder.py"
click node_logs "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/logs.py"
click node_monitor "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/monitor.py"
click node_operations "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/operations.py"
click node_incidents "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/incidents.py"
click node_copilot_routes "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/routes.py"
click node_agent "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/agent.py"
click node_tools "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/tools.py"
click node_rag "https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/rag.py"
click node_embeddings "https://github.com/ojaswip2828/clouddeploy/tree/main/backend/app/copilot/embeddings"
click node_llm "https://github.com/ojaswip2828/clouddeploy/tree/main/backend/app/copilot/llm"

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_api,node_auth,node_security,node_user toneBlue
class node_deploy_routes,node_builder,node_logs,node_monitor,node_operations toneAmber
class node_incidents,node_copilot_routes,node_agent,node_tools,node_rag,node_embeddings,node_llm toneMint
class node_db,node_models toneRose
class node_model_service,node_docker toneIndigo
```

## Components

### API and identity

- [FastAPI application](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/auth/routes.py): `backend/app/auth/routes.py`
- [Token security](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/auth/security.py): `backend/app/auth/security.py`

### App deployment

- [App and deployment API](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/routes.py): `backend/app/deploy/routes.py`
- [Image build and run](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/builder.py): `backend/app/deploy/builder.py`
- [Deployment logs](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/logs.py): `backend/app/deploy/logs.py`
- [Runtime monitor](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/monitor.py): `backend/app/deploy/monitor.py`
- [Deployment operations](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/deploy/operations.py): `backend/app/deploy/operations.py`

### Incident Copilot

- [Incident lifecycle](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/incidents.py): `backend/app/copilot/incidents.py`
- [Incident API](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/routes.py): `backend/app/copilot/routes.py`
- [Investigation agent](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/agent.py): `backend/app/copilot/agent.py`
- [Agent tools](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/tools.py): `backend/app/copilot/tools.py`
- [Runbook search and indexing](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/copilot/rag.py): `backend/app/copilot/rag.py`
- [Embedding providers](https://github.com/ojaswip2828/clouddeploy/tree/main/backend/app/copilot/embeddings): `backend/app/copilot/embeddings`
- [LLM providers](https://github.com/ojaswip2828/clouddeploy/tree/main/backend/app/copilot/llm): `backend/app/copilot/llm`

### Persistence

- [Database session](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/db.py): `backend/app/db.py`
- [Domain records](https://github.com/ojaswip2828/clouddeploy/blob/main/backend/app/models.py): `backend/app/models.py`

### Other components

- **Platform user**
- **Hosted model services**
- **Docker engine**

## Connections

- Platform user → FastAPI application: uses
- FastAPI application → Authentication: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → App and deployment API: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Incident API: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Runtime monitor: starts monitor (evidence: `backend/app/main.py`)
- Authentication → Token security: uses tokens (evidence: `backend/app/auth/routes.py`)
- Authentication → Database session: uses session (evidence: `backend/app/auth/routes.py`)
- Authentication → Domain records: reads and writes (evidence: `backend/app/auth/routes.py`)
- App and deployment API → Token security: requires identity (evidence: `backend/app/deploy/routes.py`)
- App and deployment API → Database session: uses session (evidence: `backend/app/deploy/routes.py`)
- App and deployment API → Domain records: reads and writes (evidence: `backend/app/deploy/routes.py`)
- App and deployment API → Image build and run: queues build (evidence: `backend/app/deploy/routes.py`)
- App and deployment API → Deployment logs: reads logs (evidence: `backend/app/deploy/routes.py`)
- App and deployment API → Platform user: returns status and URL
- Image build and run → Docker engine: builds and runs
- Runtime monitor → Incident lifecycle: opens on failures
- Incident API → Token security: requires identity (evidence: `backend/app/copilot/routes.py`)
- Incident API → Investigation agent: starts investigation (evidence: `backend/app/copilot/routes.py`)
- Incident API → Incident lifecycle: opens and updates (evidence: `backend/app/copilot/routes.py`)
- Incident API → Runbook search and indexing: indexes resolution (evidence: `backend/app/copilot/routes.py`)
- Incident API → Embedding providers: selects embedder (evidence: `backend/app/copilot/routes.py`)
- Incident API → LLM providers: selects model (evidence: `backend/app/copilot/routes.py`)
- Incident API → Deployment operations: executes approved actions (evidence: `backend/app/copilot/routes.py`)
- Incident API → App and deployment API: checks deployment ownership (evidence: `backend/app/copilot/routes.py`)
- Incident API → Database session: uses session (evidence: `backend/app/copilot/routes.py`)
- Incident API → Domain records: reads and writes (evidence: `backend/app/copilot/routes.py`)
- Investigation agent → Agent tools: dispatches tools
- Investigation agent → Runbook search and indexing: searches knowledge
- Investigation agent → Hosted model services: requests completions
- LLM providers → Hosted model services: calls provider
- Embedding providers → Hosted model services: creates vectors
- Runbook search and indexing → Embedding providers: embeds runbooks (evidence: `backend/scripts/ingest_runbooks.py`)
