Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

RustAPI

RustAPI Logo

FastAPI-style Python Web Framework backed by a Rust (Tokio / Hyper) Engine — with embedded Rust Database Streaming, JWT & Argon2 Primitives, Tier 3 Rust-Native Routes, and a built-in MCP Server.

PyPI GitHub Repository License: MIT Python: 3.8+ Rust: 1.75+


📦 Key Open-Source Features Included

Feature Area Implementation Details
FastAPI Compatibility FastAPI & Request aliases, status codes, declared status_code (e.g. 201, 204), async/sync response_model with response_model_exclude/include, structured 422 validation error handling, FastAPI(lifespan=...) ASGI context managers, Depends(..., scope="function"), EventSourceResponse (SSE), jsonable_encoder, Query/Body/Path/Form/File, OAuth2PasswordBearer, HTTPBearer, APIKeyHeader, OpenIdConnect, get_openapi, app.frontend().
HTTP & Routing FastAPI-style @app.get, @app.post, APIRouter, Depends, app.dependency_overrides, response_model, reload=True.
Rust-Native Tier 3 Routes app.add_native_route() zero-GIL C-speed fast-paths (50,000+ req/sec).
Database Engine sqlx SQLite & PostgreSQL pool (app.connect_db()) with zero-copy JSON streaming (db.query_json()).
Power Primitives Native Rust encode_jwt() / decode_jwt(), Argon2 hash_password() / verify_password(), MiniJinja render_template().
Response Classes HTMLResponse, JSONResponse, PlainTextResponse, RedirectResponse, StreamingResponse, EventSourceResponse.
Request Ergonomics req.json(), req.form, req.body, UploadFile, WebSocket.
AI / MCP Integration Embedded Model Context Protocol server (@app.tool(), @app.resource(), @app.prompt()) at POST /mcp.
Telemetry & Observability Terminal access logging (INFO: 127.0.0.1 - "GET /render HTTP/1.1" 200 - 0.45ms), Swagger UI (/docs), OpenAPI (/openapi.json).

⚡ Framework Standing & Multi-Framework Benchmarks

rustapi delivers 100% FastAPI developer experience (DX) while running on a high-performance Rust (Tokio/Hyper) core engine.

┌───────────────────────────────────────────────────────────┐
│                    Python Layer (DX)                      │
│ FastAPI Syntax • Pydantic Models • Routers • SSE • Docs   │
└─────────────────────────────┬─────────────────────────────┘
                              │  PyO3 C-Bindings
┌─────────────────────────────▼─────────────────────────────┐
│                    Rust Tokio/Hyper Core                  │
│ Async Multi-Thread IO • Tokio Workers • sqlx DB • SSE      │
└───────────────────────────────────────────────────────────┘

📊 Empirical Benchmark Results (oha Load Generator, $c=32$)

Measured under identical business logic and schemas across Python and Node.js frameworks:

Workload Scenario FastAPI (uvloop) Express.js RustAPI (v1.8.9) Fastify (Node.js) RustAPI Native Tier 3
Sync JSON (GET /json) 3,417 req/s 12,873 req/s 10,178 req/s (⚡ 3.0x vs FastAPI) 17,063 req/s 🚀 96,386 req/s (⚡ 7.5x vs Express)
Async JSON (GET /async_json) 5,430 req/s 13,638 req/s 8,117 req/s (⚡ 1.5x vs FastAPI) 17,122 req/s N/A
Validated POST (POST /items) 2,762 req/s 10,529 req/s 8,621 req/s (⚡ 3.1x vs FastAPI) 13,463 req/s N/A
Response Model (50 items) (GET /users) 1,916 req/s 10,072 req/s 1,928 req/s (⚡ Lower p95) 11,145 req/s N/A
High Concurrency (c=100) 6,088 req/s 12,637 req/s 7,571 req/s (⚡ 1.25x vs FastAPI) 15,523 req/s N/A

Detailed report & reproducible scripts: performance-reports/rustapi_vs_fastapi_vs_nodejs.md


🏛️ The 3-Tier Execution Model

  1. Tier 1 (FastAPI Drop-in): Standard Python @app.get(), async def, Pydantic models, and dependencies.
  2. Tier 2 (Hybrid Rust Acceleration): Standard Python handlers utilizing native Rust power primitives (db.query_json() SQLite/PostgreSQL streaming, rustapi.encode_jwt(), rustapi.hash_password(), MiniJinja templates).
  3. Tier 3 (Pure Rust Native Fast-Path): Zero-GIL C-speed routes registered with app.add_native_route("/health", ...) clocking 96,000+ req/sec at 0.57ms p95 latency.

📚 Documentation Reference

Detailed documentation is available in the docs/ directory and project reference:


🛠️ Local Development & Testing

Build from source with maturin:

# Clone the repository
git clone https://github.com/rajboopathiking/rustapi.git
cd rustapi

# Build release wheel with Maturin
pip install maturin
maturin develop --release

# Run full test suite
pytest tests/ -v

PYPI Package

pip install pyrustapi

📄 License

Distributed under the MIT License.

Metadata

Release files for pyrustapi 1.9.0b1

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

Source distribution (sdist)

Source distribution for pyrustapi 1.9.0b1
File Size Uploaded Provenance
pyrustapi-1.9.0b1.tar.gz 3.6 MB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for pyrustapi 1.9.0b1
File
pyrustapi-1.9.0b1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
pyrustapi-1.9.0b1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
pyrustapi-1.9.0b1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
pyrustapi-1.9.0b1-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 20.0 MB

Release files / pyrustapi-1.9.0b1.tar.gz

Download URL pyrustapi-1.9.0b1.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
e9d6f8eb03055cafa57dc95cd4d86b0d5b6c78c092c122e2ccbe3c7caf18b504
BLAKE2b-256 checksum
How to use checksums
bf752f3d5623b337e8fd0354655cdd7364f1b33f536458ce1e9afa502e107852
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / pyrustapi-1.9.0b1-cp38-abi3-win_amd64.whl

Download URL pyrustapi-1.9.0b1-cp38-abi3-win_amd64.whl
Size 4.3 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
cfd12a445a3174e01f713b5d2f06a7af056fccc26d5f09ad9c1989b68857667f
BLAKE2b-256 checksum
How to use checksums
3a0913018b3f483b3e08ca1f3a4f1f08e54e16e1dc87dd258d4fa3493224b13e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / pyrustapi-1.9.0b1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyrustapi-1.9.0b1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b27aa4db7d89b8f303a126382063aee9b60d6d3ecd0fff8239783ad129647670
BLAKE2b-256 checksum
How to use checksums
1c951df91bdcd376a2d7257605fb3edb290b9e36875468d4d674fc9a4bba98dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / pyrustapi-1.9.0b1-cp38-abi3-macosx_11_0_arm64.whl

Download URL pyrustapi-1.9.0b1-cp38-abi3-macosx_11_0_arm64.whl
Size 3.8 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c6aa3d044cda18c369e850959091f991f8859b7a8d3c9105f9561ed49f05ef02
BLAKE2b-256 checksum
How to use checksums
6fae4867ffcf555d026a7b5daaed4e0bb940326e439628f9848dc95edda50c13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / pyrustapi-1.9.0b1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL pyrustapi-1.9.0b1-cp38-abi3-macosx_10_12_x86_64.whl
Size 4.1 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c60a5d6a2deefd93307b395e0b99d88f4ada5e72591fb4ca2bd9d55d2f380143
BLAKE2b-256 checksum
How to use checksums
eb952f526506faf82dcd43d5acdbcafb43901608b23790c9f7a023a9b546f34f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for pyrustapi 1.9.0b1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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