API index
Every documented export, with the page that covers it. Use Ctrl/⌘+F.
For an explanation rather than a lookup, start from the Guide. Coding agents: llms.txt and coding agents.
Primitives
| Symbol | What it does | Page |
|---|---|---|
state | Signal-based state you own | Local state |
craftStateMachine | Declarative finite-state workflow | State machines |
query | Server data, re-fetched from reactive params | query |
mutation | Server write, triggered explicitly | Mutations |
queryParams | State that lives in the URL query string | queryParams |
asyncProcess | One-off async operation with lifecycle state | asyncProcess |
craftUse | Drives a primitive outside a generator (component field) | Learn 1 |
Not sure which one: Which primitive should I use?
Runtime context
Typed helpers that recover get / set / update / patch from DI, for wrappers, WebMCP tools, and other advanced patterns. Everyday insertions already receive those methods as arguments — see Anatomy of a primitive.
| Symbol | What it does | Page |
|---|---|---|
injectStateMethodRuntimeContext | state writes inside an insertion method | Anatomy |
injectQueryMethodRuntimeContext | query writes inside an insertion method | Anatomy |
injectMutationMethodRuntimeContext | mutation writes inside an insertion method | Anatomy |
injectQueryParamsMethodRuntimeContext | queryParams writes inside an insertion method | Anatomy |
injectAsyncProcessMethodRuntimeContext | asyncProcess writes inside an insertion method | Anatomy |
injectPrimitiveMethodRuntimeContext | Same context, untyped kind | Anatomy |
providePrimitiveResourceRuntimeObserver | Observes query / mutation / asyncProcess / queryParams values | Anatomy |
Composition
| Symbol | What it does | Page |
|---|---|---|
craftPipe | Composes several insertions into one | Insertions |
craftYieldRecord | Resolves a record of primitive generators | craftService |
insertStatePipe | Composes several state insertions | Typed insertion pipes |
insertQueryPipe | Composes several query insertions | Typed insertion pipes |
insertMutationPipe | Composes several mutation insertions | Typed insertion pipes |
insertQueryParamsPipe | Composes several queryParams insertions | Typed insertion pipes |
insertAsyncProcessPipe | Composes several asyncProcess insertions | Typed insertion pipes |
insertStateMachinePipe | Composes several craftStateMachine insertions | Typed insertion pipes |
craftGen | A standalone tracked generator | Generators |
craftMatch | Exhaustive pattern matching | Pattern matching |
.pipe(...) | Program operators on a craft generator | Program operators |
catchTag, retry | Operators for .pipe(...) | Program operators |
Insertions
| Symbol | What it does | Page |
|---|---|---|
insertSelect | Derives a slice of a primitive | Selecting |
insertEntities | Entity collection storage and updates | Collections |
insertStoragePersister | Persists through the configured storage backend | Persistence |
insertReactOnMutation | Reloads / optimistically patches on a mutation | React on mutation |
insertPaginationPlaceholderData | Placeholder rows while a page loads | Pagination placeholder |
Forms
| Symbol | What it does | Page |
|---|---|---|
insertForm | Derives a form from a state | Forms |
insertFormAttributes | Validators, disable, hidden | Forms |
insertSelectFormTree | Targets a field sub-tree | Nested forms |
insertSubFormField | A nested sub-form | Nested forms |
insertFormSubmit | Wires submission to a mutation | Submitting |
insertNoopTypingAnchor | Type anchor required per field tree | Forms |
CraftFieldDirective | Binds a typed field to a Craft DOM node | Forms |
fieldErrorNode.exhaustive / .partial | Exhaustive or partial validation rendering | Forms |
cRequired, cEmail, cMin/cMax, cMinLength/cMaxLength, cPattern | Built-in validators | Validators |
cValidate, cAsyncValidate | Custom and async validators | Validators |
Services and DI
| Symbol | What it does | Page |
|---|---|---|
craftService | Declares a named, scoped service | craftService |
abstract | Declares a contract with no implementation | Abstract services |
X.OmitInputs | Opts out of a service's input bindings | Public API |
onAppStart | Startup callback owned by a service | App start |
craftLazy | Defers a service's instantiation | Lazy services |
craftRegisterFor | Registry-driven service resolution | Register |
provideCraftTargetWrapper | Wraps craft targets at a provider boundary | Target wrapper |
provideTemplateTrace | Wraps effective template renders | Observability |
provideCraftRouterTrace | Wraps Router events and Craft route stages | Observability |
provideCraftHttpTrace | Wraps CraftHttpClient requests | Observability |
craftAppConfig | Application config with the routing graph | Routing setup |
Routing
| Symbol | What it does | Page |
|---|---|---|
craftRoute, craftRoutes | Declares typed routes and collections | Setup |
RouteCheckedDI, CanRun | Compile-time DI check for a routed component | Setup |
.withParent, ParentRoutes, assertChildRouteMounts | Pins a child collection to its mount | Scaling routes |
withRetry | Retryable lazy loadComponent / loadChildren | Setup |
provideCraftRouter, provideCraftLoading | Router with craft loading features | Pending UI |
withA11yNavigationFocus, CraftTitleStrategy | Focus after nav; route title → document | Accessibility |
heading, headingSection, headingRoot, skipLink, liveRegion, fieldControl, disclosureControl, buttonControl, clickFocus | Relative outline, skip link, live regions, accessible control props, focus | Accessibility |
withErrorComponent, withRouteLoadError, withTransitionTimings | Router features | Route load errors |
CraftRouterOutlet | Non-blocking outlet | Pending UI |
craftRouterLink | Type-safe navigation target | Setup |
assertExhaustiveRouteExceptions | Exhaustiveness proof for route exceptions | Exceptions |
Server rendering
| Symbol | What it does | Page |
|---|---|---|
renderCraft, renderToString | Renders an isolated request to HTML, CSS, and a transfer snapshot | SSR and hydration |
startCraft | Hydrates an SSR host or mounts a fresh client application automatically | SSR and hydration |
hydrateCraft | Restores transferred state and claims the existing browser DOM | SSR and hydration |
pendingNode({ ssr }) | Declares block, fallback, or client behavior for suspended data | SSR and hydration |
CraftSsrPolicy, provideCraftSsrPolicy | Route-level default SSR policy | SSR and hydration |
CraftUnhandledSsrResolutionError, CraftSsrTimeoutError | Reports missing policies and timed-out blocking sources | SSR and hydration |
Exceptions
| Symbol | What it does | Page |
|---|---|---|
craftException | Creates a declared, typed exception | Exceptions |
craftExceptionHandler | Handles route exceptions | Exceptions |
.exceptions(), .hasException() | Reads a primitive's exceptions by origin | query |
globalError() | Delegates to the global error component | Global error component |
Reactivity
| Symbol | What it does | Page |
|---|---|---|
craftComputed | Tracked computed | craftComputed |
craftEffect | Tracked effect | craftEffect |
craftMethod | A tracked method on a primitive | craftMethod |
source$ | An imperative event source | source$ |
on$ | Binds a method to a source | on$ |
fromEventToSource$ | DOM event → source | fromEventToSource$ |
sourceFromEvent | Event-driven source helper | sourceFromEvent |
afterRecomputation | Runs after a recomputation settles | afterRecomputation |
HTTP and boundaries
| Symbol | What it does | Page |
|---|---|---|
CraftHttpClient | Tracked HTTP client with typed exceptions | query |
CraftBinaryHttpClient | Tracked raw-body HTTP PUT for binary uploads | query |
browserBoundary | Marks a service as a browser boundary | Browser boundaries |
BrowserDocument, BrowserDocument.setLang, BrowserDocument.setDir | Reads and updates document title, language, and direction | Browser boundaries |
Console | Yieldable console, overridable for tracing | Observability |
Testing
| Symbol | What it does | Page |
|---|---|---|
setupCraftServiceTestingByRegister | Sets up a service from a full register | Testing services |
boundaryOnly | Keeps the graph real, mocks boundaries | Browser boundaries |
mockHttpRequestForRoute | Mocks endpoints for a route | Browser boundaries |
ComponentTemplateOf, ComponentLogicOutputOf, SetupTestComponentTemplate | Resolves component logic and validates a template at compile time | Type-level tests |
TemplateHasElement, TemplateRendersNamedElementWhen, TemplateNamedElementRendersStateWhen, TemplateNamedElementDelegatesToContext, TemplateRenderAvailableActionWhen | Proves what a template renders and uses | Type-level tests |
Expect, Equal | Turns a type-level result into a compile-time assertion | Type-level tests |
createArchitectureGraph, noExclusiveLink, assertCraftUnique, assertHttpEndpointUnique, assertCraftComputedPure, assertNoDependencyCycles, assertDeclarativeArchitecture, assertInputActionForms, assertRouteDiProofs, assertPathBoundaries, assertMutationHasReactOn, assertPrimitiveLoaderRequirements, assertQueryMutationHasServerState, assertResourceParamsPreferQueryParams, assertPersistedPrimitiveHasUnique, assertInsertSelectUnique, assertCraftEffectNoNetwork, assertCraftEffectNoImperativeSync, assertInteractiveElementNamed, assertMetricThresholds | Typed lookups and declarative architecture helpers | Architecture rules |
Effect integration
@craft-ts/effect, in full. The guide is Effect integration.
| Symbol | What it does | Page |
|---|---|---|
installCraftEffectBridge | Installs both bridges once, at bootstrap | Install the bridge |
queryEffect, mutationEffect, asyncProcessEffect, computedEffect, methodEffect | The Effect-backed adapters of the Craft primitives | Choose the right adapter |
runEffect, CraftEffectInterrupted | Yields one Effect and maps its exit onto Craft's channels | runEffect |
syncEffect, SyncOp, CraftEffectNotSynchronous, NotDeclaredSynchronous | Declares and runs an Effect that never suspends | Synchronous members |
transitionGuardEffect | Guards a state-machine transition with a synchronous Effect | State-machine guards |
provideLayer | Attaches a built Effect context to a Craft injector | Provide services with Layer |
effectService, SelectedMembers | Selects a service from a Craft factory, recording the dependency | Select a service |
mockEffectService, UnstubbedEffectMember | A focused Layer for tests; an unstubbed member fails loudly | Testing |
EffectRequirementsCheckedDI, ProvidedEffectServicesOf, ProvidedEffectServicesOfRoute | The route-level proof that every requirement is provided | Provide services with Layer |
effectServerMiddleware, executeEffect, EffectServerMiddleware, EffectServerMiddlewareContext | Effect middleware and execution for server functions | Server functions POC |
Lower-level exports
Public, but rarely needed directly. They exist for wrappers, generated code and tooling rather than for application code.
| Symbol | What it is |
|---|---|
composeEffect | Composes yieldable Effect middleware in declaration order, without continuations. effectServerMiddleware is the everyday door. |
runYieldedEffect | The single-Effect runner the bridge itself calls. Use runEffect, which keeps the call site blamable. |
assertNoRequirements, AssertNoRequirements, MissingRequirements, RealRequirements, CraftPhantomRequirement | Moves the R = never check to the yield site, so an unmet requirement points at the offending line instead of surfacing at runtime. CraftPhantomRequirement is what excludes SyncOp from that check. |
CRAFT_EFFECT_LEVEL, resolveEffectLevel, CraftEffectLevel | The per-injector Effect level: the built context, a MemoMap forked from the parent's, and a scope closed with the injector. Read it when writing your own provider; provideLayer is the normal way in. |
AsEffect, CraftProgramSuccess, CraftProgramExceptions | A type-only projection of a Craft program onto Effect<A, E>. It changes no runtime behaviour; it exists so a hover tooltip reads Effect<User, UserNotFound> instead of a raw generator type. |
installCraftSyncEffectBridge | Already installed by installCraftEffectBridge. Call it directly only in a host that installs the synchronous bridge alone. |
Typed styles
@craft-ts/style is a build step: none of these symbols emit anything without craftStyle from @craft-ts/style/vite in the Vite config. See Activating the style system.
| Symbol | What it does | Page |
|---|---|---|
craftStyle, emitStyles, renderCss, styleDump, findStyleModules | The build-time emitter and its artefacts (@craft-ts/style/vite) | Activating the style system |
definePalette, darkOf, palette | Colour tokens carrying both of their values, plus the default set | Defining a design system |
defineBreakpoints, at, above, below | The viewport axis, as an ordered one | Defining a design system |
defineStateAxis, defineAxis, onlyVarsOfKind, axisPoint | Attribute-driven axes, with an optional write constraint | Defining a design system |
defineContainer | A container axis, closed at the element that declares the container | Defining a design system |
scheme, motion, forcedColors, contrast, scrollState, descendant | The standard axes, driven by the user agent or by element state | Axes and the matrix |
cssVars, kind, assign, set | Typed custom properties, registered through @property | Tokens and variables |
space, unit, radii, radius, lineWidth, num, text, font | The closed value scales — no value is a string | Tokens and variables |
unsafeLength, unsafeAssume | The marked escape hatches; both propagate unproven | Tokens and variables |
craftStyles, when | A sheet, and conjunction by nesting | Axes and the matrix |
requires, provides, declares, seal, scrollPort, noClipping, containerType, clipOverflow | Context obligations, and where they become an error | Context obligations |
visualMatrix, applyScenario, branch, contentCases, assertExhaustiveVisualMatrix, baselinesIn | The scenario matrix (@craft-ts/style-testing) | Testing visual states |
matrixSizeByComponent, impactedClasses, varsWrittenBy, danglingVars, unproven, extractionGaps, undischargedObligations | Graph queries over the style dump (@craft-ts/dev-tools) | Testing visual states |
style_impact, style_matrix, style_debt | The same questions as MCP tools | Testing visual states |
Internationalisation
@craft-ts/i18n is the CraftTS i18n integration: the catalogue stays a plain TypeScript value, and a token may resolve a Craft service or parse its parameter with a Standard Schema. The package imports core for types only.
| Symbol | What it does | Page |
|---|---|---|
defineCatalog, msg, plural | The catalogue, its messages, and per-locale plural categories | The catalogue |
defineLocale, defineLocaleLike | The reference locale, and every other one checked against it | The catalogue |
number, integer, percent, compactNumber, money, dateShort, dateLong, dateTime, relativeTime | The shipped semantic tokens, formatted through Intl | Tokens |
defineToken, defineTokenFactory, formatters, TokenFormatter, FormatterContext | Project tokens, and the factory the shipped ones are built from | Tokens |
createI18nRuntime, translate / t, setLocale, locale | The runtime and its one active locale | The runtime |
TranslationDependencies, StaticTranslationKey | The services a message resolves, and the keys t can render alone | The runtime |
TokenSchema, TokenSchemaInput, TokenSchemaOutput, TokenFactory | Declaring a parameter with a Standard Schema | Tokens |
bind, createReactiveTranslator | A translator that re-reads when the locale state changes | The runtime |
createI18nLoader, loadLocale | Lazy locales, cached by id, evicted on failure | The runtime |
validateCatalog, assertValidCatalog, validateLocaleParity, assertLocaleParity | The checks behind npm run i18n:check (also @craft-ts/i18n/testing) | The catalogue |
serializeCatalog, serializeToken | JSON-safe delivery shape; refuses a token that resolves a service | The catalogue |
I18nRuntimeError | LOCALE_NOT_LOADED, MISSING_PARAM, INVALID_PARAM, CRAFT_INJECTION_REQUIRED, … | The runtime |
provideI18nRuntime, translateEffect, I18nEffectService | The Effect adapter (@craft-ts/i18n-effect) | With Effect |
Tooling
| Command / rule | What it does | Page |
|---|---|---|
npx craft route add | Scaffolds a typed route | Automation |
npx craft route split | Splits a flat collection | Scaling routes |
npx craft route verify | Optional compiler-fixture suite for the type machinery | Automation |
craft-brand --root src | Generates and refreshes GenDeps_* | Brand config |
@craft-ts/dev-tools/eslint-rules | The ESLint rule set | ESLint rules · Accessibility |
npx craft-graph | Writes the static Craft graph | Architecture rules · Craft graph vs Nx |
npx nx architecture <app> | Runs the app's architecture Vitest suite | Architecture rules · Craft graph vs Nx |
Live page MCP page | Drive the open ng serve tab (dev only) | Live page MCP |
| Template migrator | Migrates templates to craft components | Template migrator |
Deployment
Experimental
The deployment tooling is not settled: these symbols and commands can still change between minor versions. See the deployment guide for what exists today.
| Symbol / command | What it does | Page |
|---|---|---|
defineCraftDeployment | Declares the deployment of an application in craft.deploy.ts | Manifest reference |
checkCraftDeployment, checkCraftDeploymentArtifact | Runs the manifest, module graph and artefact checks | Diagnostics |
resolveCraftDeploymentManifest, serializeCraftDeploymentManifest, parseCraftDeploymentManifest | Resolves, writes and reads the provider-neutral artefact form | Manifest reference |
CraftDeploymentProvider, CRAFT_DEPLOYMENT_PROVIDERS | The provider contract and the capability matrix | Providers |
npx craft-ts check | Validates a deployment before building | Deployment overview |
npx craft-ts manifest | Writes dist/<app>/craft-deployment-manifest.json | Deployment overview |
npx craft-ts deploy preview | Shows what a provider would change, without changing it | Alchemy provider |
npx craft-ts deploy | Applies that plan once --yes approves it | Alchemy provider |
createCraftDeploymentProvider | The single factory a provider package exports | Providers |
createAlchemyDeploymentProvider, planAlchemyDeployment | The Alchemy provider and its Cloudflare/AWS planning | Alchemy provider |
npx craft-ts providers | Prints the provider capability matrix | Providers |