Pre-release: not everything will work as expected

Matt's Lexicon Format

A human-friendly DSL for ATProto Lexicons

com.example.thread.mlf

/// A forum thread
record thread {
    /// Thread title
    title!: string constrained {
        maxLength: 200,
        minLength: 1,
    },
    /// Thread body content
    body!: string constrained {
        maxLength: 10000,
    },
    /// Thread creation timestamp
    createdAt!: Datetime,
};

com/example/thread.json

{
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "id": "com.example.thread",
  "defs": {
    "main": {
      "type": "record",
      "description": "A forum thread",
      "key": "tid",
      "record": {
        "type": "object",
        "required": ["title", "body", "createdAt"],
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "description": "Thread title"
          },
          "body": {
            "type": "string",
            "maxLength": 10000,
            "description": "Thread body content"
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "Thread creation timestamp"
          }
        }
      }
    }
  }
}

What is MLF?

Human-Friendly Syntax

Clean, readable syntax inspired by TypeScript and Rust. Write lexicons the way you think about them, with full type safety and constraint validation.

100% ATProto Fidelity

Bidirectional conversion with ATProto JSON Lexicons. Everything that can be expressed in JSON can be expressed in MLF, and vice versa.

Rich Tooling

Command-line interface, WebAssembly library, tree-sitter grammar for editor integration (Neovim, Helix, VS Code, Emacs), and comprehensive error messages.

Type-Safe

Compile-time type checking catches errors before they become runtime problems. Constrained types ensure your data meets specifications.