documentation
Everything the compiler does, written down.
Start with the quickstart, then read concepts before reference. Every diagnostic, target behaviour and configuration option has a page.
Introduction
Language
Component Declarations
→The component keyword, typed params, generics, async and island modifiers, and the two body modes.
Component Namespaces
→import * as NS from './card.vsk' and <NS.Card /> — the namespace is a compile-time shorthand, not a value.
Track Declarations
→The &[] sugar for creating reactive cells: auto-tracked bindings, raw-cell bindings, and how the compiler rewrites reads and writes.
Reactivity
→Tracked cells, the cell API, microtask-batched scheduling, effects, and the flushSync/tick escapes. No virtual DOM.
Expression Mode
→The classic component body style: a single return <jsx> at the end, with guard clauses, .map() lists and ternaries before it.
Statement Mode
→Markup and control flow directly as statements: bare JSX, if/for/while/switch/try, guard-clause returns, and for-key/index clauses.
Client Boundary & Islands
→Server-first rendering, the client island modifier, {#client}/{#server} blocks, and which blocks a component kind may use.
Styles
→Component-scoped CSS via a <style> element in the body, how it is extracted, and how it is emitted on server and client.
Markdown
→The built-in <Md> component and renderMarkdown(): tokenizer-based, with highlighting, GFM, streaming, and configurable HTML policies.
Configuration
→vesk.config.js / vesk.config.ts, defineConfig and how it normalizes security, environment loading, platforms, and the app-level events + context system.
Not in the Grammar
→Explicit non-features. Vesk is a TypeScript superset — everything listed here is intentionally absent today, and the absence is a contract.
Compiler
Compiler Pipeline
→Four stages, no hidden runtime: preprocess, parse, IR generation, and codegen to server and client JavaScript (or Kotlin).
IR Format
→The ephemeral typed IR: a class hierarchy in ir.ts, consumed by the server and client codegen visitors and by vesk-native-compiler.
Static Code Generation
→How the client codegen distinguishes fully-static subtrees from reactive ones, and how hydrate-mode markers work.
Client Reachability
→The compiler's answer to the client/server boundary: the needsClient check, per-block validation, and per-target stripping.
Errors & Diagnostics
→VeskError, HttpError, TimeoutError and NotFoundError, plus error handling in components and server code.
Runtime
Routing
→Two routing modes — file-based under app/ and manual via createRouter — with dynamic segments and catch-alls, nested layouts, loading/error/not-found/offline pages, Link/NavLink navigation, prefetching, guards, and the low-level router API.
Data Fetching
→useFetch and its static variants, createResource, mutate, HttpError / TimeoutError, and SSR data handoff.
track
→The reactive primitive: a cell you read, write and subscribe to — with a binding you use like a plain variable.
derived
→A computed cell: recomputes only when something it reads changes, and reads like a plain value once unwrapped.
get and set
→Reaching past the binding to the raw cell: get, set, and the reads that deliberately do not subscribe.
effect
→Run a side effect when the cells it reads change — and nothing else. Client-only, ordered after render, cleaned up for you.
Scheduler
→When writes actually reach the DOM: flushSync, tick, and what batches for you.
Show
→Render one branch or another with no wrapper element — the conditional that costs no DOM node.
Lists and For
→Rendering lists server-side: the native for loop (keyed) and the For component, and when to use which.
Switch and Match
→First-match branching with components instead of else-if chains.
Hydration
→How Vesk attaches client behavior to server-rendered HTML: vsk markers, claim walkers, and the hydration entry points.
Forms & Validation
→The Form and Field components, validation rules, and server actions with defineAction, validateActionInput and issuesToFieldMap.
API Routes
→Server-side endpoints under app/api/: route conventions, method handler exports, dynamic segments, body parsing, validation and VeskResponse.
Middleware
→fn(ctx, next) middleware, the MiddlewareContext, next(rewrite), building responses, and examples for logging, auth, CORS and rewriting.
Incremental Static Regeneration
→Page-, component- and data-level ISR with stale-while-revalidate, page config via export const, and targeted invalidation by path, tag or component.
Server APIs
→Request context (useParams/useRequest/useBody), cookies(), headers(), locals(), VeskRequest / VeskResponse / ServerResponse, CORS, webhooks, hooks, validation, signed cookies and server events.
Metadata
→Declare a route's title, description, Open Graph and alternates as data, with a static head that does not depend on the component's frame.
SEO
→Titles and descriptions via defineMetadata, structured data via the JsonLd component and schema generators, plus vesk seo to audit your app.
Network State
→Reactive browser network state: getNetworkState with online, effectiveType, downlink, rtt, saveData, plus watchNetwork subscriptions.
Two-Way Bindings
→bindValue, bindChecked and bindGroup for wiring tracked cells to DOM form elements.
Built-in Components
→Image, Portal, Experiment and LoadingIndicator — all auto-imported from @vesk/runtime.
Headless Components
→Show, For, Switch and Match — composable render helpers with no markup and no styling.
Primitives and Leaves
→Author components outside .vsk files: primitive() for presentational components that return markup, leaf() for stateful and async widgets — both callable as <Badge/> or Badge().
Reactive Core
→The runtime reactivity engine: cells, the microtask scheduler, block trees, scoped flushing, and the flushSync/tick escapes.
Keyed Reconciliation
→The reconcile function: keyed list updates that operate directly on the real DOM with comment markers — no virtual DOM.
Deployment
→One SSR function + one client bundle, platform targets, the Node server, SSR rendering rules, and the browser bundle.
Store
→A centralized reactive store with optional persistence, middleware, and derived stores.
Native
Vesk Native
→Compile .vsk components to Kotlin with Jetpack Compose and Material 3 — real Android views, real platform APIs, no WebView.
Getting Started (Native)
→Scaffold a native Android app with create-vesk-native, install the toolchain, write your first .vsk page, and build an APK.
Native Routing
→File-based and manual routing in vesk-native: layout/page conventions, dynamic params, manual routes in veskconfig.ts, Link/NavLink/Outlet, and programmatic navigation.
Native Configuration
→The full veskconfig.ts reference for native apps: identity, SDK targets, theme, back behavior, edge-to-edge, deep links, icon, splash, signing, and bundling.
Native Device APIs
→The device.* API surface, the three access patterns (state bindings, callbacks, markup elements), the permission mapping tables, and every tangible element tag.
Native Web API Mappings
→How browser and web-platform APIs compile to native Kotlin: fetch, WebSocket, EventSource, storage, sqlite, auth, JS semantics, and the platform seam.
Native Framework Components
→PullToRefresh, SwipeToDismiss, CardStack, Link, NavLink, and Outlet — the Material3-backed framework components emitted as native composed calls.
Native Motion
→motion.animate() and friends in native: MotionRef, spring and tween easing mapped to Compose, motionInView, and connected interrupts.
Native Libraries (.vsklib)
→The .vsklib library system: libraries.json, the curated registry, vesk add/install/update/remove, auto-generated bindings, and using Kotlin libraries from .vsk.
Native Dev Modes
→The three vesk-native dev loops: on-device fast reload, the desktop JVM preview with Compose Hot Reload, and the web browser preview with the device.* shim.
Native Signing & Bundling
→Release signing and packaging for Android (AAB + APK) and iOS (Xcode project + .ipa): signing config, pre-flight checks, secrets via env:, export methods, and Play/App Store requirements.
Native Compiler
→The @vesk/native-compiler surface: compileVsk, compileVskResult, CompileOptions, targets, JS/TS module compilation, and Kotlin codegen behavior.
Native CLI Commands
→Every vesk-native command: init, build, bundle, verify, setup, update-tools, dev, and the library verbs (add, install, update, remove).
Tooling
CLI Commands
→The full vesk CLI: dev, build, start, typecheck, seo, init — flags, defaults, config loading, dev server behaviors, HMR messages and build output.
Plugin API
→The VeskPlugin shape, definePlugin, every real hook, provides, registration and validation, and how @vesk/plugin-tailwind integrates.
Language Server
→@vesk/lsp provides LSP support for .vsk files: diagnostics, autocomplete, go to definition, hover and find references.
Editor Integrations
→VS Code and Neovim/Vim plugins for .vsk files — syntax highlighting and the bundled LSP server, no build step.
AI Agent Skills
→Install the `vesk` and `react-to-vesk` skills into your AI coding tool so agents reference the current Vesk API, not training data.
Prettier Plugin
→@vesk/prettier-plugin formats .vsk files in Prettier, preserving component, &[] and {#server}/{#client} syntax.