# Tracking Plan Code Generation: General Availability


**Code Generation (Codegen)** for Tracking Plans is now **Generally Available** on all RudderStack plans, including Free, Growth, and Enterprise.

A Tracking Plan already defines the contract for an event: its property names, data types, which properties are required, and how they're nested. Codegen reads that contract and turns it directly into a ready-to-paste code snippet, so engineers no longer have to hand-translate a spec into code.

## Why it matters

Tracking plans are typically handed off from the people who define them (data and product teams) to the engineers who instrument them, often through a spreadsheet, doc, or ticket. Every manual re-typing of that schema is a chance for a mismatched key, the wrong data type, or a missed required property — mistakes that usually aren't caught until they show up downstream as a Tracking Plan violation, a broken destination mapping, or bad data in the warehouse.

Codegen closes that gap:

- **Fewer errors at the source**: Generated snippets are correct by construction, cutting down on the property typos and type mismatches that lead to Tracking Plan violations.
- **Faster instrumentation**: Engineers spend less time reading through a spec and re-typing it, and more time wiring the call into the right place in the codebase.
- **A Tracking Plan you can trust**: When the plan is the source of the code, teams have a direct incentive to keep it accurate, reinforcing your Tracking Plan as the single source of truth rather than documentation everyone works around.

## How it works

1. Go to **Govern** > **Tracking Plans**.
2. Open a Tracking Plan and select an event.
3. Click **View Codegen** to see the generated snippet alongside the schema.

The snippet includes the full `properties` object structure, the exact property keys, example values matching each property's data type (for example, a sample string for a `cart_id` property or a sample number for a `price` property), nested objects rendered as objects, and inline `// optional` comments on properties that aren't required.

{{< image src="images/data-governance/tracking-plans/codegen-example.webp" alt="Code generation example screenshot" >}}

{{< info >}}
Codegen currently generates snippets for the **JavaScript SDK**, with support for additional languages coming soon.
{{< /info >}}

## Pair it with RudderTyper

Codegen is the fastest way to get an accurate, copy-paste snippet, but a snippet doesn't stay in sync if the Tracking Plan changes after you've instrumented it. For teams that want full type safety and autocompletion in their IDE, [RudderTyper]({{< ref "dev-tools/ruddertyper.md" >}}) builds on the same Tracking Plan contract to generate and maintain typesafe functions for you.

See our [Tracking Plan Codegen docs]({{< ref "data-governance/tracking-plans/codegen.md" >}}) for more information.

