Skip to main content

A high-performance Django-like framework built on FastAPI

Project description

Buraq

A high-performance, batteries-included Python web framework — built for AI applications, high-traffic APIs, and developers who know Django.

Buraq delivers Rust-powered performance at every layer — Granian ASGI server, orjson, asyncpg, uv — with a complete full-stack framework: ORM, admin, forms, auth, migrations, templates, signals, cache, and email. All async, all fast.

If you know Django, you already know Buraq. Same views, same URLs, same templates, same ORM patterns — just add await. Built on FastAPI and SQLAlchemy 2.0 under the hood, so you get auto-generated API docs, Pydantic validation, and Rust-level performance out of the box.

PyPI version Python License: MIT CI


Why Buraq?

Modern applications — especially AI backends, LLM APIs, and real-time services — need a framework that handles thousands of concurrent requests without blocking. They also need the full stack: ORM, auth, admin, migrations, cache, and email — not just a router.

At the same time, Python web developers coming from Django shouldn't have to give up familiar patterns just to get async performance. Switching to a low-level async framework means losing everything Django provides out of the box.

Buraq solves both problems. A complete, batteries-included web framework with Rust-powered performance at every layer — and zero re-learning curve for Django developers.


Django Developers: Migrate in Minutes

Buraq is intentionally designed to mirror Django's API. Your existing knowledge transfers directly.

Django Buraq
from django.urls import path from buraq.urls import path
from django.shortcuts import render, redirect from buraq.shortcuts import render, redirect
from django.views.generic import ListView from buraq.views.generic import ListView
from django import forms from buraq.forms import ModelForm
from django.db import models from buraq import models
from django.contrib.auth.decorators import login_required from buraq.decorators import login_required
from django.contrib import messages from buraq.contrib.messages import success, error
python manage.py runserver buraq runserver
python manage.py makemigrations buraq makemigrations
python manage.py migrate buraq migrate
python manage.py startapp buraq startapp
python manage.py createsuperuser buraq createsuperuser
python manage.py collectstatic buraq collectstatic

The only difference: add async/await to your views and ORM calls.

# Django
def post_list(request):
    posts = Post.objects.filter(published=True).order_by("-created_at")
    return render(request, "posts/list.html", {"posts": posts})

# Buraq — same pattern, truly async
async def post_list(request):
    posts = await Post.objects.filter(published=True).order_by("-created_at")
    return render(request, "posts/list.html", {"posts": posts})

Quick Start

pip install buraq
buraq startproject myproject
cd myproject
buraq migrate
buraq runserver

Visit http://127.0.0.1:8000 — your project is running.
Visit http://127.0.0.1:8000/api/docs — Swagger UI, auto-generated.


Everything Included

ORM & Database

from buraq import models

class Post(models.Model):
    title        = models.CharField(max_length=200)
    slug         = models.SlugField(unique=True)
    content      = models.TextField()
    is_published = models.BooleanField(default=False)
    created_at   = models.DateTimeField(auto_now_add=True)
    author       = models.ForeignKey("auth.User", on_delete=models.CASCADE)
buraq makemigrations
buraq migrate

URLs

from buraq.urls import path, include

urlpatterns = [
    path("/posts",          views.PostListView.as_view(),   name="post_list"),
    path("/posts/new",      views.PostCreateView.as_view(), name="post_create"),
    path("/posts/<int:pk>", views.PostDetailView.as_view(), name="post_detail"),
    path("/api",            include("myapp.api_urls")),
]

Class-Based Views

from buraq.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView

class PostListView(ListView):
    model         = Post
    template_name = "posts/list.html"
    paginate_by   = 10

class PostCreateView(CreateView):
    model         = Post
    form_class    = PostForm
    template_name = "posts/form.html"
    success_url   = "/posts"

Function-Based Views

from buraq.shortcuts import render, redirect, get_object_or_404
from buraq.contrib.messages import success
from buraq.decorators import login_required

@login_required
async def post_create(request):
    form = PostForm(await request.form())
    if form.is_valid():
        await form.save()
        success(request, "Post created successfully.")
        return redirect("/posts")
    return render(request, "posts/form.html", {"form": form})

Forms & ModelForm

from buraq.forms import ModelForm, CharField, BooleanField

class PostForm(ModelForm):
    class Meta:
        model  = Post
        fields = ["title", "slug", "content", "is_published"]

Templates (Jinja2)

{% extends "base.html" %}

{% block content %}
  {% for post in posts %}
    <h2><a href="/posts/{{ post.id }}">{{ post.title }}</a></h2>
  {% endfor %}

  {% if messages %}
    {% for message in messages %}
      <div class="alert">{{ message }}</div>
    {% endfor %}
  {% endif %}
{% endblock %}

Authentication

from buraq.contrib.auth import authenticate, login, logout
from buraq.decorators import login_required

async def login_view(request):
    user = await authenticate(request, username=username, password=password)
    if user:
        await login(request, user)
        return redirect("/dashboard")

Signals

from buraq.signals import post_save

@post_save.connect(sender=Post)
async def on_post_saved(sender, instance, created, **kwargs):
    if created:
        await notify_subscribers(instance)

Cache

from buraq.contrib.cache import cache

await cache.set("key", value, timeout=300)
value = await cache.get("key")

Email

from buraq.contrib.email import send_mail

await send_mail(
    subject="Welcome to Buraq",
    message="Thanks for signing up.",
    to=["user@example.com"],
)

Performance

Buraq is built on the fastest available Python components at every layer:

Layer Library Benefit
ASGI server Granian (Rust) Faster than uvicorn on all platforms
Web framework FastAPI ASGI-native, Pydantic v2
Database driver asyncpg Fastest async PostgreSQL driver
ORM SQLAlchemy 2.0 Native async, no sync wrapper
JSON orjson (Rust) 3–10× faster than stdlib json
Password hashing Argon2id PHC winner — memory-hard, fast to verify
Package manager uv (Rust) 10–100× faster than pip

Features at a Glance

  • Async ORM with SQLAlchemy 2.0 — await Model.objects.filter(...)
  • Alembic migrationsburaq makemigrations / buraq migrate
  • path() URL routing with type-safe converters
  • Class-based views — ListView, DetailView, CreateView, UpdateView, DeleteView
  • ModelForm with field validation and await form.save()
  • Jinja2 templates with Django-compatible template tags
  • Built-in auth — JWT + session, login/register/logout
  • Auto admin panel via SQLAdmin — buraq createsuperuser
  • Flash messages backed by session storage
  • Signalspost_save, pre_delete, custom signals
  • Cache backends — Redis, Memcached, in-memory (all async)
  • Email backends — SMTP, console, file (all async)
  • Static files — WhiteNoise + buraq collectstatic
  • Rate limiting via SlowAPI
  • Security headers via the secure package
  • CORS middleware
  • orjson for all JSON responses
  • Granian ASGI server built-in, falls back to uvicorn
  • Auto API docs — Swagger UI and ReDoc at /api/docs

Documentation

Full documentation: buraqproject.com/docs/1.0


Contributing

See CONTRIBUTING.md — contributions are welcome.

Changelog

See CHANGELOG.md.

License

MIT — see LICENSE

Project details


Download files

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

Source Distribution

buraq-0.1.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

buraq-0.1.0-py3-none-any.whl (77.3 kB view details)

Uploaded Python 3

File details

Details for the file buraq-0.1.0.tar.gz.

File metadata

  • Download URL: buraq-0.1.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for buraq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 53cdde4e56e7610067df17cfb409e637b12ad9d39aefbfa93e8c7d59535524d5
MD5 5788b07a50bee8ba8f94273bb79f15b8
BLAKE2b-256 506bbe84dcc8bec29ae4e335142882f12a99b6308eb270abd4038263fff8c390

See more details on using hashes here.

File details

Details for the file buraq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: buraq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 77.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for buraq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea99bd69d105351172f6ac79bcd56913836fda9d477c54a34ecf5735e0e33f09
MD5 673179167955c2141062e01a30f837dc
BLAKE2b-256 f0685ea773f7530c754e8b91ed453fe298cdcbe835ea60d86e8f2f3b3b16505c

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 Pingdom Monitoring Sentry Error logging StatusPage Status page