Events are created via HTTP POST to:
POST /api/v1/events/{source}/{type}
- source: The source system or component generating the event (e.g.,
api,webhook,cron) - type: The type of event (e.g.,
created,updated,deleted) - body: Raw JSON payload (no need to include source or type in the body)
Example:
POST /api/v1/events/api/user.created
Content-Type: application/json{"userId": 123, "email": "user@example.com"}This creates an event with:
- Source:
api - Type:
user.created - Payload:
{"userId": 123, "email": "user@example.com"}
NATS messages are consumed from subjects with the format:
{prefix}.{source}.{type}
- prefix: Any routing prefix (e.g.,
events,myapp,prod, etc.) - source: The source system or component (extracted from second-to-last part)
- type: The type of event (extracted from last part)
The service extracts the last two parts of the subject as source and type.
Examples:
| NATS Subject | Extracted Source | Extracted Type |
|---|---|---|
events.api.created |
api |
created |
myapp.webhook.placed |
webhook |
placed |
prod.payments.processed |
payments |
processed |
dev.us-east.orders.shipped |
orders |
shipped |
Publishing Example:
# Subject: events.myapp.order-placed
# Source: myapp, Type: order-laced
nats pub events.myapp.order-placed '{"orderId": 456, "total": 99.99}'