typebridge 0.3.0

Cross-language type synchronization SDK for Rust — define once, generate everywhere
Documentation

typebridge

Cross-Language Type Synchronization SDK for Rust Define your types once in Rust. Get perfectly matching types in TypeScript, Python, Go, Swift, and Kotlin — automatically, forever.

Crates.io Docs.rs License

Quick Start

[dependencies]
typebridge = "0.1.2"
serde = { version = "1", features = ["derive"] }
use typebridge::TypeWriter;
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, TypeWriter)]
#[sync_to(typescript, python)]
pub struct UserProfile {
    pub id: String,
    pub email: String,
    pub age: Option<u32>,
}
// cargo build generates:
// ✅ ./generated/typescript/user-profile.ts
// ✅ ./generated/python/user_profile.py

Features

  • TypeScriptexport interface, discriminated unions, optional fields
  • Python — Pydantic v2 BaseModel, Enum, Union with Literal discriminators
  • Serde compatible — auto-reads #[serde(rename, skip, tag, flatten)]
  • Custom attributes#[tw(skip)], #[tw(rename)], #[tw(optional)]
  • Zero-config — works out of the box, optional typewriter.toml for customization

See the full documentation for more.

License

Apache-2.0 — Darshan Vichhi