🚧 Prototype Notice

This project (sufast) is currently a dummy prototype.
Only static routes are working at the moment.
Dynamic routing and full features are under development.
Thank you for understanding! πŸ™

Sufast/Documentation
Getting Started

Getting Started with Sufast

Learn how to install and create your first Sufast application in minutes.

Prerequisites
Make sure you have the following installed before getting started
Python 3.8 or higher
pip (Python package installer)
Platform-compatible system (Windows, macOS, Linux)

Installation

Install Sufast using pip. The package includes a pre-compiled Rust binary for optimal performance.

Install Sufastbash
pip install sufast

Your First Sufast App

Create a simple "Hello World" application to verify your installation.

hello.pypython
from sufast import App

app = App()

@app.get("/")
def hello():
    return {"message": "Hello from Sufast πŸ‘‹"}

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

Run your application:

Terminalbash
python hello.py

Your app will be available at http://localhost:8080

Building an API Server

Let's create a more comprehensive example with multiple endpoints and data handling.

api_server.pypython
from sufast import App

app = App()

# Sample database
users = {
    "shohan": {"name": "Shohan", "email": "shohan@example.com"},
    "bob": {"name": "Bob", "email": "bob@example.com"},
    "alice": {"name": "Alice", "email": "alice@example.com"},
}

@app.get("/")
def home():
    return {"message": "Welcome to Sufast API πŸš€"}

@app.get("/users")
def get_users():
    return {"users": list(users.values())}

@app.get("/users/{user_id}")
def get_user(user_id: str):
    if user_id in users:
        return {"user": users[user_id]}
    return {"error": "User not found"}, 404

@app.post("/users")
def create_user():
    # This is a mocked POST example
    return {
        "message": "User created successfully",
        "user": users["bob"]
    }

@app.get("/health")
def health_check():
    return {"status": "healthy", "framework": "Sufast"}

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080)

Testing Your API

Test your API endpoints using curl or any HTTP client.

GET /
curl http://localhost:8080/
GET /users
curl http://localhost:8080/users
GET /users/shohan
curl http://localhost:8080/users/shohan
POST /users
curl -X POST http://localhost:8080/users
πŸŽ‰ Congratulations!
You've successfully created your first Sufast application

You're now ready to explore more advanced features like middleware, authentication, database integration, and performance optimization.