bricks ctor command group — there is no separate npm package to install.
Generated projects don’t depend on an npm package for BRICKS. The CLI materializes a typed
bricks-ctor library into a local ctor/ directory, and the project’s tsconfig.json maps the bricks-ctor import alias to it — so import ... from 'bricks-ctor' works with no dependency.Why code?
- Type safety — catch errors at compile time with full TypeScript support
- Version control — track changes with Git, review diffs, and collaborate
- AI-assisted development — work with AI coding agents that can read and write your project files
- Automation — deploy via CLI or CI/CD pipelines like GitHub Actions
Core concepts
A BRICKS application is a tree of composable entities. Here’s how they fit together:Subspaces
A subspace is a self-contained unit of functionality — think of it as a screen or feature module. Each subspace has its own bricks, generators, data, canvases, and animations. The application has arootSubspace as its entry point.
Canvases
A canvas defines a view layout. It positions items (bricks or subspace references) on a grid usingframe coordinates (x, y, width, height). Canvases support lifecycle events (firstEnter, enter, exit) and can switch between each other for navigation.
Bricks
Bricks are the visual building blocks — UI components that display content and handle interaction. Examples include:
Bricks can be styled, animated, respond to press events, and have their properties dynamically bound to data.
Generators
Generators handle all external I/O and data processing. They connect your app to APIs, databases, hardware, AI models, and more. Each generator has outlets (output channels) that feed into data, and events that trigger actions. Categories of generators include:Data
Data nodes store application state. They are typed (string, number, boolean, array, object) and can be linked to brick or generator properties for reactive updates. When a generator outlet emits a value, the linked data updates, and any bricks bound to that data re-render automatically.Data calculations
Data calculations are JavaScript functions that transform data. They run in a sandboxed environment with 25+ built-in libraries (lodash, moment, crypto, and more). Use them for formatting, parsing, or computing derived values.Actions and events
Actions are commands triggered by events. Bricks and generators emit events (press, response, error, timer tick), and you wire them to actions like changing a canvas, updating data, triggering a generator, or running an animation.Project structure
A BRICKS project has the following structure:bun compile (which runs bricks ctor compile under the hood) transforms them into the JSON configuration that the BRICKS runtime executes.
Next steps
Get started
Set up your environment and create your first BRICKS project.