Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Django-Bolt Logo

PyPI version PyPI Downloads Ask DeepWiki Discord Sponsor

High-Performance Fully Typed API Framework for Django

Your first question might be: why? Well, consider this: Faster than FastAPI, but with Django ORM, Django Admin, and Django packages. That’s exactly what this project achieves. Django-Bolt is a high-performance API framework for Django, providing Rust-powered API endpoints capable of 188k+ RPS. Similar to Django REST Framework or Django Ninja, it integrates seamlessly with existing Django projects while leveraging Actix Web for HTTP handling, PyO3 to bridge Python async handlers with Rust's async runtime, and msgspec for fast serialization. You can deploy it directly—no gunicorn or uvicorn needed.

🚀 Quick Start

Installation 🎉

pip install django-bolt

📖 Full Documentation: bolt.farhana.li or if your prefer youtube video by BugBytes

⚠️ Note: Django-Bolt is under active development. Some features are not yet finalized.

Run Your First API

# myproject/api.py
from django_bolt import BoltAPI
from django.contrib.auth import get_user_model
import msgspec

User = get_user_model()

api = BoltAPI()

class UserSchema(msgspec.Struct):
    id: int
    username: str


@api.get("/users/{user_id}")
async def get_user(user_id: int) -> UserSchema: # 🎉 Response is type validated
    user = await User.objects.aget(id=user_id) # 🤯 Yes and Django orm works without any setup
    return {"id": user.id, "username": user.username} # or you could just return the queryset
# myproject/settings.py
INSTALLED_APPS = [
    ...
    "django_bolt"
    ...
]
# Start the server in dev mode
python manage.py runbolt --dev

Runtime environment variables

DJANGO_BOLT_MAX_PARAM_LENGTH

Maximum allowed size (in bytes) for path/query/form parameter values.

  • Default: 8192
  • Read once at startup: value is resolved and cached on first access
  • Fallback behavior: missing, empty, non-numeric, or 0 values fall back to 8192
export DJANGO_BOLT_MAX_PARAM_LENGTH=65536

Key Features:

  • 🚀 High Performance - Rust-powered HTTP server (Actix Web + Tokio + PyO3)
  • 🔐 Authentication - JWT/API Key validation in Rust without Python GIL
  • 🔒 Permissions & Guards - Route protection with IsAuthenticated and Requires claim checks
  • 🎛️ Middleware - CORS, rate limiting, compression, Django middleware integration
  • 📦 Serializers - msgspec-based validation (5-10x faster than stdlib)
  • 🎯 Django ORM - Full async ORM support with your existing models
  • 📡 Responses - JSON, HTML, streaming, SSE, file downloads
  • 📚 OpenAPI - Auto-generated docs (Swagger, ReDoc, Scalar, RapidDoc)
  • 🎨 Class-Based Views - ViewSet and ModelViewSet patterns
  • 🧪 Testing - Built-in test client for API testing

📊 Performance Benchmarks

📁 Resources: Example project available at python/example/. Run benchmarks with just save-bench or see scripts/benchmark.sh.

Standard Endpoints

Endpoint Type Requests/sec
Root endpoint ~188,100 RPS
JSON parsing/validation (10kb) ~128,400 RPS
Path + Query parameters ~163,200 RPS
HTML response ~164,100 RPS
Redirect response ~96,300 RPS
Form data handling ~143,900 RPS
ORM reads (SQLite, 10 records) ~14,800 RPS

Streaming Performance (Async)

Server-Sent Events (SSE) with 10,000 concurrent clients (60 Second load time):

  • Total Throughput: 9,489 messages/sec
  • Successful Connections: 10,000 (100%)
  • Avg Messages per Client: 57.3 messages
  • Data Transfer: 14.06 MB across test
  • CPU Usage: 11.9% average during test (peak: 101.9%)
  • Memory Usage: 236.1 MB

Note: Async streaming is recommended for high-concurrency scenarios (10k+ concurrent connections). It has no thread limits and can handle sustained load efficiently.

Why so fast?

  • HTTP Parsing and Response is handled by Actix-rs framework (one of the fastest in the world)
  • Request routing uses matchit (zero-copy path matching)
  • JSON serialization with msgspec (5-10x faster than stdlib)

🔧 Development

Setup

# Clone repository
git clone https://github.com/dj-bolt/django-bolt.git
cd django-bolt
# Install dependencies
uv sync
# Build Rust extension
just build  # or: maturin develop --release
# Run tests
just test-py
# for linting
just lint-lib

Commands

# Build
just build          # Build Rust extension
just rebuild        # Clean and rebuild

# Testing
just test-py        # Run Python tests

# Benchmarking
just save-bench     # Run and save results

🤝 Contributing

Contributions welcome! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (just test-py)
  5. Commit (git commit -m 'Add amazing feature')
  6. Push (git push origin feature/amazing-feature)
  7. Open a Pull Request

Areas That Need Help

  • Testing and fixing bugs
  • Add extension support (adding lifecycle events, making di comprehensive)
  • Cleaning up code.
  • More examples, tutorials, and docs.

💖 Sponsors

Support Django-Bolt's development by becoming a sponsor. Your logo will show up here with a link to your website.

Sponsors

Backers

Become a sponsor


🙏 Acknowledgments & Inspiration

Django-Bolt stands on the shoulders of giants. We're grateful to the following projects and communities that inspired our design and implementation:

Core Inspirations

  • Django REST Framework - Our syntax, ViewSet patterns, and permission system are heavily inspired by DRF's elegant API design. The class-based views and guard system follow DRF's philosophy of making common patterns simple.

  • FastAPI - We drew extensive inspiration from FastAPI's dependency injection system, parameter extraction patterns, and modern Python type hints usage. The codebase structure and async patterns heavily influenced our implementation.

  • Litestar - Our OpenAPI plugin system is adapted from Litestar's excellent architecture. Many architectural decisions around middleware, guards, and route handling were inspired by Litestar's design philosophy.

  • Robyn - Robyn's Rust-Python integration patterns and performance-first approach influenced our decision to use PyO3 and showed us the potential of Rust-powered Python web frameworks.

Additional Credits

  • Actix Web - The Rust HTTP framework that powers our performance
  • PyO3 - For making Rust-Python interop seamless
  • msgspec - For blazing-fast serialization
  • matchit - For zero-copy routing

Thank you to all the maintainers, contributors, and communities behind these projects. Django-Bolt wouldn't exist without your incredible work.


📄 License

Django-Bolt is open source and available under the MIT License.


For questions, issues, or feature requests, please visit our GitHub repository.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_bolt-0.10.0a2.tar.gz (15.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

django_bolt-0.10.0a2-cp312-abi3-win_amd64.whl (4.0 MB view details)

Uploaded CPython 3.12+Windows x86-64

django_bolt-0.10.0a2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

django_bolt-0.10.0a2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.3 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

django_bolt-0.10.0a2-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (8.1 MB view details)

Uploaded CPython 3.12+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file django_bolt-0.10.0a2.tar.gz.

File metadata

  • Download URL: django_bolt-0.10.0a2.tar.gz
  • Upload date:
  • Size: 15.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_bolt-0.10.0a2.tar.gz
Algorithm Hash digest
SHA256 ccb9775d1045ca23c121cb10e8727963e9bde4d4002bbe36434bfa88f7fd89b0
MD5 b11f16ffe4c1dc9b0f9d17442c13bdb3
BLAKE2b-256 56f61dfb3f79940bbed7125d13c40b6ca54834972cf2f5b2febe323f4d49227d

See more details on using hashes here.

File details

Details for the file django_bolt-0.10.0a2-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: django_bolt-0.10.0a2-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_bolt-0.10.0a2-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a275e8fc3a322945b490f0626b7851f89fb766c336a347e283fd1796a5ac8a44
MD5 109fcc15793c1b90e17454a7fc228520
BLAKE2b-256 c55ef1bf52319b1b3d7bda68a14af0d5c95fae1a11d1310615d1e43c714c93b7

See more details on using hashes here.

File details

Details for the file django_bolt-0.10.0a2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: django_bolt-0.10.0a2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: CPython 3.12+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_bolt-0.10.0a2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c2878d2b67896106ab52aa43a58f7b726b17123bc9b0b537fece15dc288c3d9d
MD5 dadb40bafd62f0175d5411950de16e71
BLAKE2b-256 a8f77717a4aacdc7362509d4842c0ab62287d15eaf438b71e383e6015dc6061e

See more details on using hashes here.

File details

Details for the file django_bolt-0.10.0a2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: django_bolt-0.10.0a2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.12+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_bolt-0.10.0a2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dc87fd26935d49046bfae46a55085c4349fe551b8946163d011953649076a652
MD5 3e63f722c25109b77f72ed803f5513e4
BLAKE2b-256 cff58b2918619a299f3a553fbfeace2b79ead700357f2d934018a032bd150aed

See more details on using hashes here.

File details

Details for the file django_bolt-0.10.0a2-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

  • Download URL: django_bolt-0.10.0a2-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
  • Upload date:
  • Size: 8.1 MB
  • Tags: CPython 3.12+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_bolt-0.10.0a2-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 fddca260712ce4d330bb3b25341ab17840f072416d39022a7c66e796e483aea1
MD5 c245bfba8f2a322c42e65b0d9cbb8f59
BLAKE2b-256 5f802aa2ab9218ad1047f503bbb6bde45f761be05565ae095768e7e16c1cd3b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page