# Overall System Architecture
This diagram shows the complete system architecture with API Server Cluster, Compute Worker Cluster, and their interactions with the database and external services.
```mermaid
graph TB
subgraph "Monorepo Structure"
subgraph "API Server Cluster"
API1[Managing.Api
API-1
Orleans]
API2[Managing.Api
API-2
Orleans]
API3[Managing.Api
API-3
Orleans]
end
subgraph "Compute Worker Cluster"
W1[Managing.Compute
Worker-1
8 cores, 6 jobs]
W2[Managing.Compute
Worker-2
8 cores, 6 jobs]
W3[Managing.Compute
Worker-3
8 cores, 6 jobs]
end
subgraph "Shared Projects"
APP[Managing.Application
Business Logic]
DOM[Managing.Domain
Domain Models]
INFRA[Managing.Infrastructure
Database Access]
end
end
subgraph "External Services"
DB[(PostgreSQL
Job Queue)]
INFLUX[(InfluxDB
Candles)]
end
subgraph "Clients"
U1[User 1]
U2[User 2]
U1000[User 1000]
end
U1 --> API1
U2 --> API2
U1000 --> API3
API1 --> DB
API2 --> DB
API3 --> DB
W1 --> DB
W2 --> DB
W3 --> DB
W1 --> INFLUX
W2 --> INFLUX
W3 --> INFLUX
API1 -.uses.-> APP
API2 -.uses.-> APP
API3 -.uses.-> APP
W1 -.uses.-> APP
W2 -.uses.-> APP
W3 -.uses.-> APP
style API1 fill:#4A90E2
style API2 fill:#4A90E2
style API3 fill:#4A90E2
style W1 fill:#50C878
style W2 fill:#50C878
style W3 fill:#50C878
style DB fill:#FF6B6B
style INFLUX fill:#FFD93D
```
## Components
- **API Server Cluster**: Handles HTTP requests, creates jobs, returns immediately
- **Compute Worker Cluster**: Processes CPU-intensive backtest jobs
- **PostgreSQL**: Job queue and state management
- **InfluxDB**: Time-series data for candles
- **Shared Projects**: Common business logic used by both API and Compute services