S
swadhinbiswas
πŸ—‘οΈ chore: remove placeholder article files β€” real article lives on blog.swadhin.cv
committed 2 months ago
.cargo πŸ”§ fix: CI/CD remaining issues 2 months ago
.github πŸš€ ci: pin wrangler version in docs deploy action 2 months ago
.well-known docs: add MkDocs site with API reference, migration guide, and security docs 3 months ago
assets 🎨 docs: replace features SVG with new PNG (imagejustapi) 2 months ago
benchmarks p0: production hardening sweep β€” 19 fixes (WASM OOM, mutex poisoning, GIL pool deadlock, envelope detection, SQLite pragmas, traversal, credentials, etc.) 3 months ago
crates πŸš€ release: 2.0.10 β€” full CLI in PyPI wheel (fixes broken justapi command) 2 months ago
demo_shop πŸ“¦ ci: add cargo-deny/miri/pytest to CI, create publish workflow 3 months ago
deploy infra: add Dockerfile, Helm chart, and multi-cloud deployment guides 3 months ago
docs πŸš€ release: 2.0.8 β€” write-path fix (ADR-080), fork-safe GIL pool (ADR-081), HTTP/3 (ADR-082), Security DI fix, docs honesty pass 2 months ago
docs_site 🎨 docs: full WebTUI redesign β€” 8-bit terminal palette, custom navbar, nerd font icons, catppuccin/everforest/nord themes, terminal landing 2 months ago
examples πŸš€ release: 2.0.8 β€” write-path fix (ADR-080), fork-safe GIL pool (ADR-081), HTTP/3 (ADR-082), Security DI fix, docs honesty pass 2 months ago
fuzz πŸ“¦ v2.0.8: security fixes, documentation, testing improvements 2 months ago
helm 🐳 p62: deployment hardening β€” Docker HEALTHCHECK + K8s PodDisruptionBudget 2 months ago
scripts πŸš€ ci: PyPI publishing via OIDC trusted publishing β€” fixed uv publish command, GH release in-pipeline, removed dead publish.yml 2 months ago
skills docs: add reusable skill modules for benchmarks and FFI safety 3 months ago
test_project docs(examples): add 10 progressive tutorial examples and test project 3 months ago
tests test: add end-to-end integration test suite with gRPC and proto stubs 3 months ago
website feat(website): add project landing page with benchmarks and examples 3 months ago
webtui πŸ—ΊοΈ webtui: generate real sitemap.xml (160 URLs) + robots.txt β€” fixes could-not-fetch for search engines 2 months ago
.dockerignore πŸ“¦ v2.0.8: security fixes, documentation, testing improvements 2 months ago
.editorconfig chore: initialize workspace with Cargo.toml, license, and tooling configs 3 months ago
.env.example chore: initialize workspace with Cargo.toml, license, and tooling configs 3 months ago
.gitignore πŸ“ docs: engineering article (ARTICLE.md) + Hacker News version (HACKERNEWS.md) 2 months ago
AGENTS.md πŸš€ release: 2.0.8 β€” write-path fix (ADR-080), fork-safe GIL pool (ADR-081), HTTP/3 (ADR-082), Security DI fix, docs honesty pass 2 months ago
all-llm.txt πŸ“š docs: refreshed index (verified numbers, new features), og-image, migration guide fix, all-llm.txt (LLM app-building guide) 2 months ago
ARCHITECTURE.md πŸ“š docs: Update documentation for v2.0.8 2 months ago
BENCHMARKS.md πŸ“Š p4: record multi-worker scaling + native async DB benchmarks (ADR-093) 2 months ago
Cargo.lock πŸ“¦ release: crates.io publish prep + webtui site updates 2 months ago
Cargo.toml πŸš€ release: 2.0.10 β€” full CLI in PyPI wheel (fixes broken justapi command) 2 months ago
CHANGELOG.md πŸš€ release: bump to v2.0.9 + full changelog 2 months ago
clippy.toml chore: add Cargo.lock and remaining project files 3 months ago
CONTRIBUTING.md πŸ“¦ p57-58: API stability policy + security hardening with input validation limits 2 months ago
DECISIONS.md πŸ“Š p4: record multi-worker scaling + native async DB benchmarks (ADR-093) 2 months ago
deepanalysis.md πŸ“¦ v2.0.8: security fixes, documentation, testing improvements 2 months ago
demo_app.py πŸ“ docs: engineering article (ARTICLE.md) + Hacker News version (HACKERNEWS.md) 2 months ago
deny.toml πŸ”§ fix: Add rustls-pemfile advisory to deny.toml 2 months ago
docker-compose.yml πŸ“¦ v2.0.8: security fixes, documentation, testing improvements 2 months ago
Dockerfile 🐳 docker: fix image build (rust 1.97, python path, pydantic, entrypoint) + enable CI docker job 2 months ago
docsplan.md πŸ“š docs: comprehensive docsplan.md β€” FastAPI-level docs rebuild plan 3 months ago
LICENSE chore: initialize workspace with Cargo.toml, license, and tooling configs 3 months ago
mkdocs.yml docs: add MkDocs site with API reference, migration guide, and security docs 3 months ago
PLAN.md πŸ“ p4: honesty cleanup β€” AI claims stay unverified, release narrative = web framework (item #5) 2 months ago
PRODUCTION_PLAN.md docs: update PLAN.md, DECISIONS.md ADR-075, and BENCHMARKS.md ledger 3 months ago
PRODUCTION.md feat: configurable max request body size with 413 on overflow (ADR-055) 3 months ago
PROMPT.md docs: add project roadmap, architecture docs, and security policy 3 months ago
README.md 🎨 docs: replace features SVG with new PNG (imagejustapi) 2 months ago
RELEASE_NOTES_2.0.9.md πŸ“ release: v2.0.9 release notes (commit-by-commit) 2 months ago
RELEASE_NOTES_v2.0.8.md πŸ“¦ v2.0.8: security fixes, documentation, testing improvements 2 months ago
REVISION_LOG.md docs: add project roadmap, architecture docs, and security policy 3 months ago
ROADMAP.md WIP save-point: production hardening, H3 removal, fmt gate, and accumulated phase work 3 months ago
rustfmt.toml WIP save-point: production hardening, H3 removal, fmt gate, and accumulated phase work 3 months ago
SECURITY.md docs: add project roadmap, architecture docs, and security policy 3 months ago
stream πŸš€ release: 2.0.8 β€” write-path fix (ADR-080), fork-safe GIL pool (ADR-081), HTTP/3 (ADR-082), Security DI fix, docs honesty pass 2 months ago
README.md

JustAPI is a Python web framework with a Rust core. You write Python logic. Rust handles everything else β€” networking, TLS, routing, validation, serialization, SSE, database I/O, rate limiting. One pip install, a server that starts in milliseconds, and numbers that hold up under real traffic.

Python writes the logic. Rust does everything else.


Quickstart

pip install justapi
# main.py
from justapi import JustAPIApp

app = JustAPIApp()

@app.get("/")
def read_root():
    return {"Hello": "World"}

@app.get("/items/{item_id}")
def read_item(item_id: int, q: str | None = None):
    return {"item_id": item_id, "q": q}

app.run()
$ python main.py
INFO:     JustAPI running on http://127.0.0.1:8000

Interactive OpenAPI docs at http://127.0.0.1:8000/docs β€” generated from your code, zero configuration.

Async? Native. DB? Native. SSE? Native.

import asyncio
from justapi import JustAPIApp, native_async

app = JustAPIApp()
app.set_database("postgres://user:pass@host/db")
app.sse_native("/events", count=1000, interval_ms=0)   # Rust streams events β€” 0 Python per event

@app.get("/users/{uid}")
@native_async
async def get_user(request, uid: int):
    row = await app.db.query_async(                     # runs on the DB's tokio runtime
        "SELECT * FROM users WHERE id = ?", [uid])      # GIL released β€” loop never blocks
    return row

app.run()

Performance

Hello-world, 100 concurrent connections, 30s, same hardware. Full methodology in BENCHMARKS.md.

Framework Hello-world JSON echo p99 hello-world RSS
JustAPI (native fast path) 766k req/s 782k req/s 0.48 ms 12 MB
Granian (ASGI) 314k 145k 0.74 ms 37 MB
Robyn 39k β€” β€” β€”
FastAPI + Uvicorn 36k 33k 24.63 ms 29 MB

More numbers, honestly:

  • Route lookup: 51 ns average on a 500-route table (matchit radix trie)
  • Rust-native CRUD: 181k SELECT req/s β€” Γ—125 vs FastAPI on the same DB fixture
  • Native async DB awaits (query_async): 53Γ— faster than the blocking path on slow queries (320 vs 6 RPS) β€” the asyncio loop is never blocked
  • Multi-worker prefork (justapi serve --workers N): 1.88Γ— throughput at 4 workers (99.7k RPS), auto-scale included
  • Free-threaded CPython (3.14t): CPU-bound Python handlers 12.4Γ— faster β€” the GIL ceiling is gone

Honest caveats

  • Native fast path requires a schema. Routes without a Schema fall back to the Python handler path (~60k req/s). The ~700k numbers apply to routes with native=True + Schema.
  • Python handler throughput is GIL-bound. On GIL-locked CPython, the Python dispatch path caps at ~100-120k req/s on this hardware regardless of framework β€” that is the GIL, not a framework limitation. Free-threaded Python (3.14t) removes this ceiling.
  • Light async handlers are loop-bound. Async handlers that only sleep/echo (~4-12k req/s) are capped by the asyncio loop + thread hop. Three experiments (ADR-090/091/092) proved no coroutine driver, bridge, or multi-loop approach beats asyncio's own stepping. We win where it matters: real async workloads (1ms-sleep handlers: 3.9k vs Granian 2.9k RPS) and anything DB/SSE-heavy via native ops.
  • LLM-serving claims are NOT part of this release. Inference phases are unverified (no real GPU run, ADR-067) β€” the tested story is the web framework.

How a request flows

The entire request path runs in Rust. Python executes only your application logic:

Kernel (epoll/io_uring)
  β†’ tokio connection manager
  β†’ TLS (rustls)
  β†’ HTTP parse (hyper)
  β†’ Router (matchit, 51ns)
  β†’ Middleware chain (auth, CORS, rate-limit, compression)
  β†’ Python boundary (zero-copy PyO3, GIL pool)
  β†’ Your async Python handler
  β†’ Rust serializer (serde_json / simd-json)
  β†’ Response write β†’ socket

Routes marked native=True + Schema skip Python entirely β€” Rust validates the body and writes the response. That is the ~700k req/s path.


Feature highlights


Coming from FastAPI?

JustAPI mirrors FastAPI's decorator API and Pydantic integration, so existing apps migrate with minimal changes β€” often just the import:

FastAPI JustAPI
Import from fastapi import FastAPI from justapi import JustAPIApp
Create app = FastAPI() app = JustAPIApp()
Decorators @app.get("/items/{id}") @app.get("/items/{id}")
Pydantic Native Native
Depends() Built-in Built-in (incl. generator deps + cleanup)
OpenAPI /docs and /redoc /docs and /redoc
Server uvicorn (Python) Built-in Rust server (tokio + hyper)
Hello-world ~36k req/s ~766k req/s (native fast path)

πŸ‘‰ Full migration guide.


Architecture

justapi/
β”œβ”€β”€ crates/
β”‚   β”œβ”€β”€ justapi-core/       # Networking, routing, middleware, serialization
β”‚   β”œβ”€β”€ justapi-py/         # PyO3 bindings + Python package (python/justapi)
β”‚   β”œβ”€β”€ justapi-cli/        # CLI binary (serve, create, check, gen-client)
β”‚   └── justapi-bench/      # Internal benchmark harness
β”œβ”€β”€ assets/                 # README diagrams (animated SVG)
β”œβ”€β”€ benchmarks/             # Workload scripts for baseline comparisons
β”œβ”€β”€ docs_site/              # Full documentation site (141 pages)
β”œβ”€β”€ skills/                 # Reusable engineering knowledge
β”œβ”€β”€ PLAN.md                 # Living roadmap (single source of truth)
β”œβ”€β”€ DECISIONS.md            # Append-only ADR log
└── BENCHMARKS.md           # Append-only performance ledger

Crate dependency graph:

justapi-cli  ──→  justapi-core
justapi-py   ──→  justapi-core
justapi-bench ─→  justapi-core

Development

Prerequisites

Build & test

cargo build --workspace --release
cd crates/justapi-py && maturin develop --release   # build the Python package

cargo test --workspace                              # Rust tests
cargo clippy --workspace --tests -- -D warnings     # lint
cargo fmt --check                                   # format
cargo deny check                                    # supply-chain audit
bash scripts/sanitize.sh                            # ASan + Miri memory-safety gate
python -m pytest                                    # Python tests (in the venv)

Benchmark

bash benchmarks/run_baselines.sh                    # FastAPI / Granian / JustAPI A/B

See BENCHMARKS.md for methodology, hardware, and history.


Deployment

# Docker (multi-stage, uv-based β€” fast reproducible builds)
docker build -t justapi-app .
docker run -p 8000:8000 justapi-app

# Multi-worker + auto-scale (saturate all cores)
justapi serve --workers 4 --scale
  • Kubernetes: helm install my-api helm/justapi/ --set image.repository=your-registry/justapi-app
  • Cloud guides: EKS Β· GKE Β· AKS Β· Fly.io Β· Railway
  • Observability: OTel tracing + Prometheus metrics + health probes out of the box

Documentation

Document Description
docs_site Full documentation site β€” 141 pages, 13 sections, search
Migration guide Step-by-step from FastAPI
BENCHMARKS.md Performance ledger (append-only)
PLAN.md Living roadmap and current phase
DECISIONS.md Architecture decision records (ADR-001 β†’ ADR-093)
AGENTS.md Development conventions & review checklist

Contributing

Contributions welcome. Read AGENTS.md for conventions before opening a PR.

git clone [email protected]:swadhinbiswas/JustAPI.git
cd JustAPI
git checkout -b feat/my-feature
# ... make changes ...
cargo test --workspace
cargo clippy --workspace --tests -- -D warnings
cargo fmt --check

Every PR is gated on: tests green, clippy -D warnings, fmt clean, sanitizers clean (core touched), benchmarks appended (perf touched), ADR recorded (architecture touched).


License

MIT Β© JustAPI contributors

About

The speed of Rust with the elegance of Python. A blazingly fast, zero-copy web framework built for extreme throughput

None license
Updated 23 days ago

Languages

  • Python 45.4%
  • Rust 35%
  • CSS 15.8%
  • Shell 2%
  • Astro 0.6%
  • TypeScript 0.6%
  • JavaScript 0.6%