Getting Started with Federation Service
The Federation Service handles GraphQL, REST, and gRPC federation across 1nga microservices.
Overview
The Federation Service provides:
- GraphQL Federation - Schema introspection, caching, and query routing
- REST Aggregation (future) - Combine REST endpoints from multiple services
- gRPC Federation (future) - Federate gRPC services
Features
- ✅ GraphQL schema introspection with caching
- ✅ Service discovery via Redis or static configuration
- ✅ Health checking and monitoring
- ✅ Schema caching in PostgreSQL
- ✅ Error handling and retry logic
- ✅ IAM header propagation from gateway
- ✅ MCP server for AI assistant integration
Prerequisites
- Python 3.11+
- PostgreSQL 14+
- Redis (for service discovery)
- Docker (optional)
Quick Start
- Local Setup
- Docker
# Navigate to federation service
cd shared/federation
# Install dependencies
uv pip install -e .
# Run migrations
alembic upgrade head
# Start service
uvicorn app.main:app --host 0.0.0.0 --port 8020 --reload
# Build and run with Docker Compose
cd infra
docker compose up federation
Environment Variables
# Database
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/federation_dev
# Redis (for service discovery)
REDIS_URL=redis://localhost:6379
# Service Configuration
HOST=0.0.0.0
PORT=8020
LOG_LEVEL=info
Service Endpoints
The Federation Service runs on port 8020 by default.
- Health Check:
GET http://localhost:8020/health - GraphQL Endpoint:
POST http://localhost:8020/api/graphql - Schema Introspection:
GET http://localhost:8020/api/schemas
Next Steps
- Read the API Reference for endpoint details
- Check Configuration for all available options
- See Architecture for system design
- Review Deployment guides for production setup