atproto_codegen

Alpha. Pre-1.0 and evolving alongside at-record; expect breaking changes between 0.x releases.

Generate Gleam types and JSON codecs from atproto lexicon files: records and objects with string/integer/number/boolean/array/ref/ cid-link/bytes/blob/unknown fields. Unsupported defs (e.g. union) are reported and skipped, never emitted wrong.

Usage

gleam run -m atproto_codegen -- <lexicons_dir> <out_dir> <out_module> <nsid_prefix>[,<nsid_prefix>...]
# e.g.
gleam run -m atproto_codegen -- ./lexicons ./src/my_app/gen my_app/gen com.example.myapp.,com.atproto.

Generated blob fields use atproto/blob from the atproto_client package, so projects consuming generated code with blobs need that dependency.

Lexicon coverage

record and object defs. Refs resolve across lexicons (a bare NSID ref points at that lexicon’s main def). knownValues string sets map to plain String; unknown round-trips through a Dynamic passthrough.

Search Document