Skip to content

Examples

Every example below is a real route of the demo application. Each opens in StackBlitz on the relevant file, already navigated to the page.

The demo groups them the way you would meet them: components first, then the primitives on their own, then the same features behind services, then routing and the rest.

Just want to poke at something?

The Playground is a shareable sandbox with a small todo flow — the fastest way to try an idea.

Components

Functional, selectorless components rendered from typed hyperscript.

ExampleWhat it shows
Functional ComponentscraftComponent, inputs and outputs as factory parameters, hyperscript templates
Reactive CompositionComposing components and directives with .pipe(...)
Content ProjectionFree DOM content, typed DOM contracts, and logical projection by contract

Primitives

Using state, query, mutation, queryParams and asyncProcess directly, with no service layer.

ExampleWhat it shows
Queryquery() with reactive params, status and caching
Mutationmutation() with manual control of modification operations
List with PaginationPagination with hand-managed query params and page state
Granular MutationOptimistic updates and cache invalidation, done by hand
Full DemoEverything at once, without store or service abstractions
Login ForminsertForm, validators, and a typed submit wired to a mutation
Pixel Artstate + insertSelect over a flat array
Pixel Art MatrixNested insertSelect and internal source$ between rows and cells
ExceptionsBusiness exceptions on query(), rendered per code with matchBlock.exhaustive
Exception QueryParamsqueryParams decode failures through hasException() and exceptions().parse

Services

The same features, packaged behind craftService.

ExampleWhat it shows
Craft QueryA reusable query service with configured storage persistence (localStorage by default)
Craft MutationCreate / update / delete with reactive cache synchronisation
Craft List PaginationqueryParams + insertPaginationPlaceholderData in a service
Craft Granular MutationinsertReactOnMutation updating cached data without a reload
Craft Full DemoQueries, mutations, async work, URL state and persistence together
craftService CounterThe smallest possible service — scopes and composition
craftService User DetailService inputs, and exposing only part of a dependency
craftRegisterForA parent driving live children through a typed registry

Routing

ExampleWhat it shows
Query Params in the routequeryParams declared on the route rather than in a component
Guard DemoGuards as bare generators, and handleExceptions per code
Slow PageNon-blocking navigation: the stay → blank → loader phases, and a craftGen resolver recovered locally with catchTag
View TransitionsOutlet-driven view transitions surviving the guard/resolve chain, with a per-route skeleton
Lazy LayoutA lazy child collection with its own DI check and a route-provided service

Tooling

ExampleWhat it shows
PlaygroundA shareable sandbox: a small todo flow with craftService, query() and mutation()
Send Context to AIExporting the live dependency graph and app context to an assistant

Notes

Each example ships its own api.service.ts simulating the network, so every route works standalone.

Source repository: ng-craft-demo.