Skip to content
Back to skills

Xzor

ASecurity

Use when writing, changing or explaining .xzor components or an xzor app (Blazor-style components for TypeScript, packages @source-crafter/xzor and @source-crafter/xzor-runtime), including pages, routes, layouts, slots, cascading values, dependency injection, server apps and endpoints, main.ts or the xzor build.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
developmenttypescriptgoshellnodeexpressgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add pedro-gilmora/source-crafter-xzor --skill xzor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Xzor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Xzor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/pedro-gilmora-xzor/badge)](https://www.skillsdirectory.com/skills/pedro-gilmora-xzor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: xzor
description: Use when writing, changing or explaining .xzor components or an xzor app (Blazor-style components for TypeScript, packages @source-crafter/xzor and @source-crafter/xzor-runtime), including pages, routes, layouts, slots, cascading values, dependency injection, server apps and endpoints, main.ts or the xzor build.
---

# xzor

## Overview

A `.xzor` file is one component: HTML with `@` expressions plus a `@code { }` block of TypeScript class members. `xzor build` compiles each file to a TypeScript class, type-checks the project with TypeScript 7, and bundles `main.ts` into `dist/main.js` with Bun.

**It looks like Blazor, but it is not Blazor.** Many Blazor names don't exist here (`<Router>`, `@foreach`, `@Body`, `LayoutComponentBase`, `@using`, `NavLinkMatch`, `StateHasChanged`, `createApp`). When unsure, use the forms below; never invent APIs.

## Turning a request into files

1. Pick components (one `.xzor` each, PascalCase file name = component name), pages (components with `@page`), layouts (components with `@slot`) and services (`.ts` classes).
2. Write `main.ts` (the entry: `@Run`), `Routes.xzor` (only if there are pages), `index.html`, and check `tsconfig.json`.
3. Run `bun x xzor build` and fix every error it reports before answering. Errors point at `.xzor` lines.

## Project setup

```sh
bun add -d @source-crafter/xzor typescript@^7
bun add @source-crafter/xzor-runtime
bun x xzor init          # package.json scripts, tsconfig.json, .gitignore (adds only what is missing); --server starts a server app (client/, server/, contracts/ for shared types, @types/bun)
bun run dev              # xzor dev: build, serve (SPA fallback), print the URL; saving a .xzor patches the open page keeping state, other changes reload
bun x xzor build         # one-off production build into dist/
bun x xzor serve [dir] [--port N] [--host H]   # build --minify and serve it as shipped (server app: dist/server.js; browser-only: shells and assets from dist/); 127.0.0.1 unless --host; a server app's own port/hostname members override both flags, and `bun dist/server.js` reads the HOST env when the app sets no hostname
```

`xzor build --minify` splits a chunk per `@page` and `@async` component and, with an `index.html`, also writes `dist/pages/<Page>.html` (that page's shell, preloading its chunks), `dist/pages.json` (`routes`: pattern to shell; `files`: what to serve); every `--minify` build, with or without `index.html`, also writes `.br`/`.gz` copies of every text output. A server app also gets `dist/server.js` (below). Generated: never edit or commit `dist/`.

`xzor init` writes this `tsconfig.json` (or adds the missing parts to an existing one):

```json
{
  "compilerOptions": {
    "target": "ES2022", "module": "ESNext", "moduleResolution": "bundler",
    "lib": ["ES2022", "ESNext.Disposable", "DOM"],
    "strict": true, "noEmit": true, "skipLibCheck": true,
    "rootDirs": [".", ".xzor"]
  },
  "include": ["**/*.ts", ".xzor/**/*.ts"],
  "exclude": ["dist", "node_modules"]
}
```

No `experimentalDecorators`: xzor uses standard decorators.

`index.html` loads the bundle, not `main.ts`:

```html
<div id="app"></div>
<script type="module" src="./dist/main.js"></script>
```

Generated `.xzor/` and `dist/` are build output: never edit them. Don't create `routes.ts` at the root, and never import `./main` from a component.

Editors: VS Code uses the xzor extension. In Zed, the `editors/zed` dev extension of the xzor repo runs the same language server; set `{"languages": {"XZor": {"semantic_tokens": "combined"}}}` in `.zed/settings.json` for its colors.

## Component anatomy

```xzor
@import { type EventCallback } from "@source-crafter/xzor-runtime"
@import TodoItem from "./TodoItem.xzor"

@code {
  title = "Todos";                        // a field is a prop the parent can set
  todos: Todo[] = [];
  changed?: EventCallback<number>;        // callback prop; the parent's untracked reads re-check after it runs

  add(text: string) {                     // inside @code it is plain TypeScript: use this.
    this.todos.push({ text, done: false });
    this.changed?.(this.todos.length);
  }
}

<h2>@title (@todos.length)</h2>
```

- Imports go at the top as `@import ...` lines (any ES import), never inside `@code`. Directives (`@page`, `@import`, `@inject`, `@inherits`, ...) can come in any order.
- In the **template**, write member names bare (`@title`, `@add(x)`): xzor adds `this.` itself. Inside `@code`, write `this.`.
- `#private` members also work bare in the template: `@#secret`.

## Template syntax

| Need | Write |
|---|---|
| Print a value | `@name`, `@user.name`, `@items[0]`, `@(a + b)` for anything else; an array literal needs no parentheses: `@['a', 'b']` |
| Literal `@` | `@@` (emails like `a@b.com` are kept as is) |
| Condition | `@if (x) { ... } else if (y) { ... } else { ... }` |
| Loop | `@for (const item of items) @key(item.id) { <li>@item.name</li> }` (any JS `for` head; there is no `@foreach`). `<li @key="item.id">` on the body's only top element is the same key; an element `@key` anywhere else is a build error |
| Switch | `@switch (v) { case "a": <p>A</p> break; default: <p>?</p> }` |
| Hide instead of remove (tabs, steps) | `@show:if (tab === "a") { <form>…</form> } else { <ol>…</ol> }`, `@show:switch (step) { case 1: <form>…</form> default: <section>…</section> }`: a branch is built once, then hidden (`display: none`) and kept with its state; elements only at a branch's top level. Hidden branches stay live; `@pause` first in a branch (or `@pause { … }` around part of it) stops it while hidden |
| Statements | `@{ const total = sum(items); }` then `@total` (markup inside `@{ }`, and a method or getter returning markup like `@renderItem(x)`, keep their DOM when what they read changes: nodes, child components, focus and typed text stay; `@ref` inside points at the kept element; unkeyed passes match by position, so key a loop to keep state with its items) |
| No wrapper | `<text>...</text>` |
| Comment | `@* ... *@` |
| Attribute | `class="item @kind"`, `disabled="@(!ok)"` (`false`/`null` removes it) |
| Event | `@onclick="save"`, `@onclick="() => count++"`, `<form @onsubmit="add" @onsubmit:preventDefault>` (modifiers combine with the handler) |
| Two-way binding | `<input @bind="text" />`, `@bind:event="oninput"`, checkbox `@bind="todo.done"`, numbers stay numbers |
| Bind a component | `<Stepper @bind-value="n" />` (child has `value` and `valueChanged?: EventCallback<T>`) |
| DOM/instance ref | `@ref="input"` with a field `input?: HTMLInputElement;` |
| Spread attributes | `@attributes="attrs"` (attributes written after it win; those before it give way to the bag's keys; on a component the props spread in written order) |
| Inline SVG | `<svg viewBox="0 0 24 24"><path d="@d" /></svg>` (keep the `<svg>` and its children in one place, not split across an `@if`/`@for`) |

Props on a child: `<Child title="text" count="n + 1" onSave="save" />`. A callback prop (`onSave?: EventCallback<T>`) can also be set like a DOM event: `@onsave="save"`. A prop typed `string`, a union of string literals, an imported alias of string literals (`type Size = "s" | "m"`), or given a string default (`name: Kind = "a"`) takes text; any other type takes a TypeScript expression. Misspelled or mistyped props are build errors.

A tracked field written anywhere (this component's handler, another component, a service, a timer) updates what reads it. Call `this.stateHasChanged()` only after changing something nothing tracks (a plain array's `push`, an object's property); it re-runs the component's bindings.

## Styles and module code

```xzor
@module {
  export type Kind = "a" | "b";            // module scope: exportable, no `this`
  export const label = (k: Kind) => k.toUpperCase();
}
@code { kind: Kind = "a"; pct = 40; }
<div class="bar">@label(kind)</div>
<style>
  .bar { width: @pct%; }
  @if (kind === "b") { .bar { color: red; } }
</style>
```

- One top-level `<style>` per component, or a sibling `X.css.xzor` (not both). Rules are scoped to the component's markup and the content it passes to children; `<style global>` (or `@global` first in `X.css.xzor`) opts out.
- Tailwind: run its CLI beside the build (`bun x @tailwindcss/cli -i app.css -o tailwind.css [--watch|--minify]`, with `@import "tailwindcss"; @source "./**/*.xzor";` in `app.css`) and link `tailwind.css` in `index.html`; the bundler does not run Tailwind, so don't `import` that CSS or `@apply` in a component's `<style>`. Classes used only as `class:name="@x"` need `@source inline("name")`.
- `@name` / `@(expr)` only in property values (one CSS custom property each); `@if (...) { rules } else { rules }` toggles rules; `@@` is a literal `@`; `@media`, `@keyframes`, ... stay CSS.
- `@module { }` (one per file) is module-level TypeScript: constants, types, helpers, markup values; other files import its exports from the `.xzor`. It can't read component members.

## Lifecycle

`protected override onInitialized()` / `onInitializedAsync()` once; `onParametersSet()` / `onParametersSetAsync()` on mount and when a prop changes; then build; then `onAfterRender(first: boolean)`. `shouldRender()` can skip a `stateHasChanged()` pass, `dispose()` runs on removal. A resolved `...Async` promise runs a pass.

## Slots (layouts and wrappers)

```xzor
@* Card.xzor *@
<section class="card">
  @slot:header { <h3>Untitled</h3> }   @* named slot with fallback *@
  @slot                                @* default slot (this is Blazor's @Body / ChildContent) *@
</section>
```

```xzor
<Card>
  @slot header { <em>Today</em> }
  <p>Everything else fills the default slot.</p>
</Card>
```

Slots can pass data: `@slot:item(todo)` in the component, `@slot item(t) { <b>@t.text</b> }` in the parent.

## Cascading values

Provider: `@cascade:theme(currentTheme) { @slot }`. Consumer, at any depth: `@code { @Cascade theme!: string; }` (or `@Cascade("theme") mode!: string;`). Pass a new object to notify; in-place mutation is not detected.

## Pages and routing

```xzor
@* pages/TodoPage.xzor *@
@page "/todos/:id"
@code { id = 0; }                      @* ":id" fills the prop, converted to its type *@
<h2>Todo @id</h2>
```

One `Routes.xzor` (never itself a `@page`) holds the router and the layouts:

```xzor
@import MainLayout from "./layouts/MainLayout.xzor"

@Routes(route) {
  @notFound { <p>Nothing at @route.path</p> }
  @catch(error) { <p class="error">@(String(error))</p> }
  @default(page) { <MainLayout>@page</MainLayout> }
}
```

- `@page` works in any `.xzor` of the project (a `pages/` folder is only a convention). The component's class name is its file name.
- A layout is an ordinary component with `@slot` where the page goes.
- Typed links: `@import { href } from "./routes"` (relative path; the table is generated), then `<a href="@href.TodoPage({ id: 3 })">`. A page without parameters needs no argument: `href.About()`.
- `@import { NavLink } from "@source-crafter/xzor-runtime"`, then `<NavLink href="/" match="exact">Home</NavLink>`: it adds `class="active"` and `aria-current="page"` on its route; `match="prefix"` is the default.
- Animated page changes: call `viewTransitions(true)` (from `@source-crafter/xzor-runtime`) in `main.ts`; give an element the same `view-transition-name` on both pages to morph it. The transition waits up to 1500 ms for the new page's chunk (lazy pages in `--minify` builds) and its `onInitializedAsync`/`onParametersSetAsync` (with those of the components it renders once its data arrives), so a heading rendered after loading data still morphs.
- Plain `<a href="/about">` links navigate without reloading.
- Tag routes with `@page "/admin" as admin` and give them a layout with `@admin(page) { <AdminLayout>@page</AdminLayout> }`.
- Served under a sub-path (GitHub Pages): add `<base href="/repo/">` to `index.html`; routes and `href` follow it.

## Services (compile-time dependency injection)

```ts
// main.ts: the entry. @Run says which component renders into which element.
import { type IApplication, Run, Singleton, Scoped } from "@source-crafter/xzor-runtime";
import Routes from "./Routes.xzor";
import { TodoService } from "./services/todos";

@Run(Routes, "app")                   // <div id="app">
@Singleton(TodoService)               // or @Singleton<ITodos>(TodoService), @Scoped(...), @Transient(...)
export class Application implements IApplication {}
```

```xzor
@import { type TodoService } from "./services/todos"   @* a type import is enough: main.ts creates it *@
@inject TodoService todos             @* "Type name"; then use @todos / this.todos *@
```

- Constructor parameters of services are resolved by type (or by key name for `@Singleton("key", factory)`). Classes are plain; no decorators on them.
- Group reusable registrations in a `@ServiceProvider()` class and add it with `@Import(Provider)` on `Application`.
- Never call `mount()` yourself and don't give an `@inject` component a `constructor`.
- Missing, ambiguous or cyclic services are build errors.

## Server apps and endpoints

A `@Run` class that implements `IServerApplication` (from `@source-crafter/xzor-runtime/server`, which needs `@types/bun`: `xzor init --server` adds it and a starter) is a Bun server instead of a browser app. What the class implements decides the form: `@Run(Shell, "app")` on an `IApplication`; `@Run(Shell)` (server plus views, rendered into `<body>`) or `@Run()` (API only) on an `IServerApplication`. A mismatched form is a build error.

```ts
// server/app.ts: members are Bun.serve options (port, tls, http2, routes, fetch, error); routes you set win over generated ones
@Run(Shell)
@Singleton(NoteStore)
export class App implements IServerApplication {
  port = 3000;
}

// server/api/notes.ts: every exported @Endpoints class under server/app.ts's folder is served, nothing to register
@Endpoints("/api/notes")
export class Notes {
  constructor(private store: NoteStore) {}      // injected like any service

  @Get                                          // GET /api/notes
  list(query: { tag?: string }): Note[] { return this.store.list(query.tag); }

  @Get(":id")                                   // GET /api/notes/:id
  get(id: number): Note | undefined { return this.store.find(id); }

  @Post
  async add(body: { text: string }): Promise<Note> { return this.store.add(body.text); }
}
```

- Decorators: `@Get`, `@Post`, `@Put`, `@Patch`, `@Delete`, `@Query` (HTTP `QUERY`), bare or with a string-literal pattern joined to the prefix. The prefix is a string literal and the class must be exported.
- Parameters, in this order only: every path `:param` (named as in the pattern; `number`, `boolean`, a string-literal union or `string`; a bad value answers 400), then `query` (an object type; only its declared keys are read; a key without `?` that is missing answers 400), then `body` (parsed JSON, not validated, only on `@Post`/`@Put`/`@Patch`/`@Query`; a `Content-Type` other than `application/json` answers 415, so send that header from any client). `query` and `body` can't be path param names. Anything else is a build error.
- Results: a `Response` as is; `undefined`/`null` is 404; anything else is JSON; `throw new HttpError(status, message)` answers that status; any other error is logged and answers a plain 500. Return `Promise<T>` only when the work is async (a sync method gets a sync handler, which is faster).
- Routes must start with `/`: `@Endpoints("api/x")` is a build error (ZDI22), as is a repeated path param name.
- `Request` (the global type) can be a constructor parameter of a service or endpoint in a server app (in a browser app it is an ordinary type); such classes are built per request. A singleton that needs it is a build error naming the chain. Scoped services are per request in endpoints and are disposed after the response.
- Views (`@inject`) reach only services the browser can load: the build registers in the browser what the views reach and on the server what the endpoints and the app reach. A view reaching `Request`, an `@Endpoints` class or a service importing `bun`, `bun:*` or `node:*` is a build error, as is importing an `@Endpoints` class as a value in browser code (use `import type`).
- Two handlers for one method and path are a build error.
- `index.html` is yours, with an empty `<body>`: the views render into it and the build adds the bundle's tags. No `main.ts` or `mount()`.
- Run: `bun run dev` (the server runs behind the dev server, which listens on `127.0.0.1` only: `xzor dev --host <name>` opens it up; any `.ts` change restarts the server, `.xzor` edits patch in place). Ship: `xzor build --minify`, then `bun dist/server.js` (`xzor serve` does both): it serves the shells, assets (hashed chunks and fonts `immutable` with an ETag, the rest `no-cache` with `Last-Modified`; brotli, gzip) and endpoints, and unknown paths get `index.html` with status 404 so `@notFound` renders.
- Not supported: body validation, middleware, streaming or WebSocket endpoints (use the app's `routes`/`websocket` members), more than one `@Run` class per project.

## Contracts and generated clients

A contract is an interface in a plain `.ts` file both sides import (`contracts/posts.ts`), with the server's real signatures, that an `@Endpoints` class lists in `implements`. A view injects it and the build generates the HTTP client.

```ts
// contracts/posts.ts
export interface Post {
  slug: string;
  title: string;
}

export interface IPosts {
  get(slug: string): Post | undefined;
  list(query: { tag?: string }): Post[];
}

// server/api/posts.ts
import { Endpoints, Get } from "@source-crafter/xzor-runtime/server";
import type { IPosts, Post } from "../../contracts/posts";

@Endpoints("/api/posts")
export class Posts implements IPosts {
  @Get(":slug")
  get(slug: string): Post | undefined { return undefined; }
  @Get
  list(query: { tag?: string }): Post[] { return []; }
}
```

```xzor
@import type { IPosts, Post } from "../../contracts/posts"
@inject IPosts posts          @* generated as readonly posts: Remote<IPosts> *@

<p>@list.length posts</p>

@code {
  list: Post[] = [];

  protected override async onInitializedAsync() { this.list = await this.posts.list({}); }
}
```

- `Remote<T>` (from `@source-crafter/xzor-runtime`, types only) keeps every method's parameters and turns its result `R` into `Promise<Awaited<R>>`; other members become `never`. A sync contract method is async in a view: always `await` it.
- In a `.xzor`, write the contract's own name (`@inject IPosts posts`): the field is typed `Remote<IPosts>`. In a browser-reached `.ts` service write `Remote<IPosts>` as the parameter type; `IPosts` there is ZDI25 (TypeScript reads `.ts` as written). On the server `Remote<IPosts>` is an in-process adapter over the endpoint, so a service shared by both sides works on both.
- The client (`.xzor/clients/<IContract>.ts`, never edit it) passes the contract's parameters in order: path params `encodeURIComponent`-encoded (a `/` or a space in a slug is allowed; `""`, `.` and `..` are rejected with `HttpError(400)` before any request), `query` as the search string (undefined values skipped), `body` as JSON with `content-type: application/json`. A 404, a 204 or an empty 200 resolves `undefined` (so `get` can return `undefined`, and the view checks it); any other non-2xx throws `HttpError` (`.status`).
- Only clients a view reaches are bundled. A contract is an interface some `@Endpoints` class implements: injecting one nothing implements is ZDI24, two implementing classes is ZDI23. An endpoint without `implements` still serves, with no client.
- A contract carries only what a browser can send: no `Request` parameter, and everything crosses as JSON (no `Date`, `Map` or class instances).
- Put shared types (`Post`, `PostSummary`) in `contracts/` too, never import an `@Endpoints` class as a value in a view (ZDI21).

## Models (state that tracks its changes)

Use a model for data that is edited and then saved: a form, a row of a table, anything where you need "what changed", "undo" or "is it valid". For plain UI state, keep using `@code` fields.

```ts
// models/worker.ts
import { Model, Persist, Validate, minValue, required } from "@source-crafter/xzor-runtime/model";

export class Worker extends Model {
  @Validate(required) name = "";
  @Validate(minValue(0)) hours = 0;
  @Persist get payment() { return this.hours * 20; }   // sent with the fields
}
```

```xzor
@import { EntitySet } from "@source-crafter/xzor-runtime/model"
@import { Worker } from "../models/worker"
@code {
  team = EntitySet.track(Worker, [{ name: "Ada", hours: 8 }]);
}
@for (const w of team.view) {
  <input type="number" @bind="w.hours" @bind:event="oninput" /> @w.payment
  <small>@(w.errors.hours?.[0])</small>
  <button @onclick="() => team.delete(w)">Delete</button>
}
<button @onclick="() => team.revertChanges()" disabled="@(!team.hasChanges)">Revert</button>
<button @onclick="() => team.confirmChanges()" disabled="@(team.hasErrors)">Save</button>
```

- Write plain fields. The build turns them into tracked ones, and warns on stderr when a class is not tracked: fix every warning.
- Extend `Model`, or another model class (its fields continue after the base's). Build one with `new Worker(data)` (state Unchanged) or `new Worker()` (Detached; the first edit makes it Added). If you write a constructor, call `this.assign(data)` in it.
- A binding that reads a model (a `@value`, an attribute, an `@if`) runs again when that value changes, even if the change comes from a service or a timer. Do not call `stateHasChanged()` for models.
- `hasState(State.Modified | ...)` (`State.Detached | Unchanged | Added | Deleted | Modified`, from `.../model`; there is no `state` property), `markAdded()`/`markModified()`/`markUnchanged()`/`markDeleted()`, `changes` (what to send to the server, `null` if nothing; the state is sent as `$$`, and `$$` in constructor data sets it), `revertChanges()`, `confirmChanges(serverValues?)`, `hasErrors`, `errors` (messages per field, filled after the first edit), `hasValidChanges`.
- Decorators: `@Validate(...)`, `@Persist` (a getter sent with the fields), `@Ignore` (kept out of `changes`), `@Untracked` (a plain field). Validators: `required`, `email`, `phone`, `maxLength`, `minLength`, `requiredIdValue`, `nonZero`, `minValue`, `maxValue`.
- `EntitySet.track(Type, items)` is a list of models: `delete(item)`, `view` (without deleted), `changes`, `hasChanges`, `hasErrors`, `revertChanges()`, `confirmChanges(serverItems?)`. Change it with `push`, `splice`, ...; `set[i] = x` is not noticed. Read it through `view` or `for...of` (not `length`, an index or `set.map`) so the reader follows pushes and deletes.
- Needs `"ESNext.Decorators"` in the tsconfig `lib`. Not supported: plain object graphs with cycles, one set held by two models.

## Components: how they update

Every component is compiled with no render pass: the DOM is built once and each dynamic part updates alone when a field it reads changes. There is no other mode and no virtual DOM; `@render` and `@fine` were removed (both are compile errors). The base class is `Component` (`ComponentBase` still works as a deprecated alias); in a `.ts` base used through `@inherits`, extend `Component`. Markup is written in `.xzor` only.

- Its `@code` fields are tracked like a model's: `count++` in a handler updates the page. Never call `stateHasChanged()` for that; call it only after changing something untracked (a plain array's `push`, an object's property).
- Put list data in an `EntitySet` (or reassign a plain array) and loop with `@for (const x of list.view)`: rows are kept by identity, or by `@key(x.id)` (then a new object with the same key keeps its row, so immutable updates like `list.map((x) => x.id === id ? { ...x, qty } : x)` patch it in place).
- Totals and other derived values are plain expressions (`@team.view.reduce((s, w) => s + w.hours, 0)`); no extra fields or setters.
- The tsconfig `paths` (when used) must map `@source-crafter/xzor-runtime`, and `@source-crafter/xzor-runtime/model` too when the app uses models.

## Hot reload and PWA

- `xzor dev` hot reload: saving a `.xzor` patches the changed components in the open page and keeps their fields; a component whose template changed has its DOM rebuilt from them (focus and scroll inside it start over). Other changes reload. A `#private` member, a new import or a changed base class reload too, and arrow-function fields keep old code until a reload.
- To make the app installable and offline, add `manifest.webmanifest` next to `index.html` (`name`, `short_name`, `start_url: "./"`, `scope: "./"`, `display`, a 192x192 and a 512x512 icon, both files must exist) and `<link rel="manifest" href="manifest.webmanifest">` in `index.html`. No decorator or code is needed.
- `xzor build` then writes `sw.js` beside `index.html` and registers it (never in `xzor dev`). Don't edit it: it is generated and gitignored, but it must be deployed with the app. Offline loads fall back to the cached app; a new deploy shows up on the second load (the first fetches it in the background). Fix any `xzor: manifest.webmanifest: ...` warning.

## Common mistakes

| Wrong (Blazor or guess) | Right |
|---|---|
| `createApp(App).mount(...)`, `app.services.add...` | `@Run(App, "app")` + `@Singleton(...)` on `Application` in `main.ts` |
| An Express or Hono server beside the app | `@Run(Shell)` on an `IServerApplication` plus `@Endpoints` classes |
| Registering endpoint routes by hand, `req.json()` in a method | `@Get`/`@Post` methods; take `body` and `query` parameters |
| `<Router>`, `<RouteView>`, `<Found>` | `@Routes(route) { @default(page) { ... } }` in `Routes.xzor` |
| `@inherits LayoutComponentBase`, `@Body` | a plain component with `@slot` |
| `@foreach (var x in xs)` | `@for (const x of xs)` |
| imports inside `@code`, `@using` | `@import ...` at the top |
| `NavLinkMatch.All` | `match="exact"` |
| `<script src="main.ts">` | `<script type="module" src="./dist/main.js">` |
| `StateHasChanged()` | `this.stateHasChanged()` |
| TypeScript 5, `experimentalDecorators` | TypeScript 7, standard decorators |
| `@("<")` to print `<` | `&lt;` (HTML character references are decoded, like in Razor) |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.