RORK LABJP
TOOLING — Rork's developer repos keep moving: rork-xcode was updated on July 16, rork-device on July 15, and rork-plist on July 13OPUS46 — Claude Opus 4.6 is live in Rork, and Rork Max is built to assemble apps on top of Claude CodeSIM — A cloud iOS simulator runs in the browser, with one click to install on a device and two clicks to publish to the App StoreMAX — Rork Max emits pure Swift rather than React Native, reaching iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and even iMessageNATIVE — That opens up HealthKit, ARKit and LiDAR, NFC, Dynamic Island, Live Activities, 3D through Metal, and on-device inference with Core MLSEED — Rork raised a $15M seed led by Left Lane Capital, with Peak XV and a16z Speedrun joining the roundTOOLING — Rork's developer repos keep moving: rork-xcode was updated on July 16, rork-device on July 15, and rork-plist on July 13OPUS46 — Claude Opus 4.6 is live in Rork, and Rork Max is built to assemble apps on top of Claude CodeSIM — A cloud iOS simulator runs in the browser, with one click to install on a device and two clicks to publish to the App StoreMAX — Rork Max emits pure Swift rather than React Native, reaching iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and even iMessageNATIVE — That opens up HealthKit, ARKit and LiDAR, NFC, Dynamic Island, Live Activities, 3D through Metal, and on-device inference with Core MLSEED — Rork raised a $15M seed led by Left Lane Capital, with Peak XV and a16z Speedrun joining the round
Articles/Dev Tools
Dev Tools/2026-06-03Advanced

Guarding Analytics Events With Types Across Six Rork Apps — A Shared Event Layer

After event names drifted across six apps and quietly broke my dashboards, I built a typed event registry and a thin wrapper to centralize tracking, plus a CI check that catches schema drift. Here is the design, with the code I actually use.

Rork515analytics4TypeScript8Firebase10architecture12

Premium Article

When I tried to look at "save button taps" for one of my wallpaper apps after about six months, the chart had dropped to zero on a specific day. It was not an outage. In some update, while doing unrelated work, I had renamed the event wallpaper_save to save_wallpaper. The app ran fine, nothing crashed, and only the analytics dashboard quietly died. For half a year, the same action had been split across two names, and nobody noticed.

I have been building apps on my own since 2014, and they have reached around 50 million downloads in total. These days I run six wallpaper apps in parallel using Rork, and the more apps you have, the worse this "event names rot in silence" problem gets. The same act of "saving a wallpaper" ends up with slightly different names in each app, and before long you can no longer analyze across them. This article records the design of a shared event layer that locks this problem down with types, along with the code I actually use.

Why Event Names Rot in Silence

The insidious thing about analytics events is that nothing breaks when they are wrong. Whether you write save_btn_tap, wallpaper_saved, or tap_save, as long as it is passed as a string to logEvent(name, params), the app behaves normally. The type system, the linter, and your tests never look inside the string. The error is detected six months later, by the human eyes of whoever opens the dashboard.

With six apps, this gets exponentially worse. In my experience, leaving it unmanaged led to three kinds of rot progressing at once. First, naming drift: the same action had three coexisting names, wallpaper_save / save_wallpaper / img_save. Second, missing properties: one app was not sending the category property, so I could not break saves down by category. Third, type mismatches: some apps sent is_premium as the string "true" while others sent the boolean true, and Firebase counted them as separate things.

The root cause of all of these is that "you can send anything as a string with an any type." So the starting point of this design is simple: close off the sending path with types.

A Typed Event Registry as the Single Source of Truth

First, consolidate every event definition into a single file. Declare each event name and the shape of its properties as types, and make it impossible to send any event not listed here.

// packages/analytics/src/events.ts
// The "event dictionary" shared across six apps. This is the only truth.
 
export const EVENTS = {
  wallpaper_save: {
    category: "string",      // wallpaper category ID
    wallpaper_id: "string",
    source: "string",        // "detail" | "list" | "widget"
  },
  wallpaper_set_lockscreen: {
    wallpaper_id: "string",
  },
  paywall_view: {
    placement: "string",     // which screen it came from
    variant: "string",       // A/B test branch
  },
  subscribe_complete: {
    plan: "string",          // "monthly" | "yearly"
    price_jpy: "number",
  },
} as const;
 
// Derive each event's property types automatically from EVENTS
type PropType<T> = T extends "string" ? string
  : T extends "number" ? number
  : T extends "boolean" ? boolean
  : never;
 
export type EventName = keyof typeof EVENTS;
 
export type EventProps<E extends EventName> = {
  [K in keyof typeof EVENTS[E]]: PropType<typeof EVENTS[E][K]>;
};

This EVENTS object is both a dictionary and a contract. Adding a new event means adding a line here, where it shows up as a list during review. Because the property types are declared too, passing a string to price_jpy simply will not compile.

My grandfather, who was a temple carpenter, used to say: "Decide the dimensions first, and after that you only have to honor them." An event schema works the same way. Decide the dimensions (the types) in one place, and each app's implementation only has to honor them.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
A typed event registry that catches event-name typos and drift at compile time
A single thin wrapper across six apps that prevents missing common properties
A CI check that detects event-definition drift so dashboards never break silently
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Dev Tools2026-07-13
postMessage Is Fire-and-Forget — Designing a Correlated Request/Response Bridge Between a WebView and React Native
postMessage between a WebView and React Native is one-way, so you never learn whether the work you asked for actually succeeded. Here is a typed request/response bridge, with correlation IDs and timeouts, built in working TypeScript.
Dev Tools2026-06-28
Build Your Settings Screen From One Schema and Reuse It Across Apps
Hand-building a settings screen per app falls apart as your app count grows. Here is a schema-driven design that assembles the screen from declarative data and shares a common base across multiple apps, with working code.
Dev Tools2026-06-22
Serving Both Plain Rork and Rork Max From One Backend — Designing an API Response Contract That Never Breaks Old Binaries
When plain Rork (React Native / Expo) and Rork Max (native Swift) both call the same Cloudflare Workers backend, the whole design centers on not breaking old binaries you cannot force-update. Wrap responses in an envelope, evolve them additively, absorb client differences with capability flags, and retire old contracts safely — shown in code.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →