Rapid Router

raw JSON →
7.7.3 verified Mon Apr 27 auth: no python

A Python web framework for building APIs with automatic OpenAPI (Swagger/ReDoc) documentation, request validation, and dependency injection. Current version 7.7.3 with active development.

pip install rapid-router
error ModuleNotFoundError: No module named 'rapid_router.routes'
cause In v7, route classes were moved to the top-level package.
fix
Replace from rapid_router.routes import Route with from rapid_router import Route.
error RuntimeError: Lifespan not supported
cause RapidRouter does not natively handle ASGI lifespan protocol.
fix
Use a server like Uvicorn with lifespan="on" and wrap the app with a lifespan-capable middleware.
error pip install rapid-router
cause Incorrect package name used in code import.
fix
Install package with pip install rapid-router but import as from rapid_router import RapidRouter.
breaking In v7, the import changed from `from rapid_router import RapidRouter` to `from rapid_router import RapidRouter` (consistent), but the internal structure was rewritten. Old imports like `from rapid_router.routes import Router` no longer work.
fix Use `from rapid_router import RapidRouter` and `Route` directly.
breaking v7 removed support for Python 3.7 and below. Requires Python 3.8+.
fix Upgrade Python to 3.8 or higher.
deprecated The `json` parameter in route decorators is deprecated in favor of Pydantic models for request body validation.
fix Use Pydantic models instead of raw JSON schema dicts.
gotcha ASGI lifespan events (startup/shutdown) are not supported by default. Use a middleware or external library.
fix Wrap app in a lifespan-capable framework like Starlette, or use `app.add_middleware` with custom lifespan.
pip install uvicorn

Create a simple API with one GET endpoint.

from rapid_router import RapidRouter

app = RapidRouter()

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

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)