A production-style API infrastructure platform that enforces rate limiting, idempotency, and asynchronous job execution in front of backend APIs.
- Protects core APIs from overload
- Prevents duplicate requests
- Offloads heavy work asynchronously
- Client → platform-service → core-service
- Platform Service:
- Sync path (/orders)
- Async path (/orders/process)
- Redis → rate limiting + sync idempotency
- PostgreSQL → async task state
- RabbitMQ + Celery → background execution
- Core Service → simulates real business API
- Streamlit → monitoring UI
-
Core Service — Execution Layer
- Owns business logic
- Executes orders
- Stateless and unaware of infra concerns
-
Platform Service — Policy & Control Layer
- Enforces rate limits
- Handles idempotency
- Orchestrates async execution
- Protects and shields core-service
-
Sync flow (/orders)
- Client sends request
- Platform checks Redis idempotency
- Rate limit enforced
- Forwarded to core-service
- Response returned immediately
-
Async flow (/orders/process)
- Client sends request
- Platform writes task to DB (QUEUED)
- Task enqueued to Celery
- Worker processes task
- Core-service called
- DB updated (SUCCESS / FAILED)
- Client polls /tasks/{task_id}
- POST /orders
- POST /orders/process
- GET /tasks/{task_id}
- FastAPI
- Redis
- PostgreSQL
- Celery
- RabbitMQ
- Streamlit
- Docker (coming next)
- Clone the repo
git clone https://github.com/yshvrd/Production-Grade-API-Infrastructure-Platform
cd Production-Grade-API-Infrastructure-Platform- Create and run a virtual environment
python3 -m venv .venv
source .venv/bin/activate- Install dependencies
pip install -r requirements.txt- Start infrastructure services
brew install redis rabbitmq
brew services start redis
brew services start rabbitmq - Run database and create table
docker run --name platform-postgres \
-e POSTGRES_USER=platform \
-e POSTGRES_PASSWORD=platform \
-e POSTGRES_DB=platform_db \
-p 5432:5432 \
-d postgres:16cd backend/platform-service
python -m db.create_table- start core-service
cd backend/core-service
uvicorn app:app --port 8001- Start platform-service
cd backend/platform-service
uvicorn app:app --port 8000- Start celery worker
cd backend/platform-service
celery -A celery_app worker --loglevel=info
- Start frontend (UI)
cd frontend
streamlit run app.py
- Interact with the app
http://localhost:8501- Services are designed to be containerized independently
- Dockerfiles exist for individual services (incomplete for production. When run individually, containers will start but will not be fully functional)
- Full orchestration intentionally deferred
- Authentication not implemented
- Docker Compose deferred
- No metrics dashboard
- Async retries implemented, but no dead-letter queues
- No distributed tracing (OpenTelemetry)
- Secrets managed via env vars for simplicity










