Skip to content
GitHub

Quickstart

Terminal window
uv add lexigram-web

lexigram (core) and lexigram-contracts are pulled in automatically.


A single-file prototype with the quickstart app:

main.py
from lexigram.web import app, get, singleton
@singleton
class Greeter:
def hello(self, name: str) -> str:
return f"Hello, {name}"
@get("/hello/{name}")
async def hello(name: str, greeter: Greeter) -> dict:
return {"message": greeter.hello(name)}

Run with any ASGI server:

8000/hello/world
uv run uvicorn main:app

The app object is a standard ASGI application. OpenAPI docs are auto-generated at /docs (Swagger UI) and /redoc.


Use Application + WebProvider for explicit control:

app.py
from lexigram import Application
from lexigram.web import WebProvider
def create_app() -> Application:
app = Application(name="my-api")
app.add_provider(WebProvider())
return app
Terminal window
uv run uvicorn app:create_app --factory