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.yamlin your repo — ties your project to that catalog (workspace id, event ids, optionalversionper 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/updateand regenerate.
API token
Codegen only needs to read the catalog.
-
In EventPanel, open Settings → API Tokens and create a token with Read-only (or Read) permission.
-
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
- Install the EventPanel CLI (releases) — Homebrew and manual options are documented in each platform guide below.
- Initialize or add
EventPanel.yamlto your repository (often viaeventpanel initwith the right--sourcefor your stack). - Pull the current event definitions from the workspace (
eventpanel pull). When the workspace has newer schema revisions than your YAML, useeventpanel outdated/eventpanel updatesoversion:lines stay in sync, then pull again — your guide goes into the exact sequence. - Generate typed code (
eventpanel generate) whenever YAML or catalog revisions change. Many teams rungeneratebefore 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; omittingversiondefaults revision1for pulls — see the Web guide for howupdaterefreshes 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
| Guide | Use it for |
|---|---|
| Web / TypeScript | Node, browsers, React, NestJS, or any TypeScript project; typescriptgen and npm/yarn scripts. |
| iOS / Swift | Xcode, SwiftPM or CocoaPods, iOS and Apple-platform apps. |
| Android / Kotlin | Gradle, Kotlin, Android Studio; generated Kotlin under your module layout. |
Related: MCP
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.