tldraw/tldraw
Glossary
Project-specific terms used throughout the codebase. When a name has both a short form and a record-typed form (e.g. "shape" vs TLShape), the runtime types use the TL prefix.
Core concepts
- Editor — the central runtime object. Owns the store, the camera, the history manager, and the state-node tree. Defined in
packages/editor/src/lib/editor/Editor.ts. - Store — the in-memory reactive database of records. See
packages/store/src/lib/Store.ts. - Record — a single typed object stored in the store. Every record has an id of the form
<type>:<unique>. Defined inpackages/store/src/lib/BaseRecord.ts. - Schema — the registry of record types and their migrations. See
packages/tlschema/src/createTLSchema.ts. - Migration — a versioned transformation of a record between schema versions. See
packages/store/src/lib/migrate.tsandpackages/tlschema/src/store-migrations.ts. - Side effect — a hook that runs before or after store changes. Used by the editor to keep derived state correct. See
packages/store/src/lib/StoreSideEffects.ts.
Document model
- TLShape — a shape record.
TLBaseShapeis the generic base; concrete types includeTLArrowShape,TLDrawShape,TLGeoShape,TLNoteShape,TLLineShape,TLTextShape,TLImageShape,TLVideoShape,TLBookmarkShape,TLEmbedShape,TLFrameShape,TLHighlightShape,TLGroupShape. Seepackages/tlschema/src/shapes/. - TLBinding — a relationship between two shapes (an arrow's endpoint bound to a shape, for instance). See
packages/tlschema/src/records/TLBinding.tsandpackages/tlschema/src/bindings/. - TLAsset — a stored asset (image, video, bookmark) referenced by a shape. See
packages/tlschema/src/records/TLAsset.ts. - TLDocument — the root document record (singleton). One per store.
- TLPage — a page within a document.
- TLPageState — per-page editor state (selection, hovered shape, focus layer).
- TLInstance — per-instance editor state (current page, current tool, color theme).
- TLInstancePresence — multiplayer presence (cursor position, selection) for one user. See
packages/tlschema/src/records/TLPresence.ts. - TLCamera — viewport position and zoom for an instance/page.
- TLPointer — local pointer state.
- TLUser — user record (theme preferences, name, color).
Behavior
- ShapeUtil — the class that defines a shape's geometry, rendering, handles, hit-testing, and export behavior. Base class in
packages/editor/src/lib/editor/shapes/ShapeUtil.ts. Concrete implementations live inpackages/tldraw/src/lib/shapes/<kind>/<Kind>ShapeUtil.tsx. - BindingUtil — analogous utility for bindings. Defined under
packages/editor/src/lib/editor/bindings/with concrete types inpackages/tldraw/src/lib/bindings/. - StateNode — a node in the editor's state-machine tree. Tools are state nodes; complex tools have child states. Defined in
packages/editor/src/lib/editor/tools/StateNode.ts. - Tool — a top-level state node bound to a UI affordance (Select, Hand, Draw, Eraser, Text, Frame, Note, Arrow, Geo, Line, Highlight, Laser, Zoom).
- Manager — a focused subsystem that the
Editorcomposes. The set is inpackages/editor/src/lib/editor/managers/.
Reactive primitives
- Atom — writable signal. From
packages/state/src/lib/Atom.ts. - Computed — derived signal that tracks its dependencies. From
packages/state/src/lib/Computed.ts. - Reactor / EffectScheduler — runs side-effecting reactions to signal changes. From
packages/state/src/lib/EffectScheduler.ts. - transact — batches signal mutations into a single notification cycle. See
packages/state/src/lib/transactions.ts. - react / useValue — React hooks from
packages/state-react/.
Sync
- TLSocketRoom — server-side multiplayer room.
packages/sync-core/src/lib/TLSocketRoom.ts. - TLSyncRoom — the canonical record store and merge engine inside a room.
packages/sync-core/src/lib/TLSyncRoom.ts. - TLSyncClient — the client side of the sync protocol.
packages/sync-core/src/lib/TLSyncClient.ts. - ClientWebSocketAdapter / ServerSocketAdapter — transport-layer adapters.
- RoomSession — a single client's connection to a room.
packages/sync-core/src/lib/RoomSession.ts. - useSync / useSyncDemo — React hooks in
packages/sync/src/.
SDK and apps
- tldraw (lowercase) — the npm package and React component.
<Tldraw />is exported frompackages/tldraw/src/lib/Tldraw.tsx. - tldraw.com — the hosted app at
apps/dotcom/. - tla — short for "tldraw app", the signed-in folders/files area at
apps/dotcom/client/src/tla/. - bemo-worker — the demo sync worker for
useSyncDemo.apps/bemo-worker/. - zero-cache —
apps/dotcom/zero-cache/, the Zero view-syncer that replicates the Postgres app database to clients. - dotcom-shared —
packages/dotcom-shared/, types shared between the dotcom client and its workers. - worker-shared —
packages/worker-shared/, helpers used by multiple Cloudflare workers. - lazyrepo — the task runner used for incremental builds.
- huppy —
internal/huppy/, an internal automation bot (referenced inpackage.jsonand CI).
Conventions
- Sentence case for headings, labels, and PR titles.
TLprefix for record-typed values shipped by the schema.@public/@internalTSDoc tags driveapi-extractorreports under each package'sapi/directory.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.