System events
What events are
When something important happens (a user is created, someone accepts an invitation…), the module responsible emits an internal event. Other modules can react to it independently, without the original module knowing — or caring — who listens.
Why it matters
It keeps modules from coupling to each other. For example:
- The Users module knows nothing about emails or jobs. It does its work and emits
"user created". - The Jobs module listens and triggers the welcome email.
If tomorrow something else must happen when a user is created (say, creating a billing record), you add a listener. The Users module does not change.
Active events
| Event | Emitted when | Who reacts |
|---|---|---|
provider.usage-recorded | After a successful use of a resolved (or degraded) provider | Observability / future billing (this module does not bill) |
user.created | A new user is created | Jobs → sends the welcome email |
user.invited | An invitation is created | Jobs → sends the email with the link |
user.invitation-accepted | An invitation is accepted | Jobs → sends the company welcome email |
object-storage.operate-granted | An OWNER grants operation permission on the tenant bucket | Audit (structured log); no business consumers |
object-storage.operate-revoked | An OWNER revokes it (the grant row is deleted) | Durable audit after the row delete |
Object Storage events include environmentId (null for the historical administrative or platform space). RAG consumers filter by that scope in addition to the route so preview and production never cross.
Flow
UsersService.create()
│
▼
Emits: "user.created"
│
├──► UserCreatedJobListener → enqueues SendWelcomeEmailJob
│
└──► (any future listener)Listeners are independent. One can fail without affecting the others.