RudderTyper

Detailed technical description of the RudderTyper utility to generate analytics library wrappers based on your Tracking Plans.

RudderTyperarrow-up-right is a tool that lets you generate strongly-typed analytics library wrappers based on your Tracking Plansarrow-up-right. Simply put, it uses an event from your specified tracking plan and generates an analytics call in the supported languages.

RudderTyper currently generates native clients for the following SDKs:

Readme

Key features

Some key features of RudderTyper are:

  • Allows you to contextualize your analytics instrumentation and validate it with your event spec, before deploying to production.

  • You can access and validate your event names, properties, types, etc.

  • It provides compile-time errors and warns you about any missing required properties, data mismatch, and any issues in the JSON schema configured in your tracking plan.

This feature is currently in a closed beta. If you're interested, contact your account representative for more information.

Github badge

Get started

Run the following command to fire up a quick start wizard, create a ruddertyper.yml file, and generate your first client with the specified configuration details:

Other commands

Update

The following command syncs plan.json with RudderStack to pull the latest changes in your tracking plan and then generates an updated development client.

Generate a development client

To generate a development client from plan.json, run the following command:

Generate a production client

The following command generates a production client from plan.json:

The following command prints the local RudderStack API token configuration.

Version

The following command prints the RudderTyper CLI version:

Help

To print the help message describing different commands available with RudderTyper, run the following command:

CLI arguments

Argument
Type
Description

config

string

An optional path to a ruddertyper.yml (or a directory with ruddertyper.yml).

debug

boolean

An optional (hidden) flag for enabling Ink debug mode.

version

boolean

Standard --version flag to print the version of this CLI.

v

boolean

Standard -v flag to print the version of this CLI.

help

boolean

Standard --help flag to print help on a command.

h

boolean

Standard -h flag to print help on a command.

Configuration reference

RudderTyper stores its configuration in a ruddertyper.yml file in the root of your repository.

A sample configuration looks like the following:

Integrating RudderTyper-generated client with your app

This section includes the steps to integrate your RudderTyper-generated client with your app across different RudderStack SDKs.

RudderStack Android SDK

  1. Import all the files in the client generated by RudderTyper as a package in your project.

  2. Then, you can directly make the calls using the RudderTyper client as shown:

RudderStack iOS SDK

  1. Import your RudderTyper client into your project using XCode.

If you have placed your generated files in a folder in your project, import the project as a group not a folder reference.

  1. Then, you can directly make the calls using the RudderTyper client as shown:

RudderStack JavaScript SDK

RudderTyper now also supports TypeScript for generating clients for the JavaScript SDK. This feature is available from the version 1.0.0-beta.5.

  1. Import the RudderTyper-generated client using require() and make the calls if your framework supports them. Alternatively, you can use Browserifyarrow-up-right to generate a bundle that supports your implementation. The implementation for each of the alternatives mentioned above will be as shown:

Using the require()method

JavaScript TypeScript

Using browserify

  1. Execute the following command to generate a bundle from the RudderTyper client:

  1. Now you can make calls from your html file as shown:

If you are using an older version of the JavaScript SDK (v1), refer to the Version Migration Guidearrow-up-right to migrate to v1.1.

RudderStack Node.js SDK

RudderTyper now also supports TypeScript for generating clients for the Node.js SDK. This feature is available from the RudderTyper version 1.0.0-beta.5 and it is compatible with the Node.js SDK with v1.1.2 or later.

  1. Import the the RudderTyper-generated client and start making calls using RudderTyper as shown:

JavaScript TypeScript

Contribute

Contact us

For queries on any of the sections in this guide, you can contact usenvelope or start a conversation in our Slackarrow-up-right community.

Last updated

Was this helpful?