Skip to main content

Code generation

Keep your analytics events aligned with your EventPanel workspace while shipping typed helpers in your application code. The EventPanel CLI reads your workspace catalog and emits platform-specific types and factories so event names and properties are checked at compile time, not only at runtime.

This hub describes the shared ideas; each platform guide covers installation, EventPanel.yaml, CI, and project layout in detail.

What you get

  • One catalog in the workspace — events, properties, categories, and sources stay the source of truth in EventPanel.
  • EventPanel.yaml in your repo — ties your project to that catalog (workspace id, event ids, optional version per event, and codegen plugin settings).
  • Generated code you do not edit by hand — TypeScript, Swift, or Kotlin output from the same definitions your PMs and analysts see in the UI.
  • Safer refactors — renaming or changing properties surfaces as compiler errors until you run pull / update and regenerate.

API token

Codegen only needs to read the catalog.

  1. In EventPanel, open Settings → API Tokens and create a token with Read-only (or Read) permission.

  2. On your machine, configure the CLI once per token (see your platform guide for full context):

    eventpanel set-token YOUR_API_TOKEN

Treat this token like any other secret: CI should use a masked variable, not a committed file.

Typical workflow

  1. Install the EventPanel CLI (releases) — Homebrew and manual options are documented in each platform guide below.
  2. Initialize or add EventPanel.yaml to your repository (often via eventpanel init with the right --source for your stack).
  3. Pull the current event definitions from the workspace (eventpanel pull). When the workspace has newer schema revisions than your YAML, use eventpanel outdated / eventpanel update so version: lines stay in sync, then pull again — your guide goes into the exact sequence.
  4. Generate typed code (eventpanel generate) whenever YAML or catalog revisions change. Many teams run generate before local builds or in CI.

Exact flags, paths, and package-script examples differ by platform; follow the guide for your stack.

EventPanel.yaml at a glance

  • Identifies the workspace and lists events you want in this repo (by id).
  • Optionally pins each event to a catalog version; omitting version defaults revision 1 for pulls — see the Web guide for how update refreshes versions after catalog changes.
  • Configures the codegen plugin (output path, language options, namespaces, etc.).

Do not hand-edit generated source files; extend or wrap them in your own modules if you need custom behavior.

Platform guides

GuideUse it for
Web / TypeScriptNode, browsers, React, NestJS, or any TypeScript project; typescriptgen and npm/yarn scripts.
iOS / SwiftXcode, SwiftPM or CocoaPods, iOS and Apple-platform apps.
Android / KotlinGradle, Kotlin, Android Studio; generated Kotlin under your module layout.

Assistants such as Cursor can create or update events in the workspace over MCP (a Read & Write token). Codegen is the complementary path: once the catalog looks right, you pull and generate so application code matches it. See Model Context Protocol integration for MCP setup.

EventPanel CLI

The CLI is open source: github.com/eventpanel/eventpanel-cli — install, changelog, and issue tracker.