Skip to main content

fastapi-xkit

FastAPI-XKit is a production toolkit for FastAPI.

Features (v0.2.0)

  • Redis rate limiter backend
  • JWT authentication dependency
  • RBAC (role-based access control) dependency
  • Audit logs written to SQL database (SQLAlchemy)
  • OpenTelemetry ASGI instrumentation + OTLP exporter
  • Request-ID middleware
  • /health endpoint

Install

pip install fastapi-xkit

Quick Example

from fastapi import FastAPI, Depends
from fastapixkit import FastAPIXKitConfig, setup_fastapixkit
from fastapixkit.security.jwt import require_jwt_user
from fastapixkit.security.rbac import require_role

app = FastAPI()

config = FastAPIXKitConfig(
    jwt_secret="supersecret",
    redis_url="redis://localhost:6379/0",
    audit_db_url="sqlite:///./audit.db",
    otel_enabled=False,
)

setup_fastapixkit(app, config)

@app.get("/secure")
def secure(user=Depends(require_jwt_user(config))):
    return {"user": user}

@app.get("/admin")
def admin(user=Depends(require_role(config, "admin"))):
    return {"ok": True, "admin": user}

JWT payload format

Expected fields:

  • sub (user id)
  • roles (list of strings)

Example:

{"sub":"123","roles":["admin","user"]}

OpenTelemetry

If otel_enabled=True, the middleware exports traces to OTLP endpoint.

Default OTLP endpoint: http://localhost:4318

Rate limiting

Redis counter per IP per minute.

License

MIT

Metadata

Release files for fastapi-xkit 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastapi-xkit 2.0.2
File Size Uploaded Provenance Actions
fastapi_xkit-2.0.2.tar.gz 6.1 kB With provenance Details for fastapi_xkit-2.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-xkit 2.0.2
File Interpreter ABI Platform Actions
fastapi_xkit-2.0.2-py3-none-any.whl Python 3 none any Details for fastapi_xkit-2.0.2-py3-none-any.whl

Total release size: 13.5 kB

Release files / fastapi_xkit-2.0.2.tar.gz

Download URL fastapi_xkit-2.0.2.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b66a6b1e423080c0bb78d562fa6ae26c9f0abb73f7f5c197a2d72bf3f67735cd
BLAKE2b-256 checksum
How to use checksums
1b12ae7751533294c65603a33e5fe2db081dd98b594885a50f0c09026aab33e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.

Transparency log

Release files / fastapi_xkit-2.0.2-py3-none-any.whl

Download URL fastapi_xkit-2.0.2-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3201cd1dcf20c16e7851d7aaf967a6995a9690aad48ae0709670b02f28060e4
BLAKE2b-256 checksum
How to use checksums
7f7dd343f8a4135e74c518fdda0e83f8eb2c9081c772ca088bedb42d3ae62056
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.

Transparency log

Security for fastapi-xkit 2.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fastapi_xkit-2.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page