justapi Runtime
A production-grade Python web framework written in Rust. Rust owns the
network/protocol stack; Python executes only application logic.
10-20x faster than FastAPI β see BENCHMARKS.md.
Project Status
Phase 40 β The JustAPI 2.0 "Singularity" Release (ready for publish)
All 39 prior phases complete. CI/CD pipeline overhauled: uv-based builds, cargo-deny security audit, Miri memory safety, OIDC trusted publishing to PyPI. See PLAN.md for the full roadmap.
Architecture
Kernel β epoll/io_uring β Connection Manager β tokio task
β TLS (rustls) β HTTP parse (hyper) β Router (matchit)
β Middleware chain (Rust: auth/CORS/rate-limit/compression)
β Python boundary (typed, zero-copy request view via PyO3)
β Application code (native Python handler)
β Rust serializer (serde_json/simd-json)
β Response write β Socket
justapi provides a single native Python API (Tier B) β the FastAPI
replacement that runs entirely in Rust with zero-copy Python integration.
Quick Start
Python Native API
from justapi import JustAPIApp
app = JustAPIApp()
@app.get("/hello/{name}")
async def hello_handler(request):
name = request["path_params"]["name"]
return {"message": f"Hello {name}!"}
app.run("127.0.0.1:8080")
Install the package:
pip install justapi # via pip
uv pip install justapi # via uv (recommended)
uvx justapi create my_app # no install needed
Or build from source with maturin:
cd crates/justapi-py
maturin develop --release
CLI
# Run server with Rust-defined routes
justapi serve --addr 127.0.0.1:8080
# Generate a client SDK from your API
justapi gen-client --lang python
Features
| Area | Status |
|---|---|
| HTTP/1.1 & HTTP/2 | β 324k req/s hello-world |
| WebSocket & SSE | β Streaming, token-generation optimized |
| TLS (rustls) | β 10.7% overhead |
| Middleware | β CORS, SecurityHeaders, JWT, RateLimiter |
| JWT Auth | β RS256/ES256, per-route roles/scopes |
| Serialization | β serde_json, simd-json optional |
| Request Validation | β JSON Schema, Pydantic bridge |
| OpenAPI Generation | β
Auto-generated /docs and /redoc |
| Database ORM | β SQLite/PostgreSQL/MySQL via sqlx |
| gRPC | β Native Tonic integration |
| GraphQL | β async-graphql, Apollo Federation |
| Observability | β OTel tracing, Prometheus metrics, structured logging |
| Resilience | β Circuit breakers, retry, fallback, bulkhead |
| Rate Limiting | β GCRA algorithm, Redis-backed |
| WASM Middleware | β wasmtime embedded plugins |
| Agent DAG Engine | β DAG orchestration in Rust |
| Background Tasks | β Thread-safe task scheduling |
| Dependency Injection | β Litestar-style tiered DI |
| Snapshot Testing | β Built-in test utilities |
| Static Files | β Range requests, MIME detection |
| Compression | β gzip/deflate/brotli/zstd |
| Plugin System | β Third-party plugin API |
| Memory Safety | β Miri-verified unsafe blocks, 6 fuzz targets |
| Supply Chain Security | β cargo-deny v0.20 β advisories, bans, licenses, sources |
Development
Prerequisites
- Rust 1.85+ (edition 2021)
- Python 3.11+
Building
cargo build --workspace # debug build
cargo build --workspace --release # release build
cargo test --workspace # run all tests (493+)
cargo clippy --workspace --tests -- -D warnings # lint
cargo fmt --check # format check
cargo deny check # supply chain security audit
cargo miri test -p justapi-core # memory safety (nightly)
Benchmarking
See BENCHMARKS.md for methodology and results.
# Install load generator
cargo install oha
# Run baseline benchmarks
bash benchmarks/run_baselines.sh
Project Structure
crates/
justapi-core/ β networking, protocol, scheduler, memory
justapi-py/ β PyO3 bindings, native Python API
justapi-cli/ β `justapi` CLI binary
justapi-bench/ β internal benchmark harness
python/
justapi/ β pip-installable Python package
fuzz/ β cargo-fuzz targets (6 targets)
docs/ β documentation
skills/ β reusable knowledge modules for development
benchmarks/ β workload scripts for performance testing
Documentation
- PLAN.md β Living roadmap and current status
- AGENTS.md β Development rules and conventions
- DECISIONS.md β Architecture decision records
- BENCHMARKS.md β Performance results ledger
- docs/security/ β Security policies and pentest guide
- docs/plugins.md β Plugin development guide
License
MIT