Deployment
BustAPI uses a high-performance Rust Actix-web server built-in. Unlike Flask, you do not need a separate WSGI server like Gunicorn to get production-ready performance.
Running in Production
You can run your BustAPI app directly.
However, for robust process management (restarts, logging, multiple workers), usage of a process manager is recommended.
Using Systemd
Create a unit file /etc/systemd/system/myapp.service:
[Unit]
Description=My BustAPI App
After=network.target
[Service]
User=www-data
WorkingDirectory=/var/www/myapp
ExecStart=/var/www/myapp/venv/bin/python app.py
Restart=always
[Install]
WantedBy=multi-user.target
Native HTTPS (TLS) Support
BustAPI supports native HTTPS/TLS without needing an external reverse proxy like Nginx. Pass your SSL certificate and key paths using the ssl_context parameter:
from bustapi import BustAPI
app = BustAPI()
@app.route("/")
def home():
return {"status": "secure"}
if __name__ == "__main__":
app.run(
host="0.0.0.0",
port=8443,
ssl_context=("cert.pem", "key.pem")
)
Alternative Servers
While the built-in Rust server is the most optimized for BustAPI, you can also run your application with standard ASGI or WSGI servers.
Uvicorn (ASGI)
BustAPI provides an asgi_app entry point compatible with Uvicorn and other ASGI servers.
# Install uvicorn
pip install uvicorn
# Run using the CLI
uvicorn main:app.asgi_app --interface asgi3
Or programmatically:
Gunicorn (WSGI)
For traditional deployments, you can use Gunicorn. BustAPI behaves as a standard WSGI application.
Or programmatically: