← Back to all products

Python Microservices Kit

$49

Microservice scaffolds with gRPC, message queues, service discovery, circuit breakers, and distributed tracing.

📁 19 files🏷 v1.0.0
DockerJSONMarkdownPythonYAMLFastAPIRedis

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 19 files

python-microservices-kit/ ├── LICENSE ├── README.md ├── configs/ │ └── docker-compose.prod.yml ├── docker-compose.yml ├── guides/ │ └── microservices-patterns.md ├── services/ │ ├── api-gateway/ │ │ ├── Dockerfile │ │ └── main.py │ ├── order-service/ │ │ ├── Dockerfile │ │ ├── main.py │ │ └── models.py │ └── user-service/ │ ├── Dockerfile │ ├── main.py │ └── models.py ├── shared/ │ ├── events.py │ ├── health.py │ ├── service_client.py │ └── tracing.py └── tests/ └── test_integration.py

📖 Documentation Preview README excerpt

Python Microservices Kit

Production-ready microservices architecture with API gateway, service discovery, event-driven communication, and Docker orchestration.

What You Get

  • API Gateway with rate limiting, JWT auth, and request routing
  • User Service and Order Service as example bounded contexts
  • Shared library for events, service clients, health checks, and tracing
  • Docker Compose configs for dev and production
  • Integration tests covering cross-service workflows
  • Architecture guide explaining patterns and trade-offs

File Tree


python-microservices-kit/
├── README.md
├── manifest.json
├── LICENSE
├── docker-compose.yml
├── services/
│   ├── api-gateway/
│   │   ├── main.py              # Gateway with routing & rate limiting
│   │   └── Dockerfile
│   ├── user-service/
│   │   ├── main.py              # User CRUD + auth endpoints
│   │   ├── models.py            # User domain models
│   │   └── Dockerfile
│   └── order-service/
│       ├── main.py              # Order management endpoints
│       ├── models.py            # Order domain models
│       └── Dockerfile
├── shared/
│   ├── events.py                # Event bus & domain events
│   ├── service_client.py        # HTTP client with retries & circuit breaker
│   ├── health.py                # Health check protocol
│   └── tracing.py               # Distributed tracing with correlation IDs
├── configs/
│   └── docker-compose.prod.yml  # Production overrides
├── tests/
│   └── test_integration.py      # Cross-service integration tests
└── guides/
    └── microservices-patterns.md # Architecture patterns reference

Getting Started

1. Run with Docker Compose


docker-compose up --build

Services start on:

ServicePort
API Gateway8000

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

services/api-gateway/main.py"""API Gateway — single entry point for the microservices platform. Routes requests to downstream services, enforces rate limiting, validates JWT tokens, and injects correlation IDs for tracing. """ from __future__ import annotations import time from collections import defaultdict from contextlib import asynccontextmanager from typing import Any import httpx from fastapi import FastAPI, HTTPException, Request, Response from fastapi.responses import JSONResponse from shared.health import HealthAggregator, ServiceHealth from shared.tracing import CorrelationMiddleware, new_correlation_id # --------------------------------------------------------------------------- # Configuration # --------------------------------------------------------------------------- SERVICE_ROUTES: dict[str, str] = { "users": "http://user-service:8001", "orders": "http://order-service:8002", } RATE_LIMIT_WINDOW = 60 # seconds RATE_LIMIT_MAX = 100 # requests per window per IP # --------------------------------------------------------------------------- # Rate limiter (in-memory; swap for Redis in production) # --------------------------------------------------------------------------- class RateLimiter: """Sliding-window rate limiter keyed by client IP."""
Buy Now — $49 Back to Products