Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Grounds

TypeScript implementation of Relish, a compact binary serialization format.

What is Relish?

Relish is a Type-Length-Value (TLV) encoding format designed by Alex Gaynor. It provides:

  • Compact binary representation - smaller than JSON, competitive with Protocol Buffers
  • Self-describing format - can decode without schema (for debugging)
  • Schema-driven usage - type-safe encoding with TypeScript schemas
  • Streaming support - encode and decode incrementally

For the complete format specification, see the Relish Spec.

Packages

Grounds provides three packages:

Quick Example

import { RStruct, RString, RU32, field, createCodec } from "@grounds/schema";

// Define a schema
const UserSchema = RStruct({
  name: field(0, RString()),
  age: field(1, RU32()),
});

// Create a codec
const codec = createCodec(UserSchema);

// Encode
codec.encode({ name: "Alice", age: 30 }).match(
  (bytes) => console.log("Encoded:", bytes.length, "bytes"),
  (err) => console.error("Failed:", err.message),
);

Getting Started

New to Grounds? Start with Installation to set up your project.

Learn More