Skip to content

gepheum/skir

Repository files navigation

Skir

A modern alternative to Protocol Buffer

skir.build

npm build

quick-example


Skir is a universal language for representing data types, constants, and RPC interfaces. Define your schema once in a .skir file and generate idiomatic, type-safe code in TypeScript, Python, Java, C++, and more.

✨ Features

  • 💎 Single source of truth - Define your data types and APIs once and share them between your backend, frontend, and microservices.
  • 🌍 Multi-language - First-class support for TypeScript, Python, C++, Java, Kotlin, and Dart.
  • ✍️ Idiomatic code gen - Generates code that feels native to each language.
  • 🍃 Effortless serialization - Skir generates functions to serialize your data to JSON or binary, so you never have to write parsing code manually.
  • 🦋 Schema evolution - Simple guidelines and built-in checks to evolve your schema without breaking backward compatibility.
  • 🤝 RPCs with end-to-end type safety - Like tRPC, but for every language. Call your backend functions directly from your frontend or microservices with full compile-time safety.
  • 🛠️ Delightful developer experience - Automatic recompilation in watch mode, built-in code formatter, official VSCode extension.
  • 📦 Built-in package manager - Import types from other GitHub repositories to easily share common data structures across projects.
  • 🍃 Easy setup - Get started with npx skir init, manage your entire project configuration from a single YAML file.

⚡ 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
🎯 Dart Documentation Example

Packages

 
 
 

Contributors