Skip to content

Django-Bolt

Django-Bolt is a high-performance API framework for Django. It lets you build APIs using familiar Django patterns while leveraging Rust for speed.

Installation

Install using pip:

pip install django-bolt

Or with uv:

uv add django-bolt

At a glance

Here's a simple API endpoint:

from django_bolt import BoltAPI

api = BoltAPI()

@api.get("/", summary="My first api endpoint 🤗")
async def hello():
    return {"message": "Hello, World!"}

Add django_bolt to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    ...
    "django_bolt",
]

Run it with:

python manage.py runbolt --dev

That's it. You now have an API endpoint at http://localhost:8000.

You also get automatic API documentation at http://localhost:8000/docs:

OpenAPI Swagger UI

Other documentation UIs are also available by default: Redoc (/docs/redoc), Scalar (/docs/scalar), RapiDoc (/docs/rapidoc), and Stoplight Elements (/docs/stoplight). See the OpenAPI documentation for customization options.

Why Django-Bolt?

Django-Bolt is designed for developers who:

  • Already know Django and want to build APIs quickly
  • Need high performance without leaving Python
  • Want type-safe request handling with automatic validation
  • Prefer async/await for I/O-bound operations

Key features

Simple routing - Decorator-based routing similar to FastAPI, Litestar and Flask:

@api.get("/users/{user_id}")
async def get_user(user_id: int):
    return {"user_id": user_id}

Automatic validation - Request data is validated using Python type hints:

import msgspec

class CreateUser(msgspec.Struct):
    username: str
    email: str

@api.post("/users")
async def create_user(user: CreateUser):
    return {"username": user.username}

Django integration - Works with your existing Django models and ORM:

from myapp.models import User

@api.get("/users")
async def list_users():
    users = await User.objects.all().acount()
    return {"count": users}

Built-in authentication - JWT and API key authentication out of the box:

from django_bolt.auth import JWTAuthentication, IsAuthenticated

@api.get("/profile", auth=[JWTAuthentication()], guards=[IsAuthenticated()])
async def profile(request):
    return {"user_id": request.user.id}

Next steps

Getting help