Granian

A fast Rust HTTP server for Python that serves ASGI, WSGI, and RSGI applications

Tool
PyPI
v2.8.1
5,557stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity100
Maintenance100
Community56
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
87/100Excellent
Architecture90
Code Quality88
Innovation86
Learning Curve82

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

Python
84%
MIT

LiteLLM

AI Development · Developer Tools

56,720

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.

View details
92
Repo Health
81
Technical
71
Dependency
Built with
Python84%
TypeScript14%
Updated today
Python
61%
GPL 3.0

Paperless-ngx

Bookmarks Archiving

44,394

Turn your paper pile into a searchable digital archive with OCR, AI classification, and automated workflows — all running on your own server.

View details
91
Repo Health
88
Technical
70
Dependency
Built with
Python61%
TypeScript30%
Updated today
Python
55%
Other

PostHog

Analytics · Monitoring · Developer Tools

37,777

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.

View details
92
Repo Health
80
Technical
67
Dependency
Built with
Python55%
TypeScript36%
Updated today
Python
58%
Other

Sentry

Security · Developer Tools · Monitoring

44,574

Developer-first error tracking and performance monitoring platform with AI-powered root-cause analysis across 20+ languages and frameworks.

View details
95
Repo Health
80
Technical
70
Dependency
Built with
Python58%
TypeScript41%
Updated today
Python
91%
GPL 3.0

Weblate

Developer Tools

6,028

Continuous localization platform that commits translations directly into your version control system with full translator attribution.

View details
95
Repo Health
86
Technical
74
Dependency
Built with
Python91%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search