- JWT-based authentication (OAuth2 ready)
- Token validation middleware
- Proxying/forwarding to internal services
- Request/response transformation
- Role/permission middleware
- Basic service health-check endpoints
Pull from Docker Hub:
docker pull theisaac/django_authentication_gateway:latest
- Python 3.9+
- Django 4.2+
- PostgreSQL / MySQL
# 1. Clone repo
git clone https://github.com/Mount-Isaac/django_authentication_gateway.git
cd django_authentication_gateway
# 2. Virtual environment
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate for Windows
# 3. Install deps
pip install -r requirements.txt
# 4. Configure env
cp .env.example .env
DEBUG=False
SECRET_KEY=your-django-secret
DATABASE_URL=postgres://user:password@localhost/db
JWT_SECRET_KEY=your-jwt-secret
Define services in config.yaml
or directly in settings.py
:
MICROSERVICES = {
'users': {
'url': 'http://users-service:5000',
'timeout': 15,
},
'orders': {
'url': 'http://orders-service:5001',
'timeout': 15,
}
}
POST /api/auth/token/
— get a JWT token- Add header:
Authorization: Bearer <token>
- Gateway validates token
- Routes request to correct microservice
Client → GET /users/profile/
Gateway → Auth → Proxy → http://users-service/profile/
- Use HTTPS in production
- Short-lived access tokens
- Rate limiting (via caching or middleware)
- Header sanitization
- IP + request logging
Endpoint | Description |
---|---|
/health/ |
Gateway health check |
/metrics/ |
Performance stats |
/services/status/ |
Microservice availability |
# Install dev tools
pip install -r requirements-dev.txt
# Run tests
python manage.py test
- Register it in
MICROSERVICES
config.yaml - Set up any auth or routing rules if needed
- Deploy and test
- Email: isadechair019@gmail.com
- WhatsApp: Chat Now
Start multiple Django apps at once:
for app in app1 app2 app3; do python manage.py startapp $app; done