Standard Library

Standard library

The standard library ships 37 canonical modules. They are not loaded by default - import them when you need them.

ModuleImportPurpose
Accessimport accessCapability, role, audit, and rate-limit primitives for public API authorization
API Contextimport api_contextTyped request metadata, verified identity, capability helpers, idempotency key, request ID
API Responseimport api_responseJSON response envelope helpers (ok_object, error_object, paging envelopes)
Authimport authIn-memory and SQLite auth services, OIDC provider configuration, signed-cookie settings
Bytesimport bytesBinary data, encoding/decoding (base64, hex)
CLIimport cliCommand-line argument parsing
Collectionsfrom collections import ...List, dict, and set operations (map, filter, reduce, keys, values, etc.)
Configimport configDeployed app config and secrets through Via's workload-identity-bound config server
Contentimport contentSafe public content domain types (IssueTitle, MarkdownBody, SafeHtml, PublicUrl, ...)
Cryptoimport cryptoHashing, encryption, HMAC, signatures, encoding
CSVimport csvRFC 4180 CSV parsing and writing
Decimalimport decimalArbitrary-precision decimal arithmetic
Environmentimport envEnvironment variable access
Filesystemimport fsFile I/O with typed paths and Result returns
HTTPimport httpHTTP client (GET, POST, PUT, DELETE) and static file server
JSONimport jsonTree API, streaming, mutable building
JSON Schemaimport json_schemaSchema-based JSON validation
Loggingimport logLog level, sink, capture
Mappingimport mappingTyped row-to-contract mapping helpers (map_rows, json_array_map)
Mathimport mathTrigonometry, logarithms, rounding, constants
Metricsimport metricsApp-authored runtime metrics emitted through the Via runtime
Moneyimport moneyCurrency-safe monetary arithmetic
Pagingimport pagingCursor pagination helpers (PageSlice, page_slice) for handlers
Pathimport pathPure path manipulation utilities
Processimport processSubprocess execution, argv, exit, cwd
Projectionimport projectionField projection policy for policy-aware JSON construction
Randomimport randomRandom integer generation
Scannerimport scannerText scanning and pattern matching
Service Clientimport service_clientLow-level typed service client construction
Service Responseimport service_responseTyped decoding of ServiceResponse values
Templateimport templatePebble-backed template rendering
Textimport textString utilities (split, join, trim, pad, etc.)
Timeimport timeInstant, Duration, Clock. Typed time API
URLimport urlURL parsing, building, and query encoding
URL Policyimport url_policyPublic outbound URL, host, DNS, and redirect policy checks
UUIDimport uuidUUID v4 generation, parsing, and validation
XMLimport xmlXML/Atom builder helpers with escaping (xml_element, xml_attr)

The api_context module also exposes verified identity fields and helper functions for handler bindings: principal_id, subject, issuer, session_id, api_token_id, roles, auth_kind, auth_verified, csrf_verified, plus optional_user(ctx), authenticated_user(ctx), has_capability(ctx, name), required_capability(ctx, name), require_csrf(ctx), and request_capabilities(ctx).

← Built-in functions