Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

API reference

171 Meeko symbols grouped by what they are. Each page explains one with its exact type, generated from the source code, its parameters, real examples and the errors you get from misusing it.

Components #

Meeko's built-in tags: you use them in the template without importing them, and the compiler checks their attributes.

  • <MeekoLink> Typed link to an application page that builds its href with href() and marks the current page or section with aria-current.
  • <MeekoOutlet> Renders the inner layout or page in app/app.meeko and layouts, with the browser preserving the layout between routes.
  • <MeekoAwait> A region for data arriving after the first paint, with loading, error and refresh states, and reserved height to prevent layout shifts.
  • <MeekoTeleport> Renders content elsewhere in the document (the end of body or an element with an id) while keeping it in the declaring component.
  • <MeekoPopover> Accessible popover anchored to its trigger, using the native popover API and CSS anchor positioning, for menus, lightweight dialogs and tooltips.
  • <MeekoSelect> Unstyled accessible select built on MeekoPopover, with options of any type, multiple selection, search, groups and form submission.
  • <MeekoThemeToggle> Accessible light/dark theme selector that does not jump on load and works without JavaScript, using themes from meeko.config.ts.
  • <component is> Renders a component chosen by an expression, or since 1.5 an HTML tag, with type-checked props, events and snippets.
  • ComponentRegistry Discovers .meeko components by directory, queries their types and loads them by name.

Macros #

The macros the compiler reads in the component script and the define* functions that declare pages, middleware, plugins, modules, the configuration and the server.

  • defineProps Declares component props with a TypeScript type and defaults, returning a reactive read-only view that also supports destructuring.
  • defineEmits Declares a component's events with typed arguments and returns emit, which calls the parent's on:evento handler.
  • defineModel Declares a component model, a writable signal shared by the parent through model or model:nombre, or passed as a prop and an event, with an optional default value.
  • defineSnippets Declares a component's snippets, template content written by the parent between its tags, with typed parameters.
  • defineExpose Exposes a component value, such as methods or signals, to the parent that names it with ref: and reads it with useElementRef.
  • useElementRef Reads the template element or component named with ref: from the script, as a signal or, with await, already mounted.
  • definePage Declares a page's route options (params and search schemas, rendering mode, loader, head, layout, middleware, cache and sitemap) with types flowing between them.
  • defineGroup Declares options in a +group.ts for an app/pages directory (named layout, its props and middleware) inherited by all its pages.
  • defineRouteMiddleware Declares global or named route middleware in app/middleware, executed before the page in SSR and on each browser navigation.
  • defineServerRouteMiddleware Declares route middleware running only on the server, with the request's session, before the page's server code.
  • definePlugin Declares an application plugin in app/plugins, run at startup in the browser, on the server or both, and provides values to all components.
  • defineMeekoConfig Declares typed meeko.config.ts configuration (layers, modules, auto-imports, aliases, server, CSS, document, sitemap and theme) without changing it.
  • defineMeekoModule Declares a Meeko module that configures the project from code when loading configuration, with merged options and the meeko object.
  • defineApiRoute Declares a server/api endpoint with public schemas, guards, status and handler; the server validates everything and generates the typed api.* client.
  • defineRpc Declares an RPC procedure in server/rpc with input and output schemas, guards and a handler, called by the application with typed rpc.*.
  • defineServerMiddleware Declares HTTP middleware from server/middleware, wrapping pages, API and RPC before session creation and able to short-circuit or modify the response.
  • defineSocketChannel Declares a WebSocket channel in server/socket with schemas for each direction, per-room and per-event guards, and handlers for client messages.
  • defineServerRuntime Declares sessions, services, Socket policy and application shutdown in server/runtime.ts, created once per process.

Composables #

use* functions that a component script calls at its top level: the route, the page, forms, the head, the theme, state and server data.

  • useRoute Reads the committed route rendered by the component (url, path, id, params and search) as signals, and checks whether a route is active.
  • usePage Returns the page request (url, params, search, request, context and signal) in the top-level code of its script server.
  • useNavigation Returns the application's navigation state, with pending set to true while a new page loads.
  • useForm Component form state, with one signal per field, Standard Schema validation, server errors per field, submission and reset.
  • useId Returns an ID unique to each instance and call, identical in server HTML and during hydration, to link labels, controls and help text.
  • useHead Adds title, meta, link, script and style tags and html and body attributes to the document while the component is mounted.
  • useSeoMeta Typed useHead shortcut for SEO that converts each field (description, Open Graph, Twitter, canonical) to the correct tag.
  • useTheme Returns the application's light/dark theme (choice, effective theme and theme list) and changes it in html, the cookie and other tabs.
  • useThemeToggle Public state for a custom theme selector compatible with SSR, hydration and forms without JavaScript.
  • useLayout Reads and changes the props of the page's enclosing named layout, with types and reactivity, from the page.
  • useState Returns the application's shared state signal for a key, created on first access, scoped per request in SSR and transferred to the browser.
  • useStorage Returns a writable signal stored as JSON in localStorage or sessionStorage, without hydration mismatches and synchronized across tabs.
  • useApi Reads a server/api GET endpoint from a component, with SSR, hydration without repeating the request, reactive reloading and contract types.
  • useApiMutation Sends an on-demand POST, PUT, PATCH or DELETE request to a server/api endpoint, with pending state, errors and safe retries.
  • useRpcQuery Reads a server/rpc procedure from a component, with SSR, hydration, reactive input reloading and contract types.
  • useRpcMutation Calls a data-changing server/rpc procedure on demand, with submission state, errors and safe retries.
  • useSocket Connects a component to a server/socket channel with typed events and closes the connection on unmount.
  • useSocketChannel Opens a channel by name from a Socket contract registry, bound to the component; this is the function used to generate the useSocket auto-import.
  • useRequestState Stores a value in server request state, creating it on first access, to share it among middleware, loaders and handlers for that request.

Reactivity #

Signals, computed values, effects, lifecycle, context and error observers: the core, without a virtual DOM.

  • signal Creates an observable, writable value with .value; writing a different value notifies the template, computed values and effects that read it.
  • computed Derives a read-only value from other signals and recalculates it as soon as any signal it read changes.
  • effect Runs a synchronous function now and whenever a signal it read changes; returns the function that stops it.
  • batch Groups multiple signal writes into a single round of notifications when the function finishes.
  • untrack Runs a function that reads signals without tracking them as dependencies of the active observer.
  • onMounted Runs a function once in the browser after the component has hydrated or mounted; never in SSR.
  • onCleanup Registers synchronous resource cleanup in the active root, executed when the component unmounts or is disposed of.
  • createContext Creates a unique, typed key for sharing a value with descendants through provide and inject.
  • provide Provides a value under a context key in the active component and all its descendants.
  • inject Reads the value provided with provide by the nearest ancestor and fails if none provided it.
  • createRoot Creates a reactive root whose effects, cleanups and contexts are disposed of together when you call dispose.
  • provideErrorHandler Registers the browser failure observer for a component and its entire branch, with each failure's source.

Utilities #

Typed routes, redirects, API errors, generated clients, serialization, trusted HTML and passwords.

  • href Builds an application route's URL from its ID, with encoded parameters and the query string, checked by TypeScript.
  • redirect Stops page server code or server route middleware and responds with a redirect, which client navigation follows in the same way.
  • notFound Stops the page's server code or server route middleware and displays the nearest error page with status 404.
  • defer Marks loader or page server code data that can arrive after the first byte with render stream, with reactive state.
  • api Generated client for server/api endpoints, typed by their schemas, working the same way in the browser and on the server.
  • rpc Generated client for server/rpc procedures, typed by their input and output schemas, that works the same in the browser and on the server.
  • socket Generated registry of server/socket channels, with typed on and emit in the browser and typed broadcast on the server.
  • ApiError Public API, RPC, Socket and loader error, delivered to the client with its code, status and, since 1.5, field messages.
  • ClientError The error API, RPC and Socket clients use to reject an error response from the server, with its code, status, requestId and per-field issues.
  • isClientError Checks whether an unknown value is a ClientError and optionally has a specific code, including across two copies of Meeko.
  • PageInputError The error for a page whose params or search fail the definePage schemas, returned by the server as 400 and displayed in the browser through the error page.
  • serializeJson Serializes a value into JSON safe to insert in a script tag, checking faithful representation and escaping anything that could close the tag.
  • trustHtml Declares HTML trusted and gives it the TrustedHtml type, which the html directive accepts without a warning; does not sanitize or copy anything.
  • isTooLargeToAnimate Tells whether a document is too large to animate with a View Transition; navigations and withViewTransition already check it.
  • documentHtml Makes trusted HTML travel only once on the first load, in the document's HTML and not also in the hydration payload.
  • hashPassword Computes a password's scrypt hash in a self-describing format, ready to store in a column or .env.
  • verifyPassword Checks a password against a stored scrypt hash in constant time, recomputing it with the hash's own parameters.
  • needsRehash Indicates whether a password hash needs recalculating with the current hashPassword parameters, to update it after a successful login.

.meeko syntax #

What the compiler recognizes in a .meeko file: interpolation, directives, snippets and the component blocks.

  • {expresión} Inserts a TypeScript expression's value into the template as escaped text, updated when the signals it reads change.
  • if:when Renders a tag and its content only while an expression is truthy, and narrows types inside it.
  • each:of Repeats a tag for each item in a list, with its name, index and, if needed, a stable key per row.
  • on:evento Listens to a DOM event on an element or a defineEmits event on a component, with typed event and currentTarget.
  • bind:nombre Sets an element attribute or component prop to an expression's value and updates it when its signals change.
  • model Creates a two-way binding between a form control or component model and a writable signal.
  • html Fills an element with unescaped HTML from an expression, which must be marked as trusted with trustHtml.
  • ref:nombre Names a template element or component so the script can read it with useElementRef, typed from its tag or defineExpose.
  • <snippet> Fills a named snippet declared by a child component with defineSnippets from the parent, with typed parameters.
  • <render> Renders a snippet passed by the parent inside a component, with the arguments supplied by the child.
  • <script server> A page's server code inside its .meeko file, with route options and typed JSON data exported to the template.
  • generic Declares component type parameters in its script, inferred by the parent from props and used to type events, models, snippets and refs.
  • <style> Global styles colocated with the component that needs them, processed by the application's PostCSS and bundled with it.
  • <style scoped> Component scoped styles, limited to its template elements with a data-meeko-s attribute, and :global(…) to escape the scope.

Server #

Sessions and their stores, security headers, OpenAPI, local calls, cross-instance Socket and process errors.

  • SessionManager Application session manager with opaque HttpOnly cookies, family-based rotation and revocation, and Origin and CSRF checks on authenticated mutations.
  • SessionHandle A request's session, in context.session, to read, create, rotate, revoke and verify before an irreversible effect.
  • MemorySessionStore Session store in process memory, only for development, tests and prerendering; not persistent and rejected by SessionManager in production.
  • RedisSessionStore Persistent Redis session store, with Redis expiration, atomic rotation and revocation, cross-instance revocation and shared rateLimit counters.
  • SqlSessionStore Persistent session store over any SQL database, using statements from an application driver and, since 1.7, rateLimit counters in the database.
  • SessionRevokedError The 401 SESSION_REVOKED ApiError for a session revoked, rotated or expired during the request, and the abort reason of context.signal.
  • SessionSecurityError A mutation failed the session's Origin or CSRF check, with code INVALID_ORIGIN or INVALID_CSRF; API and RPC responses convert it to 403.
  • contentSecurityPolicy Builds the Content-Security-Policy header from a directive-based policy and adds the hashes of a page's inline scripts and styles.
  • generateOpenApi Generates an OpenAPI 3.1 document for the application's API and RPC endpoints from an explicit registry of public schemas.
  • createLocalCalls Calls the application's API and RPC inside the process, using the current request's credentials and the same guards, validation and limits as HTTP.
  • createLocalServerFetch The local dispatch used by api and rpc clients during SSR, serving calls through the HTTP pipeline without leaving the process and only with the current request's origin and credentials.
  • LocalSocketPubSub Socket broadcast broker within a single process, used by the hub by default in Node, Bun and Deno; does not reach other instances.
  • RedisSocketPubSub Distributes Socket broadcasts across multiple instances or processes with Redis pub/sub, including sharded pub/sub in Redis Cluster.
  • composeServerMiddleware Composes a list of server middleware around a Fetch handler, from outside in, as Meeko does with server/middleware files.
  • handleProcessErrors Applies server/runtime.ts processErrors policy to a custom host for unhandled rejections and uncaught exceptions outside a request.
  • errorResponse Converts any error into Meeko's public JSON response, { code, status, requestId }, without leaking unexpected error messages.

Adapters #

How the built application runs on Node, Bun, Deno and Cloudflare Workers.

  • serveNode Serves a Meeko application with Node's HTTP server, its Socket channels with ws, graceful shutdown on signals and the process failure policy.
  • toNodeListener Adapts a Fetch handler to Node's http.createServer callback, with streaming, multiple Set-Cookie headers, cancellation on client disconnect and the connection's IP.
  • attachNodeWebSocketServer Connects Meeko Socket channels to a Node HTTP server through the ws package, with a frame limit, heartbeat and shutdown of all peers.
  • createNodeAssetReader Serves only build files listed in the asset manifest from disk on Node, using streaming and Meeko's ETag, HEAD, 304 and cache policy.
  • createNodeSocketUpgradeHandler Checks Socket upgrade policy in Node's upgrade event and leaves framing to the host's chosen WebSocket library.
  • createBunServer The fetch and websocket handlers for serving a Meeko application with Bun.serve, using Bun's native WebSocket for Socket and its payload, backpressure and idle limits.
  • createBunAssetReader Serves only build files listed in the asset manifest through Bun.file, with ETag, HEAD, 304 and Meeko's cache policy.
  • serveDeno Serves a Meeko application with Deno.serve, with Socket over Deno.upgradeWebSocket, graceful shutdown on signals and the process failure policy.
  • createDenoAssetReader Streams only build files listed in the asset manifest using Deno.open, with ETag, HEAD, 304 and Meeko's cache policy.
  • createWorker Serves a Meeko application from a Cloudflare module Worker, created once per isolate with its bindings, forwarding Socket upgrades to their room's Durable Object.
  • createSocketRoomClass Creates the Durable Object class hosting a Socket room's WebSockets in Cloudflare Workers, with the hibernation API, reconstruction on wake and per-room limits.
  • socketRoomName The Durable Object name of a Socket room in Cloudflare Workers, with one object per channel and room, for idFromName.
  • DurableObjectSocketPubSub The Socket broker for Cloudflare Workers, where each channel and room is a Durable Object that receives publications over RPC and distributes them to its peers.
  • D1SessionDriver SqlSessionStore driver for Cloudflare D1, with atomic rotation and revocation, expired-row cleanup and, since 1.7, rateLimit counters shared across isolates.
  • createCloudflareAssetReader Serves only build files listed in the manifest from Cloudflare's Static Assets binding, with the ETag, HEAD, 304 and caching behavior of the other adapters.
  • createCloudflarePrerenderSource A Worker's prerendered pages, read from the Static Assets binding once per isolate, with their navigation payload and CSP hashes.

Commands #

The meeko CLI: development, checking, build, production server, new projects and tools.

  • meeko dev Development server for a full-stack application, preparing .meeko/ types and serving the application with Vite, SSR and HMR.
  • meeko build Checks the project and writes production output to .meeko/output/<adaptador>/, including the client, server and prerendered pages.
  • meeko start Starts the Node production server using meeko build output, without Vite or application sources.
  • meeko preview Runs meeko build output in its real runtime (Node, Bun, Deno, wrangler dev or a file server) to test it before deployment.
  • meeko check Checks an entire project, or a single .meeko component, with Meeko and TypeScript diagnostics, and generates .meeko/ types.
  • meeko clean Deletes Meeko-generated files in a project (.meeko/ and the Vite cache) and, with --all, node_modules too, without ever following links.
  • meeko init Creates a standalone SSR project without the framework, with a .meeko component, its Node server and Vite.
  • meeko init-framework Creates a full-stack Meeko application with meeko.config.ts, app/, a layout, a prerendered page, .env.example and CLI scripts.
  • meeko auth hash Prompts for a password without echoing it, or reads it from stdin, and prints its scrypt hash for storage in .env or the database.
  • meeko routes Discovers routes, server contracts, components and auto-imports and prepares .meeko/ like meeko check (manifests, declarations and tsconfig), without running TypeScript.
  • meeko prerender Prerenders render "prerender" routes again using the existing Node build, without recompiling, and writes .meeko/output/node/prerender/.
  • meeko compile Checks a .meeko component and compiles it to a TypeScript module with its server render, hydration and types.
  • meeko types Generates a component's .d.meeko.ts declaration and those of its imported components in .meeko/types/, so TypeScript can check their props.
  • meeko check-app Checks all .meeko components in the application and its layers, without generating .meeko/ or checking .ts files with TypeScript.
  • meeko lsp Starts the language server for .meeko components, used by VS Code, Neovim, Helix, Zed and JetBrains.

Configuration #

The keys of meeko.config.ts, which is declared with defineMeekoConfig.

  • layers Project folders that contribute pages, components, auto-imports, layouts and plugins to the application, in the listed order.
  • extends The former name of layers, still supported in 1.x without a warning; its folders come before those in layers.
  • modules Names of modules created with defineMeekoModule that configure the project through code; each module's options go under its key (meta.configKey).
  • imports Auto-import folders in addition to the defaults, each with the scope of its containing folder, app, shared or server.
  • alias Custom path aliases, or changes to ~/, @/, #shared/ and #server/, used in Vite, generated tsconfig files, the editor and @utilities.
  • server The meeko build adapter (node, bun, deno, cloudflare or static) and its options, plus, since 1.7, response CSP and headers for server adapters.
  • css Component style options, such as which elements receive the scoped style attribute, all elements or only those that some selector can match.
  • document The application's shared HTML document, with html lang, head tags for all pages, per-page canonical and Open Graph tags and the useId prefix.
  • dev Options for meeko dev, such as forwarding server code output to the browser console while handling a request.
  • devtools Mounts the Meeko DevTools panel inside the page in meeko dev, without application code, in the chosen corner.
  • site The site's public URL, of which only the origin is used, for absolute URLs in sitemap.xml, robots.txt and document.seo.
  • sitemap Writes sitemap.xml during the build with prerendered pages, routes without parameters and, since 1.7, sitemapEntries URLs from dynamic routes.
  • robots Writes robots.txt during the build with User-agent wildcard rules and, with sitemap, the absolute sitemap URL.
  • theme Flicker-free light, dark or custom application themes, with the choice in a cookie, the theme on html from the first byte and useTheme in components.

Advanced #

The pieces beneath the framework, for custom hosts, tools and tailored builds.

  • createServerApp Creates the portable server application (pages, API, RPC, Socket, assets, sessions and middleware) from the build manifest and a module loader.
  • createFrameworkHandler Creates a Fetch handler rendering application pages (route middleware, validation, loader, SSR, navigation payload and error pages) for a custom host.
  • createServerDispatcher Creates an HTTP handler that serves /api/... and /_meeko/rpc/... on your own host, with the same sessions, guards, validation and errors as the application.
  • createRequestContext Creates a request's RequestContext (session, services, platform, requestId and signal) for a custom host or to test an endpoint without a server.
  • createSocketHub Creates the Socket hub for a custom host, authorizing handshakes, accepting connections, validating events and distributing broadcasts across rooms and instances.
  • createSocketUpgradeHandler Portable Socket handshake, validating the channel path, running hub checks and connecting the runtime's WebSocket to the hub.
  • mountClientApp Hydrates server-rendered HTML in the browser and manages client navigation, with history, links, route middleware, data payloads and cleanup.
  • createNavigator Low-level client navigator for a custom host, resolving routes, updating history and handling popstate while delegating rendering to a callback.
  • createApiClient Creates a typed API endpoint client from its public manifest, without importing server code, for explicit, external or test clients.
  • createRpcClient Creates a typed RPC procedure client from its public manifest, where each call is a JSON POST with the CSRF token.
  • createSocketClient Low-level Socket client over native WebSocket, with explicit URL and contract, validation in both directions and exponential backoff reconnection.
  • useSocketClient Creates a component's Socket client with explicit URL and contract, closing it on unmount and using its error observer.
  • StateStore Stores useState state, with one signal per key and JSON-serializable values, created per request on the server and transferred to the browser.
  • matchRoute Finds a URL's route in the route manifest, using the same criteria as SSR and client navigation, and returns its decoded parameters.
  • buildProject Builds the project like meeko build, without the preliminary check, and returns the adapter and output folder; for build scripts and tools.
  • prerenderRoutes Prerenders render "prerender" routes with a page handler and writes their HTML, navigation payloads and manifest.json index.
  • loadMeekoConfig Loads and validates a project's meeko.config.ts (or .mts, .js, .mjs) with Node 24 and returns its configuration, or {} if absent.
  • meeko (Vite) Meeko's Vite plugin, compiling .meeko imports for the client and SSR, adding HMR and CSS in development, applying auto-imports and generating framework virtual modules.
  • meekoUtilities PostCSS plugin that replaces each @utilities "<ruta>" with CSS rules generated by a TypeScript function, with HMR in meeko dev and the project's auto-imports.
  • mountDevtoolsPanel Mounts the Meeko DevTools panel in the page, isolated in Shadow DOM, with the instance tree, editable signals, timeline and breakpoints.

All exports #

The types, interfaces and low-level pieces that have no entry of their own above are still documented, one per page, in the index by module.

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: docs/reference/taxonomy.json