Get started with Snowtype
This page walks you through installing Snowtype and connecting it to your Snowplow account.
To use Snowtype, you'll need:
- Node.js version 18 or later
- A Snowplow CDI account
- A Console API key
Install Snowtype
Navigate to your project directory and install Snowtype as a development dependency:
- npm
- Yarn
- pnpm
npm install --save-dev @snowplow/snowtype@latest
yarn add --dev @snowplow/snowtype@latest
pnpm add --save-dev @snowplow/snowtype@latest
This adds a local snowtype executable to your project. You can run it with npx, yarn, or pnpm:
npx snowtype --help
The examples on this page use npx. Replace with yarn or pnpm if you prefer.
Authenticate
Snowtype needs a Console API key to read your event specifications and data structures. You can create or find your API key in Console > Settings > Manage organization.
You need both the API key and the API key ID.
The recommended approach is to set them as environment variables, either in your shell or in a .env file at the root of your project:
- .env file
- Shell variable
SNOWPLOW_CONSOLE_API_KEY=your-api-key
SNOWPLOW_CONSOLE_API_KEY_ID=your-api-key-id
export SNOWPLOW_CONSOLE_API_KEY=your-api-key
export SNOWPLOW_CONSOLE_API_KEY_ID=your-api-key-id
You can also pass the credentials directly as CLI flags (--apiKey and --apiKeyId), but environment variables are easier to manage and keep credentials out of your command history.
Initialize your project
Run snowtype init to create a configuration file for your project:
npx snowtype init
The command will prompt you for:
- Your organization ID from Console
- The tracker you want to generate code for, e.g.
@snowplow/browser-tracker - The language for that tracker, if applicable, e.g.
typescript - The format (language) you want the configuration file to be in
- The output path where Snowtype should write the generated code
To find your organization ID, go to Console > Settings > Manage organization.
Snowtype saves these choices to a snowtype.config.json file in your project root. You can edit this file directly later, or pass the values as flags to skip the prompts. See the configuration reference for all available options.