Skip to main content

serve

Start the event-spec registry HTTP server. The server provides a REST API for event spec management, analytics ingestion, and a web admin UI.

Synopsis

event-spec serve [flags]

Flags

FlagDefaultDescription
--port8080Listening port
--db(required)Database DSN: SQLite (file:./registry.db) or PostgreSQL (postgres://...)

Usage

# SQLite (development / small deployments)
event-spec serve --port 8080 --db file:./registry.db

# PostgreSQL (production)
event-spec serve --port 8080 --db "postgres://user:pass@localhost:5432/event_spec"

# With environment variables
DB_DSN=file:./registry.db event-spec serve

Server features

  • Event registry API — CRUD for event specs, sources, and destinations
  • Analytics relay/track, /identify, /group, /page, /alias endpoints for server-proxied ingestion
  • API key authentication — all API endpoints require a valid API key
  • Web admin UI — event catalog browser, audit log, key management
  • Admin CLI subcommands — manage apps, destinations, keys, and webhooks without the UI

API endpoints

MethodPathRoleDescription
GET/v1/healthServer health and uptime
GET/v1/eventsviewerList event specs
GET/v1/events/{namespace}/{name}viewerGet latest event spec
GET/v1/events/{namespace}/{name}/{version}viewerGet specific version
POST/v1/eventspublisherPublish an event spec
GET/v1/diff/{namespace}/{name}/{from}/{to}viewerDiff two versions
POST/v1/trackviewerRelay a track event
POST/v1/identifyviewerRelay an identify call
POST/v1/groupviewerRelay a group call
POST/v1/pageviewerRelay a page view
POST/v1/aliasviewerRelay an alias call
POST/v1/batchviewerRelay a batch of events
POST/v1/flushviewerFlush buffered events
GET/v1/admin/keysadminList API keys
POST/v1/admin/keysCreate an API key
DELETE/v1/admin/keys/{id}adminRevoke an API key
GET/v1/admin/sourcesadminList sources
POST/v1/admin/sourcesadminCreate a source
GET/v1/admin/destinationsadminList destinations
POST/v1/admin/destinationsadminCreate a destination
GET/v1/admin/configadminGet server config
PUT/v1/admin/config/{key}adminSet a config value

All endpoints except POST /v1/admin/keys and GET /v1/health require Authorization: Bearer <api-key>.

Graceful shutdown

The server handles SIGINT and SIGTERM with a 30-second shutdown timeout — in-flight requests complete before the process exits.

See also