Skip to content

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 ​

SymbolWhat it doesPage
stateSignal-based state you ownLocal state
craftStateMachineDeclarative finite-state workflowState machines
queryServer data, re-fetched from reactive paramsquery
mutationServer write, triggered explicitlyMutations
queryParamsState that lives in the URL query stringqueryParams
asyncProcessOne-off async operation with lifecycle stateasyncProcess
craftUseDrives 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.

SymbolWhat it doesPage
injectStateMethodRuntimeContextstate writes inside an insertion methodAnatomy
injectQueryMethodRuntimeContextquery writes inside an insertion methodAnatomy
injectMutationMethodRuntimeContextmutation writes inside an insertion methodAnatomy
injectQueryParamsMethodRuntimeContextqueryParams writes inside an insertion methodAnatomy
injectAsyncProcessMethodRuntimeContextasyncProcess writes inside an insertion methodAnatomy
injectPrimitiveMethodRuntimeContextSame context, untyped kindAnatomy
providePrimitiveResourceRuntimeObserverObserves query / mutation / asyncProcess / queryParams valuesAnatomy

Composition ​

SymbolWhat it doesPage
craftPipeComposes several insertions into oneInsertions
craftYieldRecordResolves a record of primitive generatorscraftService
insertStatePipeComposes several state insertionsTyped insertion pipes
insertQueryPipeComposes several query insertionsTyped insertion pipes
insertMutationPipeComposes several mutation insertionsTyped insertion pipes
insertQueryParamsPipeComposes several queryParams insertionsTyped insertion pipes
insertAsyncProcessPipeComposes several asyncProcess insertionsTyped insertion pipes
insertStateMachinePipeComposes several craftStateMachine insertionsTyped insertion pipes
craftGenA standalone tracked generatorGenerators
craftMatchExhaustive pattern matchingPattern matching
.pipe(...)Program operators on a craft generatorProgram operators
catchTag, retryOperators for .pipe(...)Program operators

Insertions ​

SymbolWhat it doesPage
insertSelectDerives a slice of a primitiveSelecting
insertEntitiesEntity collection storage and updatesCollections
insertStoragePersisterPersists through the configured storage backendPersistence
insertReactOnMutationReloads / optimistically patches on a mutationReact on mutation
insertPaginationPlaceholderDataPlaceholder rows while a page loadsPagination placeholder

Forms ​

SymbolWhat it doesPage
insertFormDerives a form from a stateForms
insertFormAttributesValidators, disable, hiddenForms
insertSelectFormTreeTargets a field sub-treeNested forms
insertSubFormFieldA nested sub-formNested forms
insertFormSubmitWires submission to a mutationSubmitting
insertNoopTypingAnchorType anchor required per field treeForms
CraftFieldDirectiveBinds a typed field to a Craft DOM nodeForms
fieldErrorNode.exhaustive / .partialExhaustive or partial validation renderingForms
cRequired, cEmail, cMin/cMax, cMinLength/cMaxLength, cPatternBuilt-in validatorsValidators
cValidate, cAsyncValidateCustom and async validatorsValidators

Services and DI ​

SymbolWhat it doesPage
craftServiceDeclares a named, scoped servicecraftService
abstractDeclares a contract with no implementationAbstract services
X.OmitInputsOpts out of a service's input bindingsPublic API
onAppStartStartup callback owned by a serviceApp start
craftLazyDefers a service's instantiationLazy services
craftRegisterForRegistry-driven service resolutionRegister
provideCraftTargetWrapperWraps craft targets at a provider boundaryTarget wrapper
provideTemplateTraceWraps effective template rendersObservability
provideCraftRouterTraceWraps Router events and Craft route stagesObservability
provideCraftHttpTraceWraps CraftHttpClient requestsObservability
craftAppConfigApplication config with the routing graphRouting setup

Routing ​

SymbolWhat it doesPage
craftRoute, craftRoutesDeclares typed routes and collectionsSetup
RouteCheckedDI, CanRunCompile-time DI check for a routed componentSetup
.withParent, ParentRoutes, assertChildRouteMountsPins a child collection to its mountScaling routes
withRetryRetryable lazy loadComponent / loadChildrenSetup
provideCraftRouter, provideCraftLoadingRouter with craft loading featuresPending UI
withA11yNavigationFocus, CraftTitleStrategyFocus after nav; route title → documentAccessibility
heading, headingSection, headingRoot, skipLink, liveRegion, fieldControl, disclosureControl, buttonControl, clickFocusRelative outline, skip link, live regions, accessible control props, focusAccessibility
withErrorComponent, withRouteLoadError, withTransitionTimingsRouter featuresRoute load errors
CraftRouterOutletNon-blocking outletPending UI
craftRouterLinkType-safe navigation targetSetup
assertExhaustiveRouteExceptionsExhaustiveness proof for route exceptionsExceptions

Server rendering ​

SymbolWhat it doesPage
renderCraft, renderToStringRenders an isolated request to HTML, CSS, and a transfer snapshotSSR and hydration
startCraftHydrates an SSR host or mounts a fresh client application automaticallySSR and hydration
hydrateCraftRestores transferred state and claims the existing browser DOMSSR and hydration
pendingNode({ ssr })Declares block, fallback, or client behavior for suspended dataSSR and hydration
CraftSsrPolicy, provideCraftSsrPolicyRoute-level default SSR policySSR and hydration
CraftUnhandledSsrResolutionError, CraftSsrTimeoutErrorReports missing policies and timed-out blocking sourcesSSR and hydration

Exceptions ​

SymbolWhat it doesPage
craftExceptionCreates a declared, typed exceptionExceptions
craftExceptionHandlerHandles route exceptionsExceptions
.exceptions(), .hasException()Reads a primitive's exceptions by originquery
globalError()Delegates to the global error componentGlobal error component

Reactivity ​

SymbolWhat it doesPage
craftComputedTracked computedcraftComputed
craftEffectTracked effectcraftEffect
craftMethodA tracked method on a primitivecraftMethod
source$An imperative event sourcesource$
on$Binds a method to a sourceon$
fromEventToSource$DOM event → sourcefromEventToSource$
sourceFromEventEvent-driven source helpersourceFromEvent
afterRecomputationRuns after a recomputation settlesafterRecomputation

HTTP and boundaries ​

SymbolWhat it doesPage
CraftHttpClientTracked HTTP client with typed exceptionsquery
CraftBinaryHttpClientTracked raw-body HTTP PUT for binary uploadsquery
browserBoundaryMarks a service as a browser boundaryBrowser boundaries
BrowserDocument, BrowserDocument.setLang, BrowserDocument.setDirReads and updates document title, language, and directionBrowser boundaries
ConsoleYieldable console, overridable for tracingObservability

Testing ​

SymbolWhat it doesPage
setupCraftServiceTestingByRegisterSets up a service from a full registerTesting services
boundaryOnlyKeeps the graph real, mocks boundariesBrowser boundaries
mockHttpRequestForRouteMocks endpoints for a routeBrowser boundaries
ComponentTemplateOf, ComponentLogicOutputOf, SetupTestComponentTemplateResolves component logic and validates a template at compile timeType-level tests
TemplateHasElement, TemplateRendersNamedElementWhen, TemplateNamedElementRendersStateWhen, TemplateNamedElementDelegatesToContext, TemplateRenderAvailableActionWhenProves what a template renders and usesType-level tests
Expect, EqualTurns a type-level result into a compile-time assertionType-level tests
createArchitectureGraph, noExclusiveLink, assertCraftUnique, assertHttpEndpointUnique, assertCraftComputedPure, assertNoDependencyCycles, assertDeclarativeArchitecture, assertInputActionForms, assertRouteDiProofs, assertPathBoundaries, assertMutationHasReactOn, assertPrimitiveLoaderRequirements, assertQueryMutationHasServerState, assertResourceParamsPreferQueryParams, assertPersistedPrimitiveHasUnique, assertInsertSelectUnique, assertCraftEffectNoNetwork, assertCraftEffectNoImperativeSync, assertInteractiveElementNamed, assertMetricThresholdsTyped lookups and declarative architecture helpersArchitecture rules

Effect integration ​

@craft-ts/effect, in full. The guide is Effect integration.

SymbolWhat it doesPage
installCraftEffectBridgeInstalls both bridges once, at bootstrapInstall the bridge
queryEffect, mutationEffect, asyncProcessEffect, computedEffect, methodEffectThe Effect-backed adapters of the Craft primitivesChoose the right adapter
runEffect, CraftEffectInterruptedYields one Effect and maps its exit onto Craft's channelsrunEffect
syncEffect, SyncOp, CraftEffectNotSynchronous, NotDeclaredSynchronousDeclares and runs an Effect that never suspendsSynchronous members
transitionGuardEffectGuards a state-machine transition with a synchronous EffectState-machine guards
provideLayerAttaches a built Effect context to a Craft injectorProvide services with Layer
effectService, SelectedMembersSelects a service from a Craft factory, recording the dependencySelect a service
mockEffectService, UnstubbedEffectMemberA focused Layer for tests; an unstubbed member fails loudlyTesting
EffectRequirementsCheckedDI, ProvidedEffectServicesOf, ProvidedEffectServicesOfRouteThe route-level proof that every requirement is providedProvide services with Layer
effectServerMiddleware, executeEffect, EffectServerMiddleware, EffectServerMiddlewareContextEffect middleware and execution for server functionsServer functions POC

Lower-level exports ​

Public, but rarely needed directly. They exist for wrappers, generated code and tooling rather than for application code.

SymbolWhat it is
composeEffectComposes yieldable Effect middleware in declaration order, without continuations. effectServerMiddleware is the everyday door.
runYieldedEffectThe single-Effect runner the bridge itself calls. Use runEffect, which keeps the call site blamable.
assertNoRequirements, AssertNoRequirements, MissingRequirements, RealRequirements, CraftPhantomRequirementMoves 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, CraftEffectLevelThe 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, CraftProgramExceptionsA 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.
installCraftSyncEffectBridgeAlready 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.

SymbolWhat it doesPage
craftStyle, emitStyles, renderCss, styleDump, findStyleModulesThe build-time emitter and its artefacts (@craft-ts/style/vite)Activating the style system
definePalette, darkOf, paletteColour tokens carrying both of their values, plus the default setDefining a design system
defineBreakpoints, at, above, belowThe viewport axis, as an ordered oneDefining a design system
defineStateAxis, defineAxis, onlyVarsOfKind, axisPointAttribute-driven axes, with an optional write constraintDefining a design system
defineContainerA container axis, closed at the element that declares the containerDefining a design system
scheme, motion, forcedColors, contrast, scrollState, descendantThe standard axes, driven by the user agent or by element stateAxes and the matrix
cssVars, kind, assign, setTyped custom properties, registered through @propertyTokens and variables
space, unit, radii, radius, lineWidth, num, text, fontThe closed value scales — no value is a stringTokens and variables
unsafeLength, unsafeAssumeThe marked escape hatches; both propagate unprovenTokens and variables
craftStyles, whenA sheet, and conjunction by nestingAxes and the matrix
requires, provides, declares, seal, scrollPort, noClipping, containerType, clipOverflowContext obligations, and where they become an errorContext obligations
visualMatrix, applyScenario, branch, contentCases, assertExhaustiveVisualMatrix, baselinesInThe scenario matrix (@craft-ts/style-testing)Testing visual states
matrixSizeByComponent, impactedClasses, varsWrittenBy, danglingVars, unproven, extractionGaps, undischargedObligationsGraph queries over the style dump (@craft-ts/dev-tools)Testing visual states
style_impact, style_matrix, style_debtThe same questions as MCP toolsTesting 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.

SymbolWhat it doesPage
defineCatalog, msg, pluralThe catalogue, its messages, and per-locale plural categoriesThe catalogue
defineLocale, defineLocaleLikeThe reference locale, and every other one checked against itThe catalogue
number, integer, percent, compactNumber, money, dateShort, dateLong, dateTime, relativeTimeThe shipped semantic tokens, formatted through IntlTokens
defineToken, defineTokenFactory, formatters, TokenFormatter, FormatterContextProject tokens, and the factory the shipped ones are built fromTokens
createI18nRuntime, translate / t, setLocale, localeThe runtime and its one active localeThe runtime
TranslationDependencies, StaticTranslationKeyThe services a message resolves, and the keys t can render aloneThe runtime
TokenSchema, TokenSchemaInput, TokenSchemaOutput, TokenFactoryDeclaring a parameter with a Standard SchemaTokens
bind, createReactiveTranslatorA translator that re-reads when the locale state changesThe runtime
createI18nLoader, loadLocaleLazy locales, cached by id, evicted on failureThe runtime
validateCatalog, assertValidCatalog, validateLocaleParity, assertLocaleParityThe checks behind npm run i18n:check (also @craft-ts/i18n/testing)The catalogue
serializeCatalog, serializeTokenJSON-safe delivery shape; refuses a token that resolves a serviceThe catalogue
I18nRuntimeErrorLOCALE_NOT_LOADED, MISSING_PARAM, INVALID_PARAM, CRAFT_INJECTION_REQUIRED, …The runtime
provideI18nRuntime, translateEffect, I18nEffectServiceThe Effect adapter (@craft-ts/i18n-effect)With Effect

Tooling ​

Command / ruleWhat it doesPage
npx craft route addScaffolds a typed routeAutomation
npx craft route splitSplits a flat collectionScaling routes
npx craft route verifyOptional compiler-fixture suite for the type machineryAutomation
craft-brand --root srcGenerates and refreshes GenDeps_*Brand config
@craft-ts/dev-tools/eslint-rulesThe ESLint rule setESLint rules · Accessibility
npx craft-graphWrites the static Craft graphArchitecture rules · Craft graph vs Nx
npx nx architecture <app>Runs the app's architecture Vitest suiteArchitecture rules · Craft graph vs Nx
Live page MCP pageDrive the open ng serve tab (dev only)Live page MCP
Template migratorMigrates templates to craft componentsTemplate 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 / commandWhat it doesPage
defineCraftDeploymentDeclares the deployment of an application in craft.deploy.tsManifest reference
checkCraftDeployment, checkCraftDeploymentArtifactRuns the manifest, module graph and artefact checksDiagnostics
resolveCraftDeploymentManifest, serializeCraftDeploymentManifest, parseCraftDeploymentManifestResolves, writes and reads the provider-neutral artefact formManifest reference
CraftDeploymentProvider, CRAFT_DEPLOYMENT_PROVIDERSThe provider contract and the capability matrixProviders
npx craft-ts checkValidates a deployment before buildingDeployment overview
npx craft-ts manifestWrites dist/<app>/craft-deployment-manifest.jsonDeployment overview
npx craft-ts deploy previewShows what a provider would change, without changing itAlchemy provider
npx craft-ts deployApplies that plan once --yes approves itAlchemy provider
createCraftDeploymentProviderThe single factory a provider package exportsProviders
createAlchemyDeploymentProvider, planAlchemyDeploymentThe Alchemy provider and its Cloudflare/AWS planningAlchemy provider
npx craft-ts providersPrints the provider capability matrixProviders