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

Crate Layout

brink is organized as a Cargo workspace with strict dependency rules. The central design principle is the firewall: brink-format is the only crate shared between the compiler and runtime.

Published crates

CratePathPurpose
brinkcrates/brink/Public API — re-exports from compiler and runtime
brink-compilercrates/brink-compiler/Pipeline driver: .ink to StoryData
brink-runtimecrates/brink-runtime/Bytecode VM for executing compiled stories
brink-clicrates/brink-cli/CLI tool: compile, convert, play, export-xliff, compile-locale, regenerate-xliff, fmt, replay
brink-lspcrates/brink-lsp/Language server for ink files
brink-webcrates/brink-web/WASM bindings for the IDE + runtime; powers the web playground
bevy-brinkcrates/bevy-brink/Bevy 0.18 integration: plugin, assets, components, external-function bindings

Internal crates

CratePathPurpose
brink-syntaxcrates/internal/brink-syntax/Lexer, parser, lossless CST, typed AST
brink-ircrates/internal/brink-ir/HIR + LIR intermediate representations, lowering
brink-analyzercrates/internal/brink-analyzer/Cross-file semantic analysis, symbol resolution
brink-drivercrates/internal/brink-driver/Pipeline orchestration: file discovery + cross-file analysis
brink-codegen-inkbcrates/internal/brink-codegen-inkb/Bytecode codegen: LIR to StoryData
brink-codegen-jsoncrates/internal/brink-codegen-json/JSON codegen: LIR to .ink.json (for diffing)
brink-formatcrates/internal/brink-format/Binary interface between compiler and runtime
brink-dbcrates/internal/brink-db/Incremental project database, file discovery
brink-jsoncrates/internal/brink-json/Parser for inklecate .ink.json output
brink-convertercrates/internal/brink-converter/Reference pipeline: .ink.json to StoryData
brink-fmtcrates/internal/brink-fmt/.ink source formatter (powers brink fmt)
brink-intlcrates/internal/brink-intl/Internationalization tooling: line export, XLIFF round-trip, .inkl compile, ICU plurals
xliff2crates/internal/xliff2/General-purpose XLIFF 2.0 read/write library
brink-idecrates/internal/brink-ide/Protocol-agnostic IDE query library (shared by the LSP/web)
bevy-brink-derivecrates/internal/bevy-brink-derive/Derive macros for bevy-brink (#[derive(BrinkCommand)])
brink-test-harnesscrates/internal/brink-test-harness/Episode-based behavioral testing (oracle corpus)

Internal crates have publish = false and are not published to crates.io.

Editor plugins

CratePathPurpose
zed-brinkcrates/zed-brink/Zed editor extension

Key dependency rules

  1. brink-runtime depends ONLY on brink-format — keeps the runtime minimal and embeddable
  2. brink-lsp depends on brink-analyzer, NOT on brink-compiler — the LSP needs parse through validation, not codegen
  3. brink-format has no brink-internal dependencies — it is the stable interface layer
  4. brink-format is the firewall — source-level concepts never leak into the runtime

These rules enable hot-reload (runtime loads new bytecode without the compiler), compile-time isolation (changing compiler internals doesn’t rebuild the runtime), and small runtime binaries for embedding.

Workspace conventions

  • Dependencies are declared in [workspace.dependencies] in the root Cargo.toml and referenced via dep.workspace = true in each crate
  • Lints are configured in [workspace.lints] and inherited via [lints] workspace = true
  • Edition, license, repository are set in [workspace.package] and inherited with field.workspace = true