Appearance
Reference
The reference is the Weft specification itself. Where the guide teaches, these pages define: what the compiler accepts, what it rejects, and what a program does when it runs.
- The language: the syntax, types, values, functions, components, modules, the server and the limits.
- The prelude: the types every file has without an import and their methods, the error types, and the modules every free function comes from (std/math, std/json, std/log, std/time…).
- The app framework: the file tree of an app: pages, layouts, errors, components, modules and routes in code.
- The server runtime: how a program serves: one Weft thread, I/O beside it, limits, the wire and server functions over HTTP.
- std/http: the HTTP server (routes, middleware, sessions, CORS, static files) and client.
- std/auth: sign-in: passwords, passkeys, email links and codes, OAuth and OpenID Connect, roles, guards and CSRF.
- std/app: serving an app: pages rendered on the server, the client, endpoints, user trees.
- std/db: the database: the schema in Weft, queries at three levels, policies, migrations, on SQLite, Postgres and MySQL.
- std/live: live connections, channels and live queries: a server function call kept current in the page.
- std/s3: buckets on any S3-compatible store: objects, listing, presigned URLs, streamed uploads and downloads.
- std/time: instants, durations, dates, times and time zones, the clock and timers.
- std/theme: the theme as Weft: colours, fonts, radii and shadows, evaluated into CSS variables when the project is built.
- std/sandbox: user code: trees checked when saved, run with only what the app passes in.
- Users' files: the API an app exports to user code, its compatibility, the export index, history, migrations and deprecations.
- std/process: the arguments, environment, input, output and exit of the running program, and the programs it runs.
- std/fs: files and directories for scripts and servers, and paths.
- std/net: TCP and TLS sockets: clients, listeners and STARTTLS.
- std/regex: regular expressions in a linear-time dialect, the same on every backend,
regex"…"checked at compile time. - std/crypto: hashes, HMAC, constant-time comparison, random bytes, UUID v7, signatures and JWTs.
- std/url: URLs as WHATWG parses them, query strings, percent-encoding and base64url.
- The MCP server:
weft mcp: the tools an AI agent works on a project with, from reading and editing to screenshots and tests.
How these pages are made
Each page is a file in the repository's spec/ directory (spec/language.md, spec/std.md, spec/app.md, spec/std/*.md), converted when the site is built. Nobody edits the pages here, so they always say what the spec says.
The specification uses a few words precisely:
- error: the compiler rejects the program, with a diagnostic. An error value is what a function fails with: data of its error type (
R ! E), which the caller handles or passes on withtry. See Errors. - panics: the program hits a bug when it runs (an index out of range,
!onnull). Ordinary code can't handle a panic: it ends the turn, and only@try, the server's 500 andassertPanicssee it. See Panics. - stop: the program hits a limit (fuel, memory, stack, the deadline). Nothing handles a stop. See Limits.
Some parts of the specification refer to files that are not on this site, such as expressions.md or docs/plan.md. They live in the repository beside the spec.