rAPIdy
rAPIdy - a fast, lightweight, and modern asynchronous web framework powered by aiohttp and pydantic.
🚀 Why rAPIdy?
rAPIdy is designed for developers who need a fast, async-first web framework that combines the performance of aiohttp with the simplicity and modern features of frameworks like FastAPI.
Simple rAPIdy server:
from rapidy import Rapidy
from rapidy.http import get
@get("/")
async def hello() -> dict[str, str]:
return {"message": "Hello, rAPIdy!"}
app = Rapidy(http_route_handlers=[hello])
🔥 Key Features
- Fast & Lightweight – Minimal overhead, built on aiohttp
- Async-First – Fully asynchronous by design
- Built-in Validation – Uses pydantic for request validation
- Simple & Flexible – Supports both rAPIdy-style handler definitions and traditional aiohttp function-based and class-based routing
- Middleware Support – Easily extend functionality with middleware, including built-in validation for HTTP parameters (headers, cookies, path params, query params and body).
📦 Installation & Setup
Install rAPIdy via pip:
🏁 First Simple Server
from rapidy import Rapidy
from rapidy.http import post, PathParam, Header, Body
from pydantic import BaseModel, Field
class BodyRequestSchema(BaseModel):
username: str = Field(min_length=3, max_length=20)
password: str = Field(min_length=8, max_length=40)
@post('/{user_id}')
async def handler(
user_id: str = PathParam(),
host: str = Header(alias='Host'),
body: BodyRequestSchema = Body(),
) -> dict[str, str]:
return {'hello': 'rapidy'}
rapidy = Rapidy(
http_route_handlers=[handler],
)
Successful request validation
curl -X POST \
-H "Content-Type: application/json" -d '{"username": "User", "password": "myAwesomePass"}' -v \
http://127.0.0.1:8080/111
Failed request validation
curl -X POST \
-H "Content-Type: application/json" -d '{"username": "U", "password": "m"}' -v \
http://127.0.0.1:8080/111
< HTTP/1.1 422 Unprocessable Entity ...
{
"errors": [
{
"loc": ["body", "username"],
"type": "string_too_short",
"msg": "Строка должна содержать как минимум 3 символа",
"ctx": {"min_length": 3}
},
{
"type": "string_too_short",
"loc": ["body", "password"],
"msg": "Строка должна содержать как минимум 8 символов",
"ctx": {"min_length": 8}
}
]
}
Quickstart Guide Quickstart