# yshvrd/production-grade-api-infrastructure-platform architecture

> Architecture diagram of the GitHub repository yshvrd/production-grade-api-infrastructure-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yshvrd/production-grade-api-infrastructure-platform
- Repository: https://github.com/yshvrd/production-grade-api-infrastructure-platform

## Overview

This is an API protection and asynchronous execution platform. Clients submit synchronous orders through the platform’s Redis-backed rate-limit and idempotency checks, or submit asynchronous work that is recorded, queued, executed by a worker against the core service, and exposed through task polling. The Streamlit UI provides a monitoring surface. The graph preserves the documented PostgreSQL task-state and RabbitMQ/Celery roles; links for UI-to-platform behavior are unverified because the frontend source was not excerpted.

Main entry points: [`backend/platform-service/routes/orders.py`](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/routes/orders.py) (Order Endpoints), [`backend/platform-service/celery_app.py`](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/celery_app.py) (Task Worker), [`backend/platform-service/app.py`](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/app.py) (API Router), [`backend/platform-service/routes/tasks.py`](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/routes/tasks.py) (Task Polling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform API"]
  node_platform_app["API Router<br/>[app.py]"]
  node_order_routes["Order Endpoints<br/>[orders.py]"]
  node_task_routes["Task Polling<br/>[tasks.py]"]
  node_request_model["Request Schema<br/>[request.py]"]
  node_logging["Logging<br/>[logging_config.py]"]
end

subgraph group_async["Async Execution"]
  node_celery_task["Task Worker<br/>[celery_app.py]"]
end

subgraph group_state["State and Policy"]
  node_rate_limiter["Rate Limiter<br/>[rate_limiter.py]"]
  node_redis_client["Redis Client<br/>[redis_client.py]"]
  node_db_session["DB Sessions<br/>[session.py]"]
  node_task_model["Task Record<br/>[models.py]"]
end

subgraph group_business["Business Service"]
  node_core_service["Core API<br/>[app.py]"]
end

subgraph group_ui["Monitoring UI"]
  node_streamlit["Monitoring UI<br/>[app.py]"]
end

node_client(("API Client"))
node_redis[("Redis")]
node_postgres[("PostgreSQL")]
node_rabbitmq["RabbitMQ Broker"]

node_client -->|"submits requests"| node_platform_app
node_platform_app -->|"mounts routes"| node_order_routes
node_platform_app -->|"mounts routes"| node_task_routes
node_order_routes -->|"accepts schema"| node_request_model
node_order_routes -->|"checks limit"| node_rate_limiter
node_rate_limiter -->|"increments counter"| node_redis_client
node_order_routes -->|"checks idempotency"| node_redis_client
node_redis_client -->|"reads and writes"| node_redis
node_order_routes -->|"forwards sync order"| node_core_service
node_order_routes -->|"queries and saves tasks"| node_db_session
node_order_routes -->|"creates task"| node_task_model
node_task_routes -->|"opens session"| node_db_session
node_task_routes -->|"reads task status"| node_task_model
node_db_session -->|"connects to"| node_postgres
node_order_routes -->|"enqueues task"| node_celery_task
node_celery_task -->|"uses broker"| node_rabbitmq
node_celery_task -->|"loads and updates task"| node_db_session
node_celery_task -->|"updates lifecycle"| node_task_model
node_celery_task -->|"forwards async order"| node_core_service
node_client -->|"polls task"| node_task_routes
node_streamlit -.->|"monitors platform"| node_platform_app
node_order_routes -->|"logs requests"| node_logging
node_celery_task -->|"logs execution"| node_logging

click node_platform_app "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/app.py"
click node_order_routes "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/routes/orders.py"
click node_task_routes "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/routes/tasks.py"
click node_request_model "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/models/request.py"
click node_rate_limiter "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/rate_limiter.py"
click node_redis_client "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/redis_client.py"
click node_db_session "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/db/session.py"
click node_task_model "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/db/models.py"
click node_celery_task "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/celery_app.py"
click node_core_service "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/core-service/app.py"
click node_streamlit "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/frontend/app.py"
click node_logging "https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/logging_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_platform_app,node_order_routes,node_task_routes,node_request_model,node_logging,node_client toneBlue
class node_celery_task,node_redis,node_postgres toneAmber
class node_rate_limiter,node_redis_client,node_db_session,node_task_model toneMint
class node_core_service toneRose
class node_streamlit,node_rabbitmq toneIndigo
```

## Components

### Platform API

- [API Router](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/app.py): `backend/platform-service/app.py`
- [Order Endpoints](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/routes/orders.py): `backend/platform-service/routes/orders.py`
- [Task Polling](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/routes/tasks.py): `backend/platform-service/routes/tasks.py`
- [Request Schema](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/models/request.py): `backend/platform-service/models/request.py`
- [Logging](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/logging_config.py): `backend/platform-service/logging_config.py`

### Async Execution

- [Task Worker](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/celery_app.py): `backend/platform-service/celery_app.py`

### State and Policy

- [Rate Limiter](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/rate_limiter.py): `backend/platform-service/rate_limiter.py`
- [Redis Client](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/redis_client.py): `backend/platform-service/redis_client.py`
- [DB Sessions](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/db/session.py): `backend/platform-service/db/session.py`
- [Task Record](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/platform-service/db/models.py): `backend/platform-service/db/models.py`

### Business Service

- [Core API](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/backend/core-service/app.py): `backend/core-service/app.py`

### Monitoring UI

- [Monitoring UI](https://github.com/yshvrd/production-grade-api-infrastructure-platform/blob/main/frontend/app.py): `frontend/app.py`

### Other components

- **API Client**
- **Redis**
- **PostgreSQL**
- **RabbitMQ Broker**

## Connections

- API Client → API Router: submits requests (evidence: `README.md`)
- API Router → Order Endpoints: mounts routes (evidence: `backend/platform-service/app.py`)
- API Router → Task Polling: mounts routes (evidence: `backend/platform-service/app.py`)
- Order Endpoints → Request Schema: accepts schema (evidence: `backend/platform-service/routes/orders.py`)
- Order Endpoints → Rate Limiter: checks limit (evidence: `backend/platform-service/routes/orders.py`)
- Rate Limiter → Redis Client: increments counter (evidence: `backend/platform-service/rate_limiter.py`)
- Order Endpoints → Redis Client: checks idempotency (evidence: `backend/platform-service/routes/orders.py`)
- Redis Client → Redis: reads and writes (evidence: `backend/platform-service/redis_client.py`)
- Order Endpoints → Core API: forwards sync order (evidence: `backend/platform-service/routes/orders.py`)
- Order Endpoints → DB Sessions: queries and saves tasks (evidence: `backend/platform-service/routes/orders.py`)
- Order Endpoints → Task Record: creates task (evidence: `backend/platform-service/routes/orders.py`)
- Task Polling → DB Sessions: opens session (evidence: `backend/platform-service/routes/tasks.py`)
- Task Polling → Task Record: reads task status (evidence: `backend/platform-service/routes/tasks.py`)
- DB Sessions → PostgreSQL: connects to (evidence: `backend/platform-service/db/session.py`)
- Order Endpoints → Task Worker: enqueues task (evidence: `backend/platform-service/routes/orders.py`)
- Task Worker → RabbitMQ Broker: uses broker (evidence: `backend/platform-service/celery_app.py`)
- Task Worker → DB Sessions: loads and updates task (evidence: `backend/platform-service/celery_app.py`)
- Task Worker → Task Record: updates lifecycle (evidence: `backend/platform-service/celery_app.py`)
- Task Worker → Core API: forwards async order (evidence: `backend/platform-service/celery_app.py`)
- API Client → Task Polling: polls task (evidence: `README.md`)
- Monitoring UI → API Router: monitors platform
- Order Endpoints → Logging: logs requests (evidence: `backend/platform-service/routes/orders.py`)
- Task Worker → Logging: logs execution (evidence: `backend/platform-service/celery_app.py`)
