Complete RudderTyper v2 command reference for generating type-safe client bindings via Rudder CLI.
Available Plans
starter
growth
enterprise
5 minute read
This page serves as a detailed reference for the RudderTyper v2 CLI commands available through Rudder CLI.
Overview
RudderTyper v2 is integrated into Rudder CLI and provides the following commands to generate type-safe client bindings from your Tracking Plans:
Command
Use case
workspace tracking-plans list
List all Tracking Plans in your workspace
typer generate
Generate type-safe client bindings from a Tracking Plan
typer options
View available platform-specific options for customizing generated code
List Tracking Plans
The workspace tracking-plans list command displays an interactive table with all available Tracking Plans in your workspace.
Command syntax
rudder-cli workspace tracking-plans list
Description
This command displays an interactive interface showing all Tracking Plans in your workspace.
Selecting a Tracking Plan from the list shows its details in a panel on the right, including the plan’s name, description, and current version, as shown:
Generate bindings
The typer generate command generates type-safe bindings for a specified platform from a Tracking Plan.
Specifies the platform for code generation. Supported values: kotlin, swift.
--tracking-plan-id Required
String
Specifies the ID of the Tracking Plan to generate bindings from. You can obtain this ID using the List Tracking Plans command or from your RudderStack dashboard URL: https://app.rudderstack.com/trackingPlans/<ID>.
-o, --output
String
Specifies the output directory for storing generated files. If omitted, defaults to the current working directory.
--option
String
Specifies platform-specific options to customize the generated code. Accepts key/value pairs separated by =. You can specify multiple options by repeating the flag — see Platform options for available options.
The typer options command displays available platform-specific options for customizing generated code.
Command syntax
rudder-cli typer options --platform=<platform>
Parameters
Parameter
Type
Description
--platform Required
String
Specifies the platform to view options for. Supported values: kotlin, swift.
-h, --help
Flag
Displays help information for the command.
Description
This command displays an interactive interface showing all available options for the specified platform, along with their descriptions and usage examples.
Example
rudder-cli typer options --platform=kotlin
Platform options
Platform-specific options customize how code is generated for each platform. Pass these options to the typer generate command using the --option flag with a key/value pair format: --option key=value.
Kotlin platform options
Option
Type
Description
Example
packageName
String
Package name to use for the generated Kotlin code. If not specified, defaults to com.rudderstack.ruddertyper.
The Swift platform does not currently expose any platform-specific options.
Supported platforms
Platform
Language
Use case
kotlin
Kotlin
Android and JVM applications
swift
Swift
iOS applications
Generated code structure
The generated code structure depends on the platform and options specified.
Kotlin
By default, Kotlin bindings are generated with the package name com.rudderstack.ruddertyper. The generated files should be placed in a directory structure that matches the package name:
src/main/kotlin/com/rudderstack/ruddertyper/
Custom package structure
If you specify a custom packageName option, place the generated files in a directory structure that matches your custom package name. For example, with packageName=com.example.package:
src/main/kotlin/com/example/package/
Swift
Swift bindings are generated as a single RudderTyper.swift file. The file is organized into the following sections:
RudderTyper.swift
├── Custom Types (type aliases and structs for custom types)
├── Property Types (type aliases for property types)
├── Event Properties (structs for event properties and traits)
└── RudderTyperAnalytics (wrapper class with type-safe event methods)
The generated file imports Foundation and RudderStackAnalytics.
Using generated code
After generating the code, import it into your project and use the type-safe methods for tracking.
importcom.rudderstack.ruddertyper.RudderAnalyticsvaltyper=com.rudderstack.ruddertyper.RudderAnalytics(analytics)typer.trackUserLogin(properties=TrackUserLoginProperties(// ... properties defined in your Tracking Plan
))
importRudderStackAnalyticsletrudderTyper=RudderTyperAnalytics(analytics:analytics)rudderTyper.trackUserLogin(properties:TrackUserLoginProperties(// ... properties defined in your Tracking Plan))
The generated code provides:
Type-safe event methods: Each event in your Tracking Plan becomes a method
Required parameters: Required properties are enforced at compile time
Property validation: Property types match your Tracking Plan schema
RudderTyper maps YAML types from your Tracking Plan definitions to native types for each platform.
YAML type
Kotlin type
string
String
integer
Int
number
Double
boolean
Boolean
array
JsonArray or List<T>
object
JsonObject
null
JsonNull
YAML type
Swift type
string
String
integer
Int
number
Double
boolean
Bool
array
[Any] or [T]
object
[String: Any]
null
NSNull
Properties that support multiple types are represented as a sealed class in Kotlin or an enum with associated values in Swift. Each type variant is represented as a distinct case, and a value property provides access to the underlying value.
Naming conventions
RudderTyper applies consistent naming conventions when generating code from your Tracking Plan definitions. These conventions are the same across both Kotlin and Swift.
Event methods
Event type
Method name pattern
Example
track
track{EventName}
trackUserSignedUp
identify
identify
identify
screen
screen{EventName}
screenProductViewed
group
group
group
Properties and traits structs
Event type
Struct name pattern
Example
track
Track{EventName}Properties
TrackUserSignedUpProperties
identify
Identify{EventName}Traits
IdentifyUserTraits
screen
Screen{EventName}Properties
ScreenProductViewedProperties
group
Group{EventName}Traits
GroupCompanyTraits
Type name prefixes
Source
Prefix
Example
Property
Property
PropertySomeString
Custom type
CustomType
CustomTypeSomeStringType
Event names are converted to CamelCase for method and struct names, with the original event name preserved in the underlying SDK call.
Supported event types
RudderTyper generates type-safe methods for the following event types:
Event type
Method signature
Notes
track
track{EventName}(properties:options:)
Properties struct with typed fields
identify
identify(userId:traits:options:)
Traits struct with typed fields
screen
screen{EventName}(properties:category:options:)
Properties struct with typed fields; category is optional
group
group(groupId:traits:options:)
Traits struct with typed fields
Every generated method includes an optional options parameter that lets you pass additional configuration (such as integration overrides) to the underlying SDK call. RudderTyper automatically injects a ruddertyper context object into every call for attribution.
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.