litestar-events

Installation
SKILL.md

Events

Execution Workflow

  1. Decide whether the event bus is the right tool: decoupled in-process side effects, not app lifecycle or broker-backed messaging.
  2. Define stable event IDs and argument contracts before wiring emitters and listeners.
  3. Register listeners on the Litestar app with listeners=[...].
  4. Emit events from handlers or services through request.app.emit(...) or another app reference.
  5. Keep listeners independent so multiple listeners can react to the same event safely.
  6. Replace the default emitter backend only when retry, persistence, or external infrastructure requirements justify it.

Core Rules

  • Treat event IDs as stable contracts, not ad hoc strings scattered through the codebase.
  • Make every listener for an event compatible with the full emitted *args and **kwargs set.
  • Use **kwargs defensively when multiple listeners consume different subsets of the same event payload.
  • Keep listener bodies side-effect focused and small; delegate heavy domain logic to services.
  • Use the built-in in-memory emitter for simple in-process async fanout.
  • Implement a custom emitter backend only when persistence, retry, scheduling, or external transport is required.
Related skills

More from alti3/litestar-skills

Installs
14
GitHub Stars
5
First Seen
Mar 2, 2026