Code Generation
Ordaze ships production-grade default templates for all 13 supported languages. Pick a source in Settings, optionally customize the Handlebars template, and download the generated file via the API or the dashboard.
Default Templates (13 languages)
Every supported language has a default template. Select a source in Settings → Code Generation to download or customize.
| Language | Output |
|---|---|
| Swift | AnalyticsEvents.swift — extension on Analytics with a static func per event |
| Kotlin | AnalyticsEvents.kt — sealed AnalyticsEvent class with a data object/class per event |
| TypeScript | AnalyticsEvents.ts — typed Properties interface + constructor function per event |
| Python | analytics_events.py — TypedDict properties + module function per event |
| Java | AnalyticsEvents.java — final class with a static method returning Event (boxed primitives, Map<String, Object>) |
| JavaScript | analyticsEvents.js — module.exports of per-event factory functions with JSDoc-typed parameters |
| C# | AnalyticsEvents.cs — static class + readonly record struct AnalyticsEvent envelope (C# 10+) |
| Go | analytics_events.go — package-level PascalCase exported functions returning AnalyticsEvent |
| Rust | analytics_events.rs — #[derive(Serialize)] pub struct AnalyticsEvent + snake_case pub fn per event |
| Ruby | analytics_events.rb — module with self. class methods using keyword args + YARD type comments |
| PHP | AnalyticsEvents.php — declare(strict_types=1) final class with static methods returning typed arrays |
| Dart | analytics_events.dart — class with named required/nullable parameters (Dart 2.12 null safety) |
| React Native | AnalyticsEvents.ts — same output as TypeScript (RN projects run V8/Hermes with TS tooling) |
Every default is a Handlebars template — edit it in the in-app editor to match your SDK, code style, or house conventions. The types and names come from your event registry so output stays in sync with the schema.
Template System
Handlebars
Templates use Handlebars syntax. Write your template in the built-in editor with live preview and validation.
Context Variables
| Variable | Description |
|---|---|
| {{today}} | Current date (YYYY-MM-DD) |
| {{eventCount}} | Total number of events |
| {{categories}} | Array of destination names |
| {{allProperties}} | Array of all property names across events |
Iterating Events
{{#each eventsByCategory}}
// Category: {{category}}
{{#each events}}
// Event: {{name}} ({{camelCase}}, {{pascalCase}})
// {{description}}
{{#if deprecated}}// @deprecated{{/if}}
{{/each}}
{{/each}}| Variable | Description |
|---|---|
| {{category}} | Destination name |
| {{name}} | Event name in snake_case |
| {{camelCase}} | Event name in camelCase |
| {{pascalCase}} | Event name in PascalCase |
| {{description}} | Event description text |
| {{deprecated}} | Boolean, true if event is deprecated |
| {{hasProperties}} | Boolean, true if event has properties |
Property Fields
{{#each properties}}
{{name}}: {{swiftOptionalType}} // {{camelCase}}, {{upperSnake}}
{{/each}}| Variable | Description |
|---|---|
| {{name}} | Property name in snake_case |
| {{camelCase}} | Property name in camelCase |
| {{upperSnake}} | Property name in UPPER_SNAKE_CASE |
| {{swiftOptionalType}} | Swift type with optional marker (e.g. String?) |
| {{kotlinOptionalType}} | Kotlin type with nullable marker (e.g. String?) |
| {{required}} | Boolean, true if property is required |
Helper Functions
| Helper | Description |
|---|---|
| {{toCamelCase name}} | Convert to camelCase |
| {{toPascalCase name}} | Convert to PascalCase |
| {{toUpperSnakeCase name}} | Convert to UPPER_SNAKE_CASE |
| {{swiftType type required}} | Map to Swift type (String, Int, Bool, etc.) |
| {{kotlinType type required}} | Map to Kotlin type (String, Int, Boolean, etc.) |
| {{#if (eq status "deprecated")}} | Equality comparison helper |
| {{#if (hasItems properties)}} | Check if array has items |
| {{@first}} / {{@last}} | Loop boundary checks |
| {{@index}} | Current loop index (0-based) |
Full Example
Complete Swift Template
A working template that generates a Swift file with typed event enums. Copy this as a starting point for your own template.
// Auto-generated by Ordaze on {{today}}
// {{eventCount}} events across {{categories.length}} destinations
import Foundation
{{#each eventsByCategory}}
// MARK: - {{category}}
enum {{toPascalCase category}}Events: String {
{{#each events}}
/// {{description}}
{{#if deprecated}}@available(*, deprecated, message: "Use replacement event")
{{/if}}case {{camelCase}} = "{{name}}"
{{/each}}
}
{{#each events}}
{{#if hasProperties}}
struct {{pascalCase}}Properties {
{{#each properties}}
let {{camelCase}}: {{swiftOptionalType}}
{{/each}}
}
{{/if}}
{{/each}}
{{/each}}Customizing in Settings
Every supported language ships with a default template. To customize any of them:
- Go to Settings → Code Generation
- Select the source you want to customize
- Edit the template (the preview updates in real time)
- Optionally change the output file name
- Save when ready, or reset to restore the default
The editor supports Tab for indentation and Ctrl/Cmd+S to save. Template validation runs on every change.