{% extends "main.html" %}
{% block tabs %}
{{ super() }}
Buraq brings Django's developer experience — ORM, admin, forms, CBVs — to the modern
async ecosystem, built on FastAPI and SQLAlchemy 2.0.
The async Python framework
you already know how to usefrom buraq import Buraq
from buraq import models
from buraq.shortcuts import render
app = Buraq(settings_module="config.settings")
class Post(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
created = models.DateTimeField(auto_now_add=True)
@app.get("/posts/")
async def post_list(request):
posts = await Post.objects.filter(is_published=True).order_by("-created")
return render(request, "posts/list.html", {"posts": posts})
Why Buraq
Stop choosing between developer ergonomics and async performance. Buraq gives you both without compromise.
SQLAlchemy rolls back the entire transaction automatically when an exception occurs mid-request —
no partial writes, no corrupt state. Django requires ATOMIC_REQUESTS or
explicit @transaction.atomic decorators to get the same safety.
Every view, ORM call, form validator, and signal handler is natively async.
No sync_to_async(), no asyncio.run() hacks.
One event loop, zero thread overhead.
A rich, browser-based debug page — source context, local variables per frame,
full request headers — shown automatically when DEBUG = True.
No third-party tools needed.
Model.objects.filter(), Q objects, F expressions,
select_related, signals, and get_or_404 — powered by
SQLAlchemy 2.0 async under the hood.
A full CRUD admin at /admin — list, filter, search, create, edit, delete —
bundled inside Buraq. No sqladmin dependency, no extra setup.
Auto-generate forms from model columns with field-level and cross-field async validation. CSRF protection built in.
ListView, DetailView, CreateView,
UpdateView, DeleteView — the same CBV patterns Django developers
already know.
Automatic OpenAPI docs at /api/docs, Pydantic integration,
dependency injection, and full Starlette middleware compatibility — for free.
Ships with Granian — a Rust-based
ASGI server that outperforms uvicorn and hypercorn in benchmarks.
buraq runserver just works.
Built-in user model, login_required, permission_required,
groups, and JWT-based session management — no extra packages.
Django-style internationalization with gettext, translatable model fields,
and per-request locale switching.
startproject, startapp, migrate,
makemigrations, createsuperuser, collectstatic —
everything you expect from a batteries-included framework.
Comparison
The best of Django and FastAPI, without the tradeoffs of either.
| Feature | Django | FastAPI | Buraq |
|---|---|---|---|
| Async-first ORM | ✗ | ✗ | ✓ |
| Auto transaction rollback on error | opt-in | ✗ | ✓ |
| Django-style ORM API | ✓ | ✗ | ✓ |
| Admin panel | ✓ | ✗ | ✓ |
| ModelForm & validation | ✓ | ✗ | ✓ |
| Class-based views | ✓ | ✗ | ✓ |
| Auto OpenAPI docs | ✗ | ✓ | ✓ |
| Type safety | partial | ✓ | ✓ |
| No sync wrappers needed | ✗ | ✓ | ✓ |
| Built-in debug error page | ✓ | ✗ | ✓ |
| manage.py CLI | ✓ | ✗ | ✓ |
AI-Ready
Buraq's async-first design means every part of your stack — API calls, database writes, background jobs — runs concurrently without blocking. Ship AI-powered apps faster.
Await OpenAI, Anthropic, or any async AI SDK directly in your views.
No sync_to_async() — the event loop stays free while the model thinks.
FastAPI underneath gives you typed request/response schemas and live docs at
/api/docs — perfect for AI microservices and model inference endpoints.
Bundled Rust-based ASGI server handles hundreds of concurrent AI requests with lower latency than gunicorn or uvicorn. No extra install required.
Store chat history, embeddings, user preferences, and model outputs via the async ORM. Works with SQLite (dev), PostgreSQL, and MySQL out of the box.
Offload slow inference, document indexing, or embedding generation to
buraq worker background tasks — results written to the DB when ready.
Built-in user sessions, login_required, and rate limiting
(slowapi) — everything needed to secure a multi-user AI assistant.
from buraq import Buraq
from buraq.contrib.auth.decorators import login_required
from fastapi.responses import StreamingResponse
from anthropic import AsyncAnthropic
app = Buraq(settings_module="config.settings")
llm = AsyncAnthropic()
@app.post("/chat/")
@login_required
async def chat(request):
body = await request.json()
prompt = body["message"]
async def token_stream():
async with llm.messages.stream(
model="claude-opus-5",
max_tokens=1024,
messages=[{"role": "user", "content": prompt}],
) as stream:
async for text in stream.text_stream:
yield text
return StreamingResponse(token_stream(), media_type="text/plain")
One command sets up a full project with database, admin, and auth ready to go.
pip install buraq && buraq startproject myapp