Granian
A fast Rust HTTP server for Python that serves ASGI, WSGI, and RSGI applications
Repository Health
Technical Analysis
Granian is a Rust-based HTTP server for Python applications, built on top of Hyper and Tokio. It provides a single, self-contained dependency to serve ASGI, WSGI, and its own RSGI interface applications, replacing the usual Gunicorn + Uvicorn + http-tools stack.
Designed around a correct, unified HTTP implementation, Granian supports HTTP/1 and HTTP/2, HTTPS and mTLS, websockets, and direct static-file serving, with strong concurrency characteristics and high throughput across Linux, macOS, and Windows.
What You Get
- A single-dependency HTTP server binary distributed as a Python wheel for Linux, macOS, and Windows
- Support for ASGI/3, WSGI, and the native RSGI application interfaces
- HTTP/1 and HTTP/2 protocols with HTTPS and mTLS support
- Websockets and direct static-file serving out of the box
- A configurable CLI plus an embeddable Server API for programmatic control
Common Use Cases
- Serving FastAPI, Starlette, Django, or Flask applications in production
- Replacing a Gunicorn + Uvicorn worker setup with one dependency
- Serving Python apps over HTTP/2 with high throughput and websockets
- Running applications with mTLS or direct static-file delivery
Under The Hood
Architecture - Granian splits responsibilities across a Rust core (src/lib.rs, serve.rs, workers.rs, http.rs, ws.rs, tls.rs) that owns the HTTP/1 and HTTP/2 handling on top of Hyper and Tokio, and a thin Python layer (granian/server, granian/asgi.py, wsgi.py, rsgi.py, cli.py) that bridges incoming requests into the ASGI, WSGI, or RSGI callable and manages the worker process model.
Tech Stack - The server core is written in Rust using Hyper and Tokio and compiled into a Python extension via PyO3/maturin; the Python side depends only on click for its CLI, with optional extras for dotenv, process naming, reload, and alternative event loops (rloop, uvloop, winloop).
Code Quality - The repository ships a substantial pytest suite (test_asgi.py, test_wsgi.py, test_rsgi.py, test_ws.py, test_https.py, test_static_files.py, test_uds.py, and more) covering each interface and transport, alongside typed Python (py.typed, _granian.pyi stubs) and a modular Rust source tree, indicating a mature, well-tested codebase.
API Design - Usage centers on a single ergonomic CLI (granian —interface asgi main:app) with an embeddable Server class for programmatic control; configuration is exposed through well-named flags and options, and the documented ASGI/WSGI/RSGI contracts keep onboarding for existing Python web apps minimal.
Used by 5 apps in this directory
LiteLLM
AI Development · Developer Tools
Open source AI gateway and Python SDK that gives you one OpenAI-compatible interface to call 100+ LLM providers, with built-in routing, cost tracking, guardrails, and virtual keys.
Paperless-ngx
Bookmarks Archiving
Turn your paper pile into a searchable digital archive with OCR, AI classification, and automated workflows — all running on your own server.
PostHog
Analytics · Monitoring · Developer Tools
The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.
Sentry
Security · Developer Tools · Monitoring
Developer-first error tracking and performance monitoring platform with AI-powered root-cause analysis across 20+ languages and frameworks.
Weblate
Developer Tools
Continuous localization platform that commits translations directly into your version control system with full translator attribution.