A from-scratch FastAPI-compatible framework with a Rust core.
Project description
superduperfastapi
superduperfastapi is a from-scratch FastAPI-compatible framework with a Rust
core. The target is a drop-in replacement for existing FastAPI apps, with the
hot request path handled by Rust wherever this implementation can preserve
FastAPI behavior.
This project is in pre-school-alpha phase. Expect bugs, missing edge cases, rough packaging, and surprising failures. Do not treat it as production-ready without your own compatibility and load testing.
This project was built with Codex's /goal feature: the implementation work was
tracked as a sequence of explicit performance and compatibility goals, with
audits and benchmark artifacts generated for each goal.
When present locally, the upstream FastAPI checkout in references/fastapi is a
behavior and test reference only. Runtime code must not import upstream FastAPI.
Install
From PyPI, once published:
uv pip install superduperfastapi
Local development build:
.venv/bin/python -m pip install maturin
.venv/bin/maturin develop
Package build:
.venv/bin/maturin build --release
The package depends on Pydantic v2. It does not depend on upstream FastAPI. The
wheel includes the superduperfastapi package plus local fastapi and
starlette compatibility shims for drop-in imports.
Drop-In Imports
Native import:
from superduperfastapi import FastAPI
FastAPI-compatible import:
from fastapi import FastAPI
In this repository, PYTHONPATH=python makes fastapi resolve to
python/fastapi, a compatibility shim that re-exports superduperfastapi. The
reference runner verifies this before executing upstream tests.
Minimal 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}
Rust Server
The Rust HTTP/1.1 server is exposed through the local core module:
from superduperfastapi._core import core
core.serve(app, "127.0.0.1", 8000, 0)
core.serve_once(app) is used by tests for one-request loopback checks.
Fast Path Coverage
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-urlencodedform params - primitive multipart
File()bytes params,UploadFileparams, 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 scopedSecurityScopeshelpers- simple
StaticFiles(directory=...)mounts - direct
Responsereturns, 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.
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
Examples
Runnable examples live in examples/. Each example is a standalone
uv run --script file with inline dependencies that install
superduperfastapi from PyPI:
uv run --script examples/basic.py
uv run --script examples/async_await.py
uv run --script examples/middleware.py
uv run --script examples/rust_server_once.py
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.
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.
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.
Current Gaps
The long-term target is maximum request-path performance while preserving drop-in FastAPI behavior. Remaining work includes deeper dependency graph optimization, response-model hot-path tuning, reducing any future intentional Python fallback areas, and hardening production packaging.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file superduperfastapi-0.1.1.tar.gz.
File metadata
- Download URL: superduperfastapi-0.1.1.tar.gz
- Upload date:
- Size: 91.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07f30a3ec11dcacdd7cff97dcc9ece154d8c620b689ca008c0873fb3a83e854e
|
|
| MD5 |
986b460935f6cfb8062ecc0aba68bdc9
|
|
| BLAKE2b-256 |
97f576ac102e31397c5c1110fa0c3f686994f9080cfb15f45caafee69d194c30
|
Provenance
The following attestation bundles were made for superduperfastapi-0.1.1.tar.gz:
Publisher:
publish-pypi.yml on amalshaji/superduperfastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superduperfastapi-0.1.1.tar.gz -
Subject digest:
07f30a3ec11dcacdd7cff97dcc9ece154d8c620b689ca008c0873fb3a83e854e - Sigstore transparency entry: 1462860087
- Sigstore integration time:
-
Permalink:
amalshaji/superduperfastapi@a86adf2d5c6a28b7c9a1324baa3c42e2ad55e707 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/amalshaji
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a86adf2d5c6a28b7c9a1324baa3c42e2ad55e707 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file superduperfastapi-0.1.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: superduperfastapi-0.1.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 726.9 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b04f5ac2652bd7aae95462e903604a5af431261ffb3f1ea3ba0d77ee00be5abb
|
|
| MD5 |
e176226d16e675f2ca42085b558b24b2
|
|
| BLAKE2b-256 |
d8f51a81df833b46ec213961216df462019800d8fb0c169d8afa8aaa820f390b
|
Provenance
The following attestation bundles were made for superduperfastapi-0.1.1-cp312-cp312-win_amd64.whl:
Publisher:
publish-pypi.yml on amalshaji/superduperfastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superduperfastapi-0.1.1-cp312-cp312-win_amd64.whl -
Subject digest:
b04f5ac2652bd7aae95462e903604a5af431261ffb3f1ea3ba0d77ee00be5abb - Sigstore transparency entry: 1462860153
- Sigstore integration time:
-
Permalink:
amalshaji/superduperfastapi@a86adf2d5c6a28b7c9a1324baa3c42e2ad55e707 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/amalshaji
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a86adf2d5c6a28b7c9a1324baa3c42e2ad55e707 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file superduperfastapi-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: superduperfastapi-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 921.6 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7557350247a4a77fd8b7217c80bdfcfd8d34d9eb6584fdc745a04d45a778753a
|
|
| MD5 |
82ca3c7fa0935edec373758bf09da0ad
|
|
| BLAKE2b-256 |
cd71fd2339ac21c7df89890c1ea9d486a60c4c514b4d8c8f353f3eb006609859
|
Provenance
The following attestation bundles were made for superduperfastapi-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish-pypi.yml on amalshaji/superduperfastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superduperfastapi-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
7557350247a4a77fd8b7217c80bdfcfd8d34d9eb6584fdc745a04d45a778753a - Sigstore transparency entry: 1462860308
- Sigstore integration time:
-
Permalink:
amalshaji/superduperfastapi@a86adf2d5c6a28b7c9a1324baa3c42e2ad55e707 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/amalshaji
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a86adf2d5c6a28b7c9a1324baa3c42e2ad55e707 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file superduperfastapi-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: superduperfastapi-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 845.1 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a96af518169feedf17bb8945dfdd680a7deebdff0522859aab7e0c92910d8b4
|
|
| MD5 |
9660265c99dfe35d7fa995a338a8498b
|
|
| BLAKE2b-256 |
fb04029ab365aa853ce643996cc18420eced2a960229ac201d3ab86f1f7d36b7
|
Provenance
The following attestation bundles were made for superduperfastapi-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
publish-pypi.yml on amalshaji/superduperfastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superduperfastapi-0.1.1-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
9a96af518169feedf17bb8945dfdd680a7deebdff0522859aab7e0c92910d8b4 - Sigstore transparency entry: 1462860214
- Sigstore integration time:
-
Permalink:
amalshaji/superduperfastapi@a86adf2d5c6a28b7c9a1324baa3c42e2ad55e707 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/amalshaji
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a86adf2d5c6a28b7c9a1324baa3c42e2ad55e707 -
Trigger Event:
pull_request
-
Statement type: