Skip to content

Latest commit

Β 

History

History
91 lines (68 loc) Β· 2.09 KB

File metadata and controls

91 lines (68 loc) Β· 2.09 KB

fastapi-xkit

FastAPI-XKit is a production toolkit for FastAPI.

FastAPI-XKit πŸš€

PyPI version Downloads License: MIT Python Versions

FastAPI-XKit is a production-grade FastAPI extension toolkit.

It provides: βœ… Redis-backed rate limiting
βœ… JWT authentication
βœ… RBAC permissions middleware
βœ… Audit logs stored to database
βœ… OpenTelemetry metrics/tracing
βœ… Health + metrics endpoints built-in

πŸš€ Designed for real apps β€” not just examples. Install pip install fastapi-xkit Quick Start from fastapi import FastAPI, Depends from fastapixkit import FastAPIXKit

app = FastAPI() kit = FastAPIXKit( jwt_secret="supersecret", redis_url="redis://localhost:6379", rbac_roles={ "admin": {"read", "write", "delete"}, "user": {"read"} }, )

kit.init_app(app)

@app.get("/secure") def secure(user=Depends(kit.auth.require_jwt())): return {"message": "Welcome!", "user": user} Features πŸ›‘οΈ JWT Auth

Fast token auth with easy user extraction.

πŸ” RBAC

Role-based access control middleware for routes.

🧠 Rate Limiting

Redis-powered, safe for containers and across nodes.

πŸ“Š Observability

OpenTelemetry exporter β†’ trace UI (Jaeger, Grafana Tempo).

πŸ“ Audit Logs

Logs are saved to PostgreSQL or any SQL via SQLAlchemy.

Example Endpoints GET /health GET /metrics GET /secure (JWT required) Configuration Example kit = FastAPIXKit( jwt_secret="MY_SECRET", redis_url="redis://127.0.0.1:6379/0", rbac_roles={ "admin": ["*"], "editor": ["read", "write"], } ) Ecosystem Integrations

βœ” FastAPI βœ” Starlette βœ” SQLAlchemy βœ” Redis βœ” OpenTelemetry (auto metrics + tracing)

Contributing

PRs are very welcome! See CONTRIBUTING.md

License

MIT