Show HN: Skir – like Protocol Buffer but better
3 days ago
- #type-safety
- #api-schema
- #declarative-programming
- Skir is a declarative language for defining data types, constants, and APIs.
- Write schema in .skir files and generate type-safe code in multiple languages (TypeScript, Python, Java, C++).
- Simple workflow: one YAML file and one command with watch mode for automatic recompilation.
- Generated code is idiomatic and native to each language.
- Example schema includes structs like `Point` and `Shape` with fields and documentation.
- Supports constants (e.g., `TOP_RIGHT_CORNER`) and immutable object creation.
- Serialization to dense JSON for compact storage and schema evolution.
- Built-in guidelines for safe schema evolution in distributed systems.
- Define API methods in Skir (similar to gRPC) to ensure client-server sync.
- Example API method `WhatToWear` with request/response structs.
- Supports remote invocation with generated client code.
- Full-stack applications can use Skir for data exchange between backend (e.g., Kotlin) and frontend (TypeScript).
- Multiple serialization options: dense JSON, readable JSON, or binary.
- Import types directly from GitHub repositories to share common data structures.
- VS Code extension with real-time validation, code completion, and formatting.
- Quick setup with a single YAML file for project configuration.