Skip to content

GrandpaEJ/BustAPI

Repository files navigation

BustAPI — High-Performance Python Web Framework

BustAPI - Fast Python Web Framework powered by Rust and Actix-Web

The fastest Python web framework for building REST APIs
Flask-like syntax • Rust-powered performance • Up to 20,000+ requests/sec

BustAPI on PyPI CI Status Python 3.10 3.11 3.12 3.13 3.14 MIT License

Important

Migration Notice: This project has officially moved to the RUSTxPY organization for better community maintenance and long-term stability. Please update your bookmarks and remotes.


Example

from bustapi import BustAPI

app = BustAPI()

@app.route("/")
def hello():
    return {"message": "Hello, world!"}

if __name__ == "__main__":
    app.run()

No ASGI servers needed. No complex configuration. Just run your file.


📦 Installation

pip install bustapi

Supports: Python 3.10 – 3.14 | Linux, macOS, Windows | x86_64 & ARM64

Pre-built wheels available — no Rust toolchain required!


🚀 Quick Start

1. Create app.py:

from bustapi import BustAPI, jsonify

app = BustAPI()

@app.route("/")
def home():
    return {"status": "running", "framework": "BustAPI"}

@app.route("/users/<int:user_id>")
def get_user(user_id):
    return jsonify({"id": user_id, "name": "Alice"})

@app.route("/greet", methods=["POST"])
def greet():
    from bustapi import request
    data = request.json
    return {"message": f"Hello, {data.get('name', 'World')}!"}

if __name__ == "__main__":
    app.run(debug=True)  # Hot reload enabled

2. Run it:

python app.py

3. Visit http://127.0.0.1:5000


⚡ Turbo Routes

For maximum performance, use @app.turbo_route(). Path parameters are parsed entirely in Rust:

# Zero-overhead static route
@app.turbo_route("/health")
def health():
    return {"status": "ok"}

# Dynamic route with typed params (parsed in Rust)
@app.turbo_route("/users/<int:id>")
def get_user(id: int):
    return {"id": id, "name": f"User {id}"}

# Cached response (140k+ RPS!)
@app.turbo_route("/config", cache_ttl=60)
def get_config():
    return {"version": "1.0", "env": "production"}

Supported types: int, float, str, path

⚠️ Note: Turbo routes skip middleware, sessions, and request context for speed. Use @app.route() when you need those features.


📊 Benchmarks

Standard Routes (@app.route())

Platform RPS Mode
Linux ~25,000 Single-process
macOS ~20,000 Single-process
Windows ~17,000 Single-process

Turbo Routes (@app.turbo_route()) — Linux

Configuration RPS
Static route ~30,000 (single)
Multiprocessing (4 workers) ~105,000
Cached (60s TTL) ~140,000

Framework Comparison (Turbo + Multiprocessing)

BustAPI vs Other Frameworks


🌍 Platform Support

🐧 Linux (Recommended for Production)

Linux delivers the best performance with native multiprocessing:

  • ~25k RPS standard routes, 100k+ RPS with Turbo + multiprocessing
  • Kernel-level load balancing via SO_REUSEPORT
  • Automatic worker scaling to CPU cores
python app.py  # Automatically uses multiprocessing

🌠 Star History

Star History Chart


📄 License

MIT © 2025-2026 GrandpaEJ


Built with 🦀 Rust + 🐍 Python
Fast. Simple. Production-ready.