# Velt > Velt compiles TypeScript's good parts to one native executable: no interpreter, no garbage collector, every core in use. It runs your .ts files and leaves JavaScript's dynamic tricks out. Velt is a compiled language with TypeScript syntax: `velt run app.ts` compiles a `.ts`/`.tsx`/`.velt` file to native code through LLVM. Valid TypeScript behaves as in Node, but the dynamic parts of JavaScript are left out on purpose (`eval`, prototypes, run-time decorators, `with`, `delete`, loose `==`); read [Velt for TypeScript developers](https://veltlang.com/docs/book/ts-developers.md) before writing code. Velt adds integer types (`i64`, `u8`…), typed errors (`throws`), `extend`, operator methods, typed compile-time decorators, `spawn` and `velt/*` standard modules. Every docs page has a markdown rendition at its URL with the trailing slash replaced by `.md`; the whole corpus is https://veltlang.com/llms-full.txt. ## The book - [The Book](/docs/book.md): The Book teaches Velt from the ground up, with an eye on what is new if you come from TypeScript. Every Velt code block in it is compiled by the documentation tests. - [Getting started](/docs/book/getting-started.md): Install Velt on Linux, macOS or Windows, create a project with velt new, and build your first native executable. - [A tour of Velt](/docs/book/tour.md): Velt reads like TypeScript and runs like Rust: it compiles to native code, has no garbage collector, and runs your async code on every core of the machine. - [Velt for TypeScript developers](/docs/book/ts-developers.md): If you write TypeScript, you already write Velt: classes, interfaces, generics, unions and narrowing, discriminated unions, closures, async/await, template literals,… - [Building an HTTP server](/docs/book/http-server.md): This guide builds a small JSON API for todos on the http-server package: routing, request bodies, validation, errors as status codes, shared state, and tests. - [Building a command-line tool](/docs/book/cli-app.md): This guide builds count, a small wc-like tool: arguments and --help, reading files, error messages and exit codes, and tests. - [Server-rendered pages with TSX](/docs/book/ssr-pages.md): This guide builds HTML pages on the server with TSX: components, lists, a layout, data loaded by async components, and pages streamed to the browser. - [Async and concurrency](/docs/book/async.md): Velt's async/await behaves like JavaScript's: promises start when you create them, and output order matches Node. - [Error handling](/docs/book/errors.md): Velt keeps JavaScript's throw, try, catch and finally, and adds what TypeScript can't: the compiler knows exactly which errors every call can throw. - [Memory without a GC](/docs/book/memory.md): JavaScript runtimes reclaim memory with a garbage collector: objects live until the collector finds them unreachable, which costs memory headroom and pauses. - [Modules and packages](/docs/book/packages.md): Split a program into modules with ES module syntax, and share code as packages declared in package.velt. - [Testing](/docs/book/testing.md): velt test finds every *.test.velt file (and *.test.ts, *.test.tsx) and runs every exported function whose name starts with test_. - [Hot reload](/docs/book/hot-reload.md): velt dev is the fast edit loop: run your program once, then every save updates the running program, usually in well under 100 ms and without losing its state. - [Packages with native code](/docs/book/native-packages.md): Most packages are pure Velt. A package that needs a C library calls it with declare c, checked against its headers; programs allow such packages with allowNative. ## Language reference - [The Reference](/docs/reference.md): This is the precise description of the Velt language: what the compiler accepts, what it rejects, and what the compiled program does. - [Lexical structure](/docs/reference/lexical.md): How Velt reads source files: programs, comments and semicolons, identifiers, literals, keywords and operators. - [Types](/docs/reference/types.md): Velt's types: fixed-width integers and floats, number, strings, arrays, tuples, unions, object types, generics and SIMD vectors. - [Variables and conditions](/docs/reference/variables.md): const and let, truthiness in conditions, module state, and module constants. - [Functions and closures](/docs/reference/functions.md): Function declarations, overloads, generics, generators, parameters, arrow functions and function types, and how closures capture. - [Classes and interfaces](/docs/reference/classes.md): Every object has a compile-time shape (a fixed layout), so a field access is one load: no hidden classes and no runtime shape checks. - [Decorators](/docs/reference/decorators.md): Typed compile-time decorators: declare decorator function, @x and @x(args) on classes, members, functions, structs, enums and parameters, checked like a call. - [Control flow](/docs/reference/control-flow.md): Statements that direct a program: if and loops, for…of, for…in, iterables, for await and switch. - [Errors](/docs/reference/errors.md): throw, try, catch and finally have JavaScript syntax and TypeScript-style types, and they compile to zero-cost result returns: every throwing call is "call, check a tag, branch". - [Async](/docs/reference/async.md): Async functions, promises, await, spawn and the multi-threaded runtime: how Velt runs async code on every core. - [Memory model](/docs/reference/memory.md): There is no garbage collector, and nothing ever pauses the program: memory is freed deterministically when the last reference to it goes away. - [Modules](/docs/reference/modules.md): Exports, imports and re-exports, scripts with top-level statements, namespaces, module specifiers, and .ts/.tsx files. - [Built-ins](/docs/reference/builtins.md): These names are in scope in every module without an import. They come from the compiler and from the standard library's prelude (prelude reference). - [Diagnostics](/docs/reference/diagnostics.md): The compiler reports errors as path:line:col: error: message, followed by notes (= note: …) and related locations (--> path:line:col). - [TSX](/docs/reference/tsx.md): Velt compiles TSX, the JSX syntax of .tsx files, for server-side rendering: an element is a call into a *JSX provider*, which renders HTML (or builds whatever its client needs). - [System functions](/docs/reference/system-functions.md): declare system function: calling the platform's C library (pread, fsync, fcntl, …) directly, checked against the compiler's table of safe functions. - [C functions and unsafe code](/docs/reference/c-interop.md): declare c binds C functions, constants, types and structs, checked against the library's C headers; unsafe blocks and SAFETY comments mark every call. - [Host functions](/docs/reference/host-functions.md): declare host("module") function: functions the JavaScript host provides to a program built for wasm32-unknown-unknown, what crosses, async host functions and HostRef. - [Source generators](/docs/reference/source-generators.md): Generic functions whose bodies a Velt generator writes at compile time, per type: serializers, comparers and printers without run-time reflection. ## Standard library - [Standard library guide](/docs/std.md): The standard library is written in Velt and ships with the toolchain. Import a module by its path under velt/, like velt/fs or velt/net/http. - [Prelude](/docs/std/prelude.md): The globals every module sees without an import: strings, numbers, arrays, Map, Record, iteration, JSON, errors, Date and the async functions. - [The prelude: Symbol](/docs/std/prelude/symbol.md): JavaScript's Symbol, a global: unique values compared by identity, the Symbol.for registry and the well-known symbols. - [The prelude: typed arrays](/docs/std/prelude/typed_array.md): ArrayBuffer, DataView and the typed arrays are globals that behave as in Node, with views of shared bytes and conversions to Velt's u8[]. - [velt/mem](/docs/std/mem.md): Facts about how values are stored, for code that manages its own memory layout: needsDrop, Blank, and Arena, a typed memory pool. - [velt/mem: Arena](/docs/std/mem/arena.md): Arena from velt/mem: a typed memory pool whose values are named by u32 index and released all at once with reset(), which keeps the memory. - [velt/cli](/docs/std/cli.md): Command-line argument parsing with Node util.parseArgs rules and a commander-style builder: flags, options with defaults, positionals and generated help. - [velt/collections](/docs/std/collections.md): Containers beyond the prelude's arrays and Map: Deque, PriorityQueue, SortedMap, BTreeMap, ConcurrentMap and Set, written in Velt. - [velt/collections: BTreeMap](/docs/std/collections/btree_map.md): BTreeMap from velt/collections: an ordered map as a B+ tree, with O(log n) updates, ordered walks, range queries and batched lookups. - [velt/collections: ConcurrentMap](/docs/std/collections/concurrent_map.md): ConcurrentMap from velt/collections: a map with u64 or string keys that many threads read and write at once, with lock-free reads of shared memory and per-node latches. - [velt/collections: Deque](/docs/std/collections/deque.md): Deque from velt/collections: a double-ended queue on a growable ring buffer, amortized O(1) at both ends and O(1) by index. - [velt/collections: PriorityQueue](/docs/std/collections/priority_queue.md): PriorityQueue from velt/collections: a binary heap ordered by a comparator, with O(log n) push and pop. - [velt/collections: Set](/docs/std/collections/set.md): Set: an insertion-ordered hash set with JavaScript Set semantics plus the ES2025 set algebra. A global, also exported by velt/collections. - [velt/collections: SortedMap](/docs/std/collections/sorted_map.md): SortedMap from velt/collections: a map with its keys in ascending order, on two sorted arrays. Small maps, fast ordered iteration. - [velt/compress](/docs/std/compress.md): Compression and decompression written in Velt: gzip, zlib, raw DEFLATE and Brotli, for whole buffers or for streams that arrive or leave in pieces. - [velt/crypto](/docs/std/crypto.md): Hashes, HMAC and HKDF, X25519 and P-256 key exchange, ECDSA verification, ChaCha20-Poly1305 and AES-GCM, secure random values and constant-time comparison, in Velt. - [velt/dev](/docs/std/dev.md): What a program run by velt dev takes part in: the graceful stop before its next version starts, so no request in flight is cut off. - [velt/encoding/csv](/docs/std/encoding/csv.md): RFC 4180 CSV: parse rows or header-keyed records, and write rows that quote only where needed. - [velt/encoding](/docs/std/encoding.md): Converts between bytes and text: Base64 (standard and URL-safe), hex and UTF-8, a string's bytes without a copy, and the TextEncoder, TextDecoder, btoa and atob globals. - [velt/ffi](/docs/std/ffi.md): What crosses to C functions declared with declare c: Ptr, StrBytes, CString, Out, OutPtr, and copies of C memory. - [velt/fs](/docs/std/fs.md): File system access: read and write files, list directories, stat, links, copy, rename and remove, each async or *Sync, plus Node's file-descriptor API and file streams. - [velt/fs: file streams](/docs/std/fs/stream.md): openRead and openWrite from velt/fs: read files or byte ranges in chunks or line by line, and write them through a buffer, for files too large to hold in memory. - [velt/generate](/docs/std/generate.md): The source generator API: write, in Velt, the body of a generic function for each type a program uses it with, at compile time and without reflection at run time. - [velt/hash](/docs/std/hash.md): FNV-1a 64: a stable, non-cryptographic hash for sharding, bucketing and consistent hashing, the same on every platform and in every Velt version. - [velt/half](/docs/std/half.md): import { f16FromBytes, widenF16 } from "velt/half". f16[] and bf16[] in bulk: loaded from bytes, widened to and narrowed from f32[], and their dot products. - [velt/host](/docs/std/host.md): import { HostRef } from "velt/host". JS values the host keeps for a program on a JavaScript host, passed to and from host functions. - [velt/io](/docs/std/io.md): IoError, the error every failed I/O operation throws, with Node's codes and messages, and the module of the ReadableStream globals. - [velt/encoding/json](/docs/std/encoding/json.md): Typed JSON: JSON.parse checks the text against your types, JSON.stringify writes any value as Node does, and JsonValue holds JSON whose shape you don't know. - [velt/math](/docs/std/math.md): Integer helpers (clamp, gcd, lcm, isPrime, fib) and BigInt, arbitrary-precision integers. Float math is the prelude's Math. - [velt/math: BigInt](/docs/std/math/bigint.md): BigInt from velt/math: arbitrary-precision integers like JavaScript's BigInt, with arithmetic as methods and in-place forms for hot loops. - [velt/native](/docs/std/native.md): What the Velt side of a package with a Rust crate binds its Rust functions with: IoResult, IoStatus, and the functions that turn a failed result into an IoError. - [velt/net](/docs/std/net.md): import { listen, connect } from "velt/net". TCP, and TLS over TCP, including startTls over an open stream. TcpListener and TcpStream are structs around a handle. - [velt/net/dns](/docs/std/net/dns.md): import { lookup } from "velt/net/dns". Host name resolution through the system resolver. - [velt/net/http](/docs/std/net/http.md): fetch, Request, Response and Headers: global, as in Node, and exported by velt/net/http. HTTP/1.1, and HTTP/2 to https origins that offer it. - [velt/net/http/h2](/docs/std/net/http/h2.md): HTTP/2's wire format (RFC 9113) and HPACK (RFC 7541), written in Velt: what the fetch client and HTTP/2 servers share. - [velt/net/udp](/docs/std/net/udp.md): import { bindUdp } from "velt/net/udp". UDP sockets. Addresses are "host:port" strings. - [velt/net/url](/docs/std/net/url.md): A WHATWG-style URL and URLSearchParams, plus JS's URI encoding functions: globals, as in Node; velt/net/url exports them too. - [velt/net/websocket](/docs/std/net/websocket.md): import { connectWebSocket, WebSocket } from "velt/net/websocket". WebSockets (RFC 6455), as a client or over a connection a server upgraded. - [velt/os](/docs/std/os.md): import { platform } from "velt/os". Facts about the machine, a subset of Node's os module. - [velt/package](/docs/std/package.md): import type { Package } from "velt/package". The types of the package manifest, package.velt, and of the workspace manifest. Types only; nothing imports it at run time. - [velt/path](/docs/std/path.md): import { join, dirname } from "velt/path". POSIX path manipulation (Node's path.posix) as pure string code. The separator is always / on every platform. - [velt/process](/docs/std/process.md): The builtin process (env, argv, stdout, exit) and import { args, cwd } from "velt/process": arguments, environment, working directory, terminals and standard input. - [velt/process/child](/docs/std/process/child.md): import { exec, execSync, spawn } from "velt/process/child". Runs other programs, found through PATH, with arguments passed as-is. - [velt/process: standard input](/docs/std/process/stdin.md): import { lines, readLine } from "velt/process". Reads standard input, line by line or all at once, sync or async. - [velt/reflect](/docs/std/reflect.md): import { typeOf, entryCount } from "velt/reflect". What a dynamic value holds at run time: its kind, type, entries and identity, for libraries. - [velt/random](/docs/std/random.md): import { random, randomInt } from "velt/random". Fast pseudo-random numbers like Math.random(), for simulations, sampling, shuffling, jitter and load generation. - [velt/random/uuid](/docs/std/random/uuid.md): import { uuidv4, uuidv7 } from "velt/random/uuid". RFC 9562 UUIDs. The text form is lowercase 8-4-4-4-12; the binary form is 16 bytes in network order. - [velt/text](/docs/std/text.md): import { RegExp, StringBuilder, escapeHtml } from "velt/text". Regular expressions, a string builder and HTML escaping. - [velt/text: HTML escaping](/docs/std/text/html.md): import { escapeHtml } from "velt/text". Escapes text for HTML element content and quoted attribute values in one pass. - [velt/text: regular expressions](/docs/std/text/regex.md): RegExp is a global, as in Node, and so are regex literals (/ab+c/gi): JavaScript-flavoured, linear-time regular expressions. import { RegExp } from "velt/text" also works. - [velt/text: StringBuilder](/docs/std/text/string_builder.md): StringBuilder is a global: a string built by appending to one growing buffer, handed over without a copy. - [velt/test](/docs/std/test.md): import { describe, it, expect } from "velt/test". The test runner behind velt test, with Vitest's describe, it, hooks and expect. - [velt/test/http](/docs/std/test/http.md): import "velt/test/http". Adds toHaveStatus and toHaveHeader to expect(response), for tests of HTTP servers and clients. - [velt/time](/docs/std/time.md): import { DateTime, Duration, delay, Ticker } from "velt/time". Dates and durations, timers, and a drift-free periodic schedule. - [velt/time: DateTime and Duration](/docs/std/time/datetime.md): import { DateTime, Duration } from "velt/time". A UTC-first instant (months are 1-12) and a signed span, with parsing, formatting and calendar fields. - [velt/time: timers](/docs/std/time/timers.md): setTimeout, setInterval and setImmediate are globals, as in Node, and run in Node's order. import { Ticker } from "velt/time" for a drift-free periodic schedule. - [velt/sync](/docs/std/sync.md): Lock-free shared state: the prelude's Atomic, Atom, ThreadLocal, and velt/sync's Backoff and VersionLatch. - [velt/sync: channels](/docs/std/sync/channel.md): import { channel } from "velt/sync". Typed queues between tasks, bounded or unbounded, for producer/consumer pipelines and worker pools. - [velt/sync/epoch](/docs/std/sync/epoch.md): Epoch-based reclamation: drop a shared value other threads may still be reading once none can be. pin, unpin, retire and collect. - [velt/db](/docs/std/db.md): What database drivers share: typed rows from any source of tabular data (RowSource, readRows), parameters value by value (ParamSink, writeParams), and native drivers' binders. - [velt/jsx](/docs/std/jsx.md): Server-side rendering of TSX to HTML: renderToString, renderToStream with async components, escaping as react-dom escapes, and every HTML, SVG and MathML element type-checked. - [velt/jsx/attrs](/docs/std/jsx/attrs.md): The attribute types velt/jsx's IntrinsicElements is made of (HtmlAttrs, AnchorAttrs, SvgAttrs, MathAttrs, …), for JSX providers that extend them. - [velt/jsx/jsx-runtime](/docs/std/jsx/jsx-runtime.md): The JSX provider module of velt/jsx: the JSX namespace and the factories compiled TSX calls. Programs import from velt/jsx instead. - [velt/simd](/docs/std/simd.md): import { u8x16, f32x4 } from "velt/simd". The 128-bit SIMD vector types, their masks, dot products, and the CPU's SHA, carry-less multiplication and AES instructions. - [velt/io: streams](/docs/std/io/streams.md): ReadableStream, its reader and controller: WHATWG streams as in Node, read with a reader, with for await, or as a Response body. - [velt/task](/docs/std/task.md): import { timeout, taskScope } from "velt/task". Cancellation with AbortController and AbortSignal, timeouts, task scopes, caught panics and task placement. ## Packages - [Packages](/docs/packages.md): The official Velt packages: http-server, web, sqlite, postgres, redis and cloudflare. What they are, why they are not std, and how a program depends on one. - [http-server](/docs/packages/http-server.md): An HTTP/1.1 and HTTP/2 server written in Velt: web-standard Request/Response handlers, HTTPS, streaming, files, WebSockets, graceful stops, and Cloudflare Workers. - [sqlite](/docs/packages/sqlite.md): Embedded SQLite with a synchronous API close to better-sqlite3, and a read-only SQLite engine written in Velt (sqlite/engine). - [postgres](/docs/packages/postgres.md): A PostgreSQL client close to node-postgres: connections, pools, typed rows, transactions, batches and streamed COPY. - [redis](/docs/packages/redis.md): A Redis client close to ioredis: one multiplexed connection, pipelines, MULTI/EXEC transactions, pub/sub and TLS. - [web](/docs/packages/web.md): A reference router and middleware on http-server: routes with parameters, sub-apps, typed per-request variables, CORS, logging, rate and body limits, compression, static files. - [cloudflare](/docs/packages/cloudflare.md): Run Velt programs on Cloudflare Workers with host-cloudflare, and use Cloudflare's bindings: R2, D1, KV, the cache and Durable Object stubs. ## Tooling - [Tooling](/docs/tooling.md): Everything ships in one velt binary. - [The velt command](/docs/tooling/cli.md): One binary is the whole toolchain: compiler, runner, test runner, formatter, package manager, language server and documentation generator. - [velt dev](/docs/tooling/dev.md): velt dev runs your program and keeps it up to date while you edit, usually keeping its memory and open connections. - [package.velt](/docs/tooling/manifest.md): Every package has a package.velt at its root: the manifest, written in Velt. velt new and velt init write one. - [Packages](/docs/tooling/packages.md): The package manager built into velt: dependencies from a registry, a local path, a git repository or a release archive, pinned by velt.lock.json, and packages with native code. - [Formatter](/docs/tooling/fmt.md): velt fmt formats Velt and TypeScript sources in place with one style and no options, like gofmt. - [Lint and fixes](/docs/tooling/lint.md): velt check --perf finds TypeScript habits that cost speed in Velt, --fix applies fixes, and lint in package.velt and velt-allow comments set what is reported. - [Editors](/docs/tooling/editors.md): velt lsp is a Language Server Protocol server on stdin/stdout. It works in any editor with an LSP client; the repository ships a Visual Studio Code extension in editors/vscode,… - [Debugging](/docs/tooling/debugging.md): Velt executables are native programs with standard debug info, so any native debugger works: LLDB or CodeLLDB on macOS and Linux, GDB on Linux, the Visual Studio debugger on… - [WebAssembly](/docs/tooling/webassembly.md): Velt programs compile to WebAssembly for WASI runtimes and for JavaScript hosts: browsers, Node, Deno and Cloudflare Workers. - [Platforms](/docs/tooling/platforms.md): Supported platforms, prerequisites, the bundled linker, cross-compiling, and installing a release or building a distribution.