# Examples End-to-end, runnable examples organized by feature area. Each example is self-contained and can be lifted into a fresh project. ## REST * {doc}`/examples/rest/crud` — `GET`/`POST`/`PUT`/`DELETE` on a single resource, with `inject(...)` validation and `NotFoundResponseDirective` for `404`. ## HTML * {doc}`/examples/html/form_post_redirect` — render a Jinja2 form, validate submission, emit `RedirectResponseDirective` on success. ## WebSocket * {doc}`/examples/websocket/upload` — REST upload + WebSocket progress events, avoiding the subscribe-after-upload race. ## Middleware * {doc}`/examples/middleware/auth` — protect REST endpoints with a Bearer-token middleware and event inheritance, returning `401` for unauthenticated requests. * {doc}`/examples/middleware/deferred_auth` — gate REST/WebSocket events behind an async token check using `replace_event` + `redirect_event` + `register_events`, validated by a separate auth component. * {doc}`/examples/middleware/server_timing` — a response middleware that publishes `event._timing` as a standard `Server-Timing` header, so DevTools shows where each request spent its time. ## Worker * {doc}`/examples/worker/cpu_bound` — offload heavy computation off the manager thread. * {doc}`/examples/worker/shared_memory_pipe` — high-throughput on-the-fly downloads. * {doc}`/examples/worker/stream_upload_minio` — forward an HTTP upload straight into object storage via `SharedMemoryPipe`, with no buffering and end-to-end backpressure. * {doc}`/examples/worker/scatter_gather` — answer one request by fanning it out to many workers and aggregating the parts in `resolve_callback_worker`. ## Scheduler + Key-Value Store * {doc}`/examples/scheduler/periodic_refresh` — Scheduler ticks update a cached snapshot held in the KV Store; readers fetch via `Get`. ## Pydantic AI * {doc}`/examples/pydantic_ai/support_agent` — an agent's tools call Events handled by a separate Manager's Worker, with two tools called in parallel in the same turn. --- If you're new to EDRI, the {doc}`/examples/rest/crud` is the shortest end-to-end demonstration.