Skip to main content

superduperfastapi

superduperfastapi is a from-scratch, Rust-powered framework that aims to be a drop-in replacement for FastAPI while moving hot request-path work into Rust.

[!WARNING] This project is in pre-school-alpha. Expect bugs, missing edge cases, incomplete FastAPI parity, rough packaging, and surprising failures. Do not use it for production traffic without your own compatibility and load tests.

[!IMPORTANT] The package is published as superduperfastapi. It also ships local fastapi and starlette compatibility shims so existing from fastapi import FastAPI imports can be tested against this implementation.

[!NOTE] This project was built using Codex's /goal feature. The work has been tracked as explicit performance and compatibility goals with audits and benchmark artifacts along the way.

Installation

Install from PyPI:

uv pip install superduperfastapi

or:

pip install superduperfastapi

The package depends on Pydantic v2. It does not depend on upstream FastAPI at runtime.

Usage

Use the FastAPI-compatible import when testing an existing app:

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):
    name: str
    count: int


@app.post("/items")
def create_item(item: Item):
    return {"name": item.name, "total": item.count + 1}

Run it with the Rust HTTP server:

from superduperfastapi._core import core

core.run(app, "127.0.0.1", 8000)

core.run(...) runs in the foreground and handles Ctrl-C by asking the Rust server to stop accepting new connections, drain active requests, and exit.

For explicit lifecycle control:

server = core.start_server(app, "127.0.0.1", 8000)
try:
    print(f"Serving on http://127.0.0.1:{server.port()}")
    server.wait()
finally:
    server.shutdown()
    server.wait()

Drop-In Imports

Native import:

from superduperfastapi import FastAPI

FastAPI-compatible import:

from fastapi import FastAPI

The long-term goal is for production FastAPI apps to switch package/runtime plumbing with minimal application-code changes. That goal is not complete yet; treat every app migration as a compatibility exercise.

Examples

Runnable examples live in examples/. Each example is a standalone uv run --script file with inline dependencies that install superduperfastapi from PyPI and start a local server:

uv run --script examples/basic.py
uv run --script examples/async_await.py
uv run --script examples/middleware.py
uv run --script examples/html_rendering.py
uv run --script examples/rust_server.py

Example requests:

curl -X POST http://127.0.0.1:8000/items \
  -H "content-type: application/json" \
  -d '{"name":"widget","count":41}'

curl http://127.0.0.1:8004/hello/Ada

Set SUPERDUPERFASTAPI_HOST or SUPERDUPERFASTAPI_PORT to override the default bind address for any example.

What Is Fast Today

SuperDuperFastAPI builds Rust route specs for supported routes and dispatches those routes through the Rust core. Covered fast-path areas include:

  • route matching with a Rust route index/trie
  • path, query, header, and cookie primitive params
  • primitive application/x-www-form-urlencoded form params
  • primitive multipart File() bytes params, UploadFile params, and repeated file lists
  • JSON request bodies through Pydantic-core validators
  • response-model validation and serialization through Pydantic-core
  • direct Rust JSON response construction for plain JSON-compatible returns
  • built-in JSON, HTML, plain text, redirect, streaming, and file response classes
  • sync and async endpoints/dependencies for the covered dependency graph
  • request-scope sync/async generator dependencies with teardown on the native path
  • Security(...) dependencies for API-key, HTTP bearer/basic, OAuth2 password-bearer, and scoped SecurityScopes helpers
  • simple StaticFiles(directory=...) mounts
  • direct Response returns, background tasks, request injection, and app state
  • built-in CORS, GZip, trusted-host, and HTTPS redirect middleware
  • user @app.middleware("http") routes through Rust dispatch
  • custom add_middleware(...) ASGI middleware through the Rust bridge
  • Rust-side 422 response construction for validation errors

The compatibility matrix records whether each covered feature is passed, fallback, unsupported, or broken.

Current Gaps

The target is maximum request-path performance while preserving drop-in FastAPI behavior. Remaining work includes deeper dependency graph optimization, response-model hot-path tuning, eliminating future fallback areas where possible, more upstream FastAPI test coverage, and production packaging hardening.

Benchmarks

Benchmark summaries are written under benchmarks/results/.

benchmark summary
plain JSON benchmarks/results/bombardier_summary.md
CRUD endpoint matrix benchmarks/results/crud_bombardier_summary.md
dependency graph matrix benchmarks/results/dependency_bombardier_summary.md
multipart upload matrix benchmarks/results/multipart_bombardier_summary.md
response model matrix benchmarks/results/response_model_bombardier_summary.md
security dependency matrix benchmarks/results/security_bombardier_summary.md
route count scaling benchmarks/results/route_count_bombardier_summary.md
validation-heavy payloads benchmarks/results/validation_bombardier_summary.md
OpenAPI generation benchmarks/results/openapi_generation_summary.md
JSONable response matrix benchmarks/results/jsonable_bombardier_summary.md
user middleware matrix benchmarks/results/middleware_bombardier_summary.md

Run a benchmark:

.venv/bin/python benchmarks/run_validation_bombardier.py
.venv/bin/python benchmarks/run_dependency_bombardier.py
.venv/bin/python benchmarks/run_openapi_generation.py

Local Development

Local installation and build steps are for contributors working from this repository.

Create or use the local virtualenv, then install the Rust extension:

.venv/bin/python -m pip install maturin
.venv/bin/maturin develop

Package build:

.venv/bin/maturin build --release

In this repository, PYTHONPATH=python makes fastapi resolve to python/fastapi, a compatibility shim that re-exports superduperfastapi. When present locally, the upstream FastAPI checkout in references/fastapi is a behavior and test reference only. Runtime code must not import upstream FastAPI.

Verification

Local unit suite:

PYTHONPATH=python .venv/bin/python -m unittest discover -s tests

Rust core tests:

cargo test --manifest-path rust/superduperfastapi-core/Cargo.toml

Full recursive FastAPI reference subset:

.venv/bin/python scripts/run_reference_subset.py references/fastapi/tests

Current verified reference result: 3117 passed, 14 skipped, 5 xfailed.

Compatibility Audits

.venv/bin/python scripts/audit_fastapi_compatibility.py
.venv/bin/python scripts/audit_middleware_fast_path.py
.venv/bin/python scripts/audit_validation_errors.py
.venv/bin/python scripts/audit_openapi_parity.py
.venv/bin/python scripts/audit_packaging.py
.venv/bin/python scripts/audit_goal_progress.py
.venv/bin/python scripts/classify_fastapi_features.py

These write Markdown and JSON evidence into benchmarks/results/. The feature matrix exits non-zero if any generated row is broken.

Publishing

Publishing is handled by .github/workflows/publish-pypi.yml. It publishes only when a pull request is merged with the release label. The published package name is superduperfastapi, and the version is read from pyproject.toml.

Configure PyPI trusted publishing for the GitHub repository before running the workflow. The workflow runs on GitHub releases and can also be started manually with workflow_dispatch.

Release files for superduperfastapi 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for superduperfastapi 0.1.3
File Size Uploaded
superduperfastapi-0.1.3.tar.gz 92.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for superduperfastapi 0.1.3
File Interpreter ABI Platform
superduperfastapi-0.1.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
superduperfastapi-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
superduperfastapi-0.1.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 2.7 MB

Release files / superduperfastapi-0.1.3.tar.gz

Download URL superduperfastapi-0.1.3.tar.gz
Size 92.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f2ab677e49cfc1bf52cdfe5329ce654f46cbf4c41e3550dedd3264c7d0874e5b
BLAKE2b-256 checksum
How to use checksums
425814b5c39777c3f2609bb0516807a59bcf7b3c11f544035ea8590e327d3e87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release files / superduperfastapi-0.1.3-cp312-cp312-win_amd64.whl

Download URL superduperfastapi-0.1.3-cp312-cp312-win_amd64.whl
Size 748.6 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
255d6bee952b10b92d4dfe2c65eca7bdfabe50288592b7c66d6e55c97824a61d
BLAKE2b-256 checksum
How to use checksums
acd263d81543f0fe8d9d9bd1a4bfd676fa27ba78079a2402c3f66e4239e2b562
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release files / superduperfastapi-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL superduperfastapi-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 942.1 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c61e8d92ded1b7f76a37d0112f2f830753e8051dadfa785d3ac92f682f0133d6
BLAKE2b-256 checksum
How to use checksums
b0528d32695d60edef422945fdffeba51986dd337473839f8f13a11e098a6d5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release files / superduperfastapi-0.1.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL superduperfastapi-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Size 867.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2369428c2be359f0287bdb9541b3501b26374697e2b430d8876b0c48f9127598
BLAKE2b-256 checksum
How to use checksums
21a058ef15fee24a62d97bece7f489ef3ce7746d16944b76c7df2495063c1c41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

4 release files

0.1.2

4 release files

0.1.1

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page