Skip to content

🚀 Quickstart

Get your first BustAPI app running in under 5 minutes.


📦 Installation

Bash
pip install bustapi
Bash
uv pip install bustapi

Requirements

  • Python 3.10 - 3.14
  • Pre-built wheels for Linux, macOS, and Windows

👋 Hello World

Create a file called app.py:

app.py
from bustapi import BustAPI

app = BustAPI()

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

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

Run it:

Bash
python app.py

Open http://127.0.0.1:5000 in your browser.

You should see

JSON
{"message": "Hello, World!"}

⚡ Level Up: Turbo Routes

For maximum performance, use @app.turbo_route():

Python
@app.turbo_route("/health")
def health():
    return {"status": "ok"}
Python
@app.turbo_route("/users/<int:id>")
def get_user(id: int):
    return {"id": id, "name": f"User {id}"}
Python
@app.turbo_route("/", cache_ttl=60)
def home():
    return {"message": "Cached for 60 seconds!"}

Benchmark Results (v0.8.0)

Tested with oha -z 10s -c 50 on Python 3.13:

Route Type Linux (4w) macOS Windows
Static turbo 105,012 35,560 17,772
Dynamic turbo 99,142 27,532 17,844
Cached turbo ~160,000 - -

Note

Turbo routes skip middleware and sessions for speed. Use @app.route() if you need those features.


🚀 Production Mode

For maximum performance, use multiprocessing:

app.py
from bustapi import BustAPI

app = BustAPI()

# ... your routes ...

if __name__ == "__main__":
    app.run(
        host="0.0.0.0",
        port=5000,
        workers=4,      # (1)!
        debug=False     # (2)!
    )
  1. Spawns 4 worker processes for parallel request handling
  2. Always disable debug in production!

Platform Performance (v0.8.0)

Platform Workers RPS Note
Linux 4 105,012 SO_REUSEPORT load balancing
macOS 1 35,560 Single-process mode
Windows 1 17,772 Single-process mode

Production Recommendation

Deploy on Linux for maximum performance with kernel-level load balancing.


📚 Next Steps