Skip to content

gepheum/skir

Repository files navigation

Skir

Like Protobuf, without the pain

skir.build

npm build


Skir is a declarative language for defining data types, constants, and APIs. Write your schema once in a .skir file and generate idiomatic, type-safe code in TypeScript, Python, Java, Go, C++, and more.

🎬 Quick demo

Quick demo

✨ Features

  • 🧩 One schema, nine languages, zero friction - One YAML config, one command, and watch mode that refreshes generated code on every change.
  • 🛡️ End-to-end type safety - Shared method and type definitions keep client/server contracts aligned before runtime.
  • SkirRPC + Studio - Lightweight HTTP RPC with a built-in Studio app for browsing and testing methods.
  • 📦 GitHub imports - Import types directly from GitHub repositories to share data structures across projects.
  • 🔁 Serialization modes - Dense JSON for APIs/DBs, readable JSON for debugging, and binary for raw performance.
  • 🕰️ Safe schema evolution - Built-in checks and clear rules so old and new data remain deserializable.
  • 🧬 Rust-like enums - Variants can be constants or carry typed payloads for clean polymorphism.
  • 🔒 Immutable generated models - Deep immutability (except C++) with required fields at construction time.
  • 🗂️ Key-indexed arrays - Declare arrays like [User|user_id] and get fast key-based lookup APIs.
  • 🛠️ First-class tooling - VS Code extension + LSP with validation, completion, and auto-formatting.
  • 🧱 Easy to extend - Generators are regular NPM modules, so custom generators plug in cleanly.

⚡ Syntax example

// shapes.skir

struct Point {
  x: int32;
  y: int32;
  label: string;
}

struct Shape {
  points: [Point];
  /// A short string describing this shape.
  label: string;
}

const TOP_RIGHT_CORNER: Point = {
  x: 600,
  y: 400,
  label: "top-right corner",
};

/// Returns true if no part of the shape's boundary curves inward.
method IsConvex(Shape): bool = 12345;

Skir compiles these definitions into native, type-safe code you can use in your project:

# my_project.py

from skirout.shapes_skir import Point  # Python module generated by Skir

point = Point(x=3, y=4, label="P")

# Round–trip serialization to JSON
point_json = Point.serializer.to_json(point)
restored = Point.serializer.from_json(point_json)

assert(restored == point)

📚 Documentation

🌍 Supported languages

Language Documentation Example
🟦 TypeScript Documentation Example
🐍 Python Documentation Example
C++ Documentation Example
Java Documentation Example
💜 Kotlin Documentation Example
🦀 Rust Documentation Example
🐹 Go Documentation Example
🎯 Dart Documentation Example
🐦 Swift Documentation Example

Packages

 
 
 

Contributors