Skip to main content

Source Reference

Source definitions describe a consuming application — which events it tracks, which language it uses, and where generated code should be written.

File location

sources/<source_name>.yaml

Fields

FieldTypeRequiredDescription
namestringYesMachine-readable source name. Used as the CLI argument to generate, audit, diff.
platformstringNoPlatform hint: web, mobile, server, cli. Informational.
languagestringYesTarget language for codegen: go | typescript | swift | kotlin
eventslist[string]NoEvent patterns to include. Supports glob syntax. Empty = all events.
destinationslist[string]NoDestination names this source sends to. Informational.
output.pathstringNoOutput directory for generated files. Default: ./generated.
output.packagestringNoPackage / module name for generated files (TypeScript: npm scope, Go: module path).
version_pinningmapNoPin specific events to a version: namespace/name: "1-0-0".
audit.pathstringNoDirectory to scan with event-spec audit. Default: ..
audit.coverage_minnumberNoMinimum coverage percentage (0 = disabled).
audit.reportstringNoDefault audit report format: text | json | html.

Event patterns

Patterns use glob syntax matching namespace/event_name:

events:
- ecommerce/** # all events in the ecommerce namespace
- auth/user_signed_up # exact match
- auth/* # all events directly in auth (not nested)

Complete example

sources/web-app.yaml
name: web-app
platform: web
language: typescript
events:
- ecommerce/**
- auth/user_signed_up
- auth/user_logged_out
destinations:
- amplitude
output:
path: ./src/analytics/generated
package: "@my-company/analytics"
version_pinning:
ecommerce/product_viewed: "1-0-0"
audit:
path: ./src
coverage_min: 80
report: text