Jennifer modules
A module is distributable Jennifer source: a .j file whose exported names you bring in with import, the same call shape as a system library:
import "ansi.j" as ansi;
io.printf("%s\n", ansi.bold(ansi.red("error")));Modules are not the Go system libraries. A library (use NAME;, see ../libraries/index.md) is compiled into the interpreter binary; a module is ordinary Jennifer code that ships as a file you can read, fork, or replace. The modules listed here ship with Jennifer under modules/; the mechanism itself (import / export, resolution, run-once init) is documented in the Imports guide.
How a module resolves
import picks the resolution mode from the leading token of the path:
import "./util.j" as u;(or../) - local, relative to the importing file's directory.import "/opt/m.j" as m;- absolute path.import "ansi.j" as ansi;(no./, no/) - module lookup through the search path: the system module directory first (seejennifer version -vormeta.SYSMODDIR), then any-I DIRpassed tojennifer run. The importing file's own directory is never consulted in this mode.
Distribution packages install the shipped modules to the system module directory (/usr/share/jennifer/modules/ by default), so import "ansi.j"; resolves with no path. The as ALIAS clause is optional - without it the module is addressed by its file stem (import "ansi.j"; then ansi.red(...)).
Available modules
The TinyGo column reports whether the module runs on the constrained jennifer-tiny binary. A module is only as portable as the libraries it uses: the pure-text modules run on either binary, while smtp uses net, so it needs a build with a network stack.
A no (net) entry means the module needs net, which the stock jennifer-tiny build ships without (a build choice, not a TinyGo limitation). A jennifer-tiny rebuilt with a network stack runs the net-backed modules too; see the note on net and TinyGo. Read "needs the default jennifer binary" throughout these docs as "needs a build that includes a network stack" (the stock jennifer has one).
| Module | Import with | TinyGo | Contents |
|---|---|---|---|
acme | import "acme.j"; | no (net) | ACME (RFC 8555) client: obtain / renew TLS certificates from Let's Encrypt and compatible CAs. connect / register an account, order domains, fetch each authorization + challenge, compute the HTTP-01 keyAuthorization or DNS-01 dnsRecord (pure), accept + pollAuthorization, then finalize with a crypto.csr and downloadCertificate. Every request a JWS (RS256, or ES256 / ES384 / ES512 by curve) over http + json; a CA's refusal throws an acme.AcmeError carrying the RFC 7807 problem; keys / CSR / JWK from crypto. Needs the default binary. |
amqp | import "amqp.j"; | no (net) | an AMQP 0-9-1 client for RabbitMQ over net: connect runs the connection / channel handshake (SASL PLAIN), then declareQueue / declareQuorumQueue -> QueueInfo, declareExchange / bindQueue, publish / publishWith (message Properties) / publishMandatory / publishText, get(c, queue, autoAck) -> Message (synchronous Basic.Get pull), server-pushed deliveries with consume / receiveDelivery / cancelConsume (prefetch with qos), ack / nack, publisher confirms (confirmSelect / waitConfirm), close. Errors are amqp.AmqpError with the broker's replyCode. Binary frame / method encoding hand-built with the bitwise ops. Needs the default binary. |
ansi | import "ansi.j"; | full | terminal styling as string wrappers. color / bgColor / style / rgb / color256 / bgColor256 / rgbToColor256 / strip plus per-colour and per-style shortcuts; wrappers nest. Colour only when stdout is a terminal, with NO_COLOR / FORCE_COLOR overrides. |
args | import "args.j"; | full | a declarative CLI argument parser (argparse-style) over os.ARGS: a value-semantic Parser built with copy-returning builders - typed flags (long + short, default, required, choices), count / append actions, positionals with nargs (? / * / + / N), subcommands, and --version. parse -> a Result read with asString / asInt / asFloat / asBool / asList / count / has. Unknown / missing / bad-type / bad-choice throw a catchable Error{kind:"args"}; -h / --help set done + helpText. Both binaries. |
barcode | import "barcode.j"; | full | generate scannable codes as images. encode(symbology, data, opts) -> Symbol for 2D qr (Reed-Solomon over GF(256), EC L/M/Q/H, versions 1-40, mask scoring, numeric / alphanumeric / byte mode) and datamatrix (ECC200, 10x10 to 26x26), and 1D code128 / code93 / ean13 / ean8 / upca / upce / itf / code39 / gs1-128; render with svg / png (hand-encoded over compress + crc) / terminal / matrix. The GF(256) math lives in a private barcode_ecc.inc.j. No image library. Both binaries. |
bloom | import "bloom.j"; | full | a Bloom filter (probabilistic set): new(size, hashes) (or optimal(n, fpr) for FPR-target sizing), add / addAll, mightContain - no false negatives, possible false positives; serialize / deserialize to bytes and union / merge. Bits packed in bytes; k positions from double-hashing one SHA-256 digest. Value-semantic. Over hash + math + binary; both binaries. |
cron | import "cron.j"; | full | cron schedules: parse(expr) -> Schedule, matches(schedule, t), next(schedule, after) -> time.Time. Five fields with * / , / - / /n; the dom-OR-dow rule; named months (JAN-DEC) and weekdays (SUN-SAT); @-nickname macros (@daily / @hourly / @weekly / @monthly / @yearly / @midnight / @reboot, @reboot being startup-only, never a clock match). A pure calculator over time. |
csv | import "csv.j"; | full | RFC 4180 comma-separated values. parse / format (*With for any delimiter), toRecords / fromRecords for header-keyed maps; quoting-aware. formatSafe neutralises spreadsheet-formula injection (CWE-1236); a Dialect groups delimiter / quote / comment / trim; streaming reader / writer handles over fs.File. |
docblock | import "docblock.j"; | full | Jennifer doc-comment format + parser. docblock.parse(source) -> a typed FileDoc (module preamble, per-construct FuncDoc / StructDoc / EnumDoc / ConstDoc, tags, and Diagnostics). Reports drift (a @param naming no real parameter, a parameter with no @param) and orphans; string-literal- and nesting-correct scanner. Data, not rendering. |
doctree | import "doctree.j"; | full | the document tree markdown.parse, rst.parse and myst.parse build, or a program builds by hand: a Node walked like xml / html (typeOf / children / text / level / attr / get / findAll / has), rendered by render("html" / "xhtml" / "ansi", doc) / renderHtml(doc, opts) (through html / ansi) and laid out to a paginated PDF by renderPdf / renderPdfDoc (through pdf; PdfOptions from pdfDefaults()). |
dot | import "dot.j"; | full | Graphviz DOT graph description: build a graph of nodes and edges with attributes (digraph / graph, node / nodeWith, edge / edgeWith, graphAttr / nodeAttr / edgeAttr) and render it to .dot text for an external Graphviz tool to lay out (dot -Tsvg). Value-semantic builders; DOT-escaped strings; emits the description only (graph layout is Graphviz's job). Pure .j over strings / lists, both binaries. |
dotenv | import "dotenv.j"; | full | .env config files: parse(text) / read(path) -> map of string to string, and load(path) (parse + os.setEnv each). Layered profiles (readCascade / resolve / loadCascade / autoload: .env -> .env.local -> .env.<profile> -> .env.<profile>.local, profile from JENNIFER_ENV, a real OS variable always wins). Handles # comments, export, single / double quoting, inline comments, ${VAR} interpolation. Pure .j, both binaries. |
feed | import "feed.j"; | full | RSS 2.0 and Atom 1.0 web syndication in one module - build and parse, format chosen on build ("rss" / "atom") and detected on parse. A value-semantic Feed of Entry with builders (feed / entry / add / addAll / feedUpdated / entryId / entryPublished / entryUpdated / entrySummary / entryContent), build / parse / kind. Over xml + time, no network (fetch with http.get, then parse). Untrusted-feed-hardened (nesting cap, no billion-laughs). |
flatdb | import "flatdb.j"; | full | a file-backed JSON document store over json + fs: open a file into a value-semantic DB, query / edit by JSON Pointer (get / getOr / has / keys / length / set / append / remove), save with a crash-atomic temp+rename that fails if the file changed since open; update(path, transform) runs a read-modify-write under a cross-process lock. Crash-atomic snapshotting of small data, not a database engine. |
font | import "font.j"; | full | a pure-Jennifer TrueType / OpenType (SFNT) font parser (no Go): parse(b) / open(path) -> Font, then metrics (unitsPerEm / ascender / descender / capHeight / xHeight / bbox / ...), name, advance(f, cp) / glyphId / kern, and glyphPath(f, cp) -> SVG path d / glyph(f, cp) -> Glyph (contours of on / off-curve Points). Parses head / cmap (formats 4 + 12) / maxp / hhea / hmtx / OS/2 / kern / name and both outline backends: TrueType glyf (simple + composite glyphs) and CFF (OTTO fonts, CID-keyed included; isCff). Both binaries. |
gpio | import "gpio.j"; | full | Deprecated: use the gpio library (/dev/gpiochipN, gpio.open(path) -> gpio.Chip); removed in 0.29.0. Raspberry-Pi (Linux SBC) GPIO over sysfs (fs is the whole backend): setup(pin, "in"/"out"), write(pin, 0/1), read(pin), release(pin). Stateless, pin-keyed (BCM numbers, mapped through the header chip's sysfs base; useChip overrides); JENNIFER_GPIO_BASE overrides the sysfs root (tests / mounts). Absent-platform errors are clear, not crashes. |
graphql | import "graphql.j"; | no (net) | a thin GraphQL client over http / rest: client(endpoint) plus bearer / basic / header / withCA / withSkipVerify builders, then query(c, query, variables) -> json.Value (POSTs {query, variables}; result under /data). Handles the GraphQL error convention - a non-empty errors array is an HTTP 200, not a non-2xx - raising a graphql.GraphqlError (kind "graphql") with the server's messages and codes; a non-2xx status also raises. tryQuery returns the envelope without raising (inspect via hasErrors / errorMessages / errorCodes); withTimeout / withRetries (queries only, never a mutation) / withBackoff set the policy; queryNamed / tryQueryNamed add an operationName for multi-operation documents. Query is opaque; a mutation is a plain query string. |
html | import "html.j"; | full | build an HTML element tree and render escaped HTML5. element / text / raw / attr / boolAttr (valueless boolean attribute, renders disabled not disabled="") constructors, render / renderAll, escape; void-element aware. Plus a tolerant parse -> the same Node tree (void / self-closing / unquoted-attr / mismatched-nesting / comment / script-raw tolerant), walked by get / findAll / has (XPath-ish selectors) + attrOf / hasAttr; build and parse round-trip through one model. |
http | import "http.j"; | no (net) | an HTTP/1.1 client over net (https:// via TLS): method-agnostic request plus get / post / put / patch / delete / head / options -> Response (status, headers, body); Content-Length + chunked framing, header case-insensitive lookup; sendBytes sends a raw bytes body byte-for-byte (multipart file upload) and returns a raw bytes body. The verbs return a 3xx; send follows redirects (with retries and a cookie jar), and connect / exchange keep one connection alive. sendDigest / digestAuthorization answer an HTTP Digest (RFC 7616) challenge. |
ical | import "ical.j"; | full | iCalendar (RFC 5545) build and parse: a Calendar of Events (VEVENT) and Todos (VTODO) encoded to a VCALENDAR and parsed back. Value-semantic builders (calendar / event / describe / locate / add / todo / addTodo / ...), recurrence (recur / rule, RDATE / EXDATE, expanded by occurrences), all-day dates, a TZID zone, ORGANIZER / ATTENDEEs and VALARM alarms; encode / parse (malformed input throws an IcalError). Times go through time; text values RFC 5545-escaped, long lines folded, so parse(encode(cal)) round-trips. Pure text over strings / lists + time; both binaries. |
idna | import "idna.j"; | full | internationalized domain names: toAscii / toUnicode over a Punycode (RFC 3492) core (münchen.de <-> xn--mnchen-3ya.de), plus isAscii. Used by the mail clients for hosts and envelope domains. |
imap | import "imap.j"; | no (net) | IMAP4rev1 client over net - read and manage folders: connect / folders (LIST) / status / selectFolder / search (filtered) / fetch / fetchHeaders / append / addFlags / removeFlags / copy / move / createFolder / expunge / logout, plus fetchAll; a refusal throws an imap.ImapError; messages parsed by mime. RFC 2177 IDLE push (idle -> receiveNotification / pollNotification -> done, typed EXISTS / EXPUNGE / RECENT). A practical subset, not read-only. |
ipnet | import "ipnet.j"; | full | IP addresses and CIDR networks, IPv4 and IPv6. parseAddress / toString (canonical, RFC 5952 for IPv6) / version / equal; parse(cidr) -> Network (host bits zeroed), contains(net, addr), netmask / broadcast / networkString, host iteration (hosts / firstUsable / lastUsable / hostCount), split / aggregate / overlaps / subnetOf, and address classes (isPrivate / isLoopback / scope / ...); IPv4-mapped IPv6 folds to v4. Addresses held as raw bytes (4 / 16); bitwise subnet math for allow-lists. Pure .j over strings + convert; both binaries. |
jsonl | import "jsonl.j"; | full | JSON Lines (JSONL / NDJSON): newline-delimited JSON, one json.Value per line. encode / decode (compact JSON split / joined on \n, blank lines skipped, so decode(encode(rows)) round-trips), whole-file readFile / writeFile / appendFile, and streaming Reader / Writer handles over an open fs.File (openReader / hasMore / readRecord / closeReader; writer / writeValue / closeWriter) for files too large to hold in memory. A thin framing layer over json + fs; both binaries. |
jsonrpc | import "jsonrpc.j"; | no (net) | JSON-RPC 2.0, client and server, over http + json: a Client and call(client, method, params) -> json.Value / notify (params and result are json.Values; an error reply throws a jsonrpc.RpcError of kind "jsonrpc" with its code and data), plus a transport-agnostic handle(requestBody) -> replyBody that dispatches to the entry program's func NAME(params) functions by name (via meta.callMain), handling notifications, batches, and the reserved error codes. Needs the default binary. |
jwt | import "jwt.j"; | partial | JSON Web Tokens (RFC 7519): sign(alg, claims, key) (signWithKid adds a header kid) / verify(alg, token, key) / decode(token) / header(token) over a json.Value claims object. Thirteen algorithms - HMAC HS256/384/512 (key at least 32 / 48 / 64 bytes), RSA RS256/384/512, RSA-PSS PS256/384/512, ECDSA ES256/384/512, and EdDSA (Ed25519). verify pins the expected algorithm (rejects algorithm-confusion), enforces exp / nbf, and compares HMACs in constant time; verifyLeeway adds clock-skew tolerance, verifyWithKeys selects the key by the header's kid from a caller-supplied map, and verifyJwks resolves the kid against a JWKS (converting the JWK via crypto.jwkToPem, refusing one whose use / alg / kty does not fit), with jwksKeys to convert a set once; the ...With forms add a jwt.Policy (issuer, audience, required exp, leeway). Over crypto + hash + encoding + json + time. HS* / EdDSA on both binaries; RS* / PS* / ES* need the default binary. |
kvstore | import "kvstore.j"; | full | key/value store with per-key TTL behind one Store (a sum-type enum): the in-process kv library (inProcessStore in-memory / fileStore persisted), or a memcache / redis connection through memcache.kvStore / redis.kvStore (default binary). Uniform set / get / delete / touch / incrWindow; the shared backend layer under session and ratelimit. Imports no network module. |
label | import "label.j"; | partial | industrial label printing in a build / render / emit pipeline. Build a device-independent Label in millimetres (new / text / barcode / box / image / quantity; barcodes code128 / ean13 / itf / code39 / gs1-128 / datamatrix / qr), render(label, device) to a selectable dialect ("zpl" Zebra, "cab" cab JScript), then emit - send(host, port, rendered) to a printer's raw :9100 port. Build / render run on both binaries; send needs the default binary. |
ldap | import "ldap.j"; | no (net) | an LDAP v3 client and directory server (RFC 4511) on the asn1 BER codec + net (LDAPS / StartTLS via transport.Security). Client: connect -> Conn, then bind / bindSasl (SCRAM), search (RFC 4515 parseFilter or equals / present / allOf / ... over SCOPE_BASE / ONE / SUB) / searchPaged (AD's paged control), and writes add / modify / delete / modifyDn / passwordModify (RFC 3062); binary values (AD objectGUID) come back base64. Server: a mutable in-memory (directory) or file-backed (openDirectory) directory of entry / group records answers simple bind (userPassword verify) + filtered search - read-only over LDAP but mutable from code (addEntry / modifyEntry / deleteEntry / setAttribute), enough to back an auth portal such as Authelia. Needs the default binary. |
log | import "log.j"; | partial | leveled, structured logging: a Logger carries a minimum level (debug < info < warn < error), a format (text / logfmt / json), and a sink; debug / info / warn / error / fatal (logs then exits 1) (at for a runtime level) render one record - timestamp, level, message, map of string to string fields - and write it, dropping records below the level. with(logger, fields) returns a child logger stamping persistent fields on every record. Sinks new (stdout) / toStderr / toFile / toSyslog (RFC 5424 over UDP). Console + file work on both binaries; the syslog sink needs the default binary. |
markdown | import "markdown.j"; | full | a CommonMark reader (0.31.2: 644 of the 652 spec examples) plus GFM tables, task lists, strikethrough and footnotes, alerts, definition lists, sub / superscript, highlight and attribute lists: parse(md) builds a doctree document, and toHtml / toXhtml / toAnsi / toPdf / toPdfWith render it through doctree's renderers (raw HTML escaped unless allowRawHtml); plus authoring helpers (header / style / link / bullets / numbered / codeBlock / table) and tablePretty to align table source. |
mcp | import "mcp.j"; | no (net) | Model Context Protocol (stateless JSON-RPC 2.0), server and HTTP client. Build a Server (server + addTool / addResource / addPrompt, each with a json.Value schema); handle(server, requestBody) -> replyBody is the transport-agnostic router (initialize / ping / tools/resources/prompts list + call, an allow-list so only a registered item dispatches), serveStdio(server) runs the stdio transport, and connect(endpoint) (HTTP) or connectStdio (a launched subprocess) + initialize / listTools / callTool / listResources / readResource / listPrompts / getPrompt are the client. Needs the default binary. |
memcache | import "memcache.j"; | no (net) | a memcached client (classic text protocol) over net: set / setBytes / add / get / getBytes / getMulti / gets + cas / delete / incr / decr / touch, every store with a TTL; kvStore -> a kvstore.Store; a protocol error throws a memcache.MemcacheError. For caches, sessions, counters, and locks (a volatile store, not a system of record). |
mime | import "mime.j"; | full | build and parse MIME messages (RFC 5322 headers, multipart, quoted-printable / base64 transfer encodings, RFC 2047 encoded-words for non-ASCII headers). text / attachment / multipart / encode / parse; the foundation the mail clients build on. |
mqtt | import "mqtt.j"; | no (net) | an MQTT 3.1.1 pub/sub client over net (mqtts via TLS): connect -> Client, then subscribe / publish / publishBytes (QoS 0), blocking receive and single-threaded poll(client, timeoutMs) (via net.setReadDeadline), ping, disconnect. QoS-1 publish/subscribe with the PUBACK handshake (publishQos1 / subscribeQos1), retained messages, a CONNECT Last-Will (connectWith), and reconnect session resumption. Binary packet framing built with bitwise ops + bytes. |
multipart | import "multipart.j"; | full | build and parse multipart/form-data (RFC 7578) - the file-upload counterpart to mime. field / file build Parts, build / buildWith -> Built{contentType, body} (fresh or fixed boundary), parse(contentType, body) -> list of Part; text / isFile read a part. Bodies are bytes, so binary file content round-trips; parse runs in Go (encoding.parseMultipart). Pairs with web / http; both binaries. |
myst | import "myst.j"; | full | read MyST (CommonMark plus rST-style directives and roles, as Sphinx / Jupyter Book write it) into a doctree document: backtick and colon directive fences, roles, (label)= targets and {ref} / {numref} / {eq} references, % comments, +++ breaks, front matter, dollar math; the admonitions, code-block, math, image / figure, table / list-table / csv-table, contents, raw, eval-rst (through rst); toHtml / toXhtml / toAnsi, frontMatter, and check for Diagnostics. Reads no files. |
ntp | import "ntp.j"; | no (net) | a simple SNTP network-time client (RFC 4330 / 5905) over UDP: query(host) / queryWith(address, timeoutMs) -> Result (serverTime + clock offset + round-trip delay). Packs / unpacks the 48-byte NTP packet with bytes + bitwise ops and converts the NTP epoch through time; a lost reply times out (not hangs). Query-only (no clock discipline / daemon). Needs the default binary. |
oauth | import "oauth.j"; | no (net) | a generic OAuth2 client (the get-a-token half) on http + json: Client Credentials (secret or client assertion), Refresh Token, Device Authorization, Authorization Code + PKCE, and JWT Bearer (RFC 7523, service accounts) grants, endpoint discovery, expiry + on-disk token store (provider presets: the @deckyard/oauthext deck). Tokens feed sasl XOAUTH2 for mail. |
orm | import "orm.j"; | no (sql) | a relational mapper over the sql library - Data Mapper, not Active Record (structs have no methods). Declare an orm.Schema (schema / column + attribute setters notNull / unique / autoIncrement / withDefault, carrying the dialect orm.Dialect.Mysql / Postgres), then CRUD through an orm.Session (session auto-commit / transaction inside a sql.Tx): insert / find / update / delete and all over a functional query builder (from / where / orderBy / limit / join -> fresh Query -> toSql). Records are map of string to string; values bind only through placeholders (injection-safe). DDL builders (createTable / dropTable / addColumn / createIndex / addForeignKey / ...); relations (belongsTo / oneToOne / oneToMany / manyToMany + joinRelation) with eager loading (with / load -> Result, N+1-free in a fixed 1+R queries); a write path (upsert / insertMany / insertReturning / updateWhere / deleteWhere / save) and finders (first / exists / findBy / pluck / page). Migrations are the sqlmigrate module. Needs the default binary. |
password | import "password.j"; | full | generate / validate / score passwords against a policy Schema (classes, length range, per-class minimums, symbol set, exclude-ambiguous). schema + with* builders, generate -> string, validate -> Report{valid, reasons}, complexity -> Strength{length, classes, poolSize, entropy, label} (bits = length * log2(pool)). Crypto-grade RNG (via crypto), so generated passwords are safe as real credentials; pure .j, both binaries. |
pdf | import "pdf.j"; | full | generate PDF documents the way html / label generate their formats: document / page / text / line / rect / color / link / addPage builders, info metadata (+ pdfDate), bookmarks, page headers / footers, render() -> bytes writing the PDF object / xref structure by hand with FlateDecode content streams (via compress). Standard-14 fonts plus embedded TrueType fonts (loadFont / addFont / textUnicode, any script the font covers), embedded PNG / JPEG images (loadImage / addImage / drawImage), and text layout (measureText / wrapText / textBlock). Points, 0-255 RGB. Byte-identical (no timestamps), qpdf-clean output; over the font module and the images library, both binaries. A writer, not a reader. |
plot | import "plot.j"; | full | Data plotting to SVG: a unified chart(series, opts) renders one or more Series (line / points / both / filled area, solid or dashed, with error bars and marker shapes) on shared axes with a positioned legend; line / scatter / bar / bars (grouped or stacked multi-series, negative/diverging bars, optional data labels) / histogram are wrappers. Automatic "nice" ticks, a gridded frame, title, and labels, plus log scales, a date axis (x = Unix seconds via time), reference lines (hline / vline), fonts + margins, native <title> hover tooltips, and save(svg, path). The visual companion to the stats / ml numeric stack, pure .j over math / time / fs / strings / lists / convert, both binaries. |
pop | import "pop.j"; | no (net) | receive mail (POP3 client) over net: plaintext / STLS / implicit TLS; auth by USER / PASS, XOAUTH2, CRAM-MD5 or SCRAM. connect / stat / listSizes / retrieve / uidl / top / deleteMessage / quit, plus fetchAll; messages parsed by mime. A server -ERR throws a pop.PopError. |
ratelimit | import "ratelimit.j"; | full | a rate limiter over a kvstore.Store (the in-process kv, or memcache / redis on the default binary): fixedWindow(store, limit, window) / slidingWindow -> Limiter; check(limiter, key) -> Result{allowed, remaining, retryAfter, resetSeconds} records a hit, peek does not. |
redis | import "redis.j"; | no (net) | a Redis client speaking RESP2 over net: commands as RESP arrays, replies parsed into a Reply. Typed helpers get / set / del / exists / incr / keys / ping, plus a generic command for the rest. RESP2 pub/sub (subscribe / psubscribe / publish / blocking receiveMessage), one-round-trip pipeline, multi / exec / discard transactions, hash / list / set helpers, and a production-safe scan cursor (keys blocks the server; avoid it in production). kvStore -> a kvstore.Store. A -ERR reply throws a redis.RedisError. |
resque | import "resque.j"; | no (net) | background jobs on Redis, wire-compatible with Resque: enqueue onto named queues, reserve from a worker in priority order (Job = queue / class / args), queueLength / queues / size / fail. Interops with Ruby-resque / php-resque workers. Built on redis + json. |
rest | import "rest.j"; | no (net) | an ergonomic REST layer over http + json: a value-semantic Client (base URL + headers) and get / post / put / patch / delete (+ getJson / postJson / ...). Base-URL joining, query strings, Bearer / Basic auth. |
ringbuffer | import "ringbuffer.j"; | full | a fixed-capacity ring buffer (bounded FIFO of strings, overwrite-oldest when full): new(capacity), push / pop, first / last peek, size / capacity / isEmpty / isFull / toList. A sliding window of recent items. Value-semantic. Over lists; both binaries. |
rst | import "rst.j"; | full | read reStructuredText into a doctree document: sections, lists (bullet / enumerated / definition / field / option), grid and simple tables, literal and doctest blocks, quotes, line blocks, docinfo, the common directives (admonitions, code-block, image / figure, topic, contents, list-table / csv-table, raw, ...), inline markup and roles, references and targets, footnotes, citations and substitutions; toHtml / toXhtml / toAnsi, title / docinfo, and check for Diagnostics (lenient by default, Options{strict: true} throws). No file access: include and :file: options are refused. |
s3 | import "s3.j"; | no (net) | S3-compatible object storage (AWS S3 / MinIO / R2 / B2), AWS Signature V4-signed: connect -> Client, then get / put / delete / head / copy / listObjects (+ objectKeys, continuation), presign (also in s3presign, which runs on both binaries), and multipart upload (createMultipartUpload / uploadPart / completeMultipartUpload). Errors are s3.S3Error. Path-style; configurable endpoint. Over hash.hmac + http + time. |
s3presign | import "s3presign.j"; | full | presigned S3 URLs with no network: the s3 subset Client / connect / S3Error / presign (same names, same SigV4 code), so a presign-only program moves between the two by its import. |
sasl | import "sasl.j"; | full | SASL mechanisms shared by the mail clients: the encoders plain / loginUser / loginPass / bearer (XOAUTH2, the "use a token" half of OAuth2), CRAM-MD5 (cram) and SCRAM-SHA-1 / SCRAM-SHA-256 (scramStart ... scramVerify). No networking; both binaries. |
screen | import "screen.j"; | partial | terminal user interfaces (an explicit screen, not a GUI). Output-only layer (both binaries): a cell Buffer you draw into (newScreen / set / text / textColor / box / fill / hline / vline), ANSI control strings (clear / moveTo / hideCursor / enterAlt / ...), and a flicker-free render / diff paint loop. Interactive layer (needs term, default binary): a pure decodeKey (arrows / nav / function / ctrl / alt keys) plus nextKey / begin / end / size over raw mode. 0-based coords, clipped drawing. |
semver | import "semver.j"; | full | strict Semantic Versioning 2.0.0, package-registry-grade. parse / isValid / toString, compare / lt / lte / eq / neq / gt / gte / diff, isStable / isPrerelease, inc*, sort / rsort; coerce / clean for loose tags; and npm/Composer range matching - satisfies (caret / tilde / comparators / || / hyphen / x-ranges, prerelease-aware), maxSatisfying / minSatisfying / minVersion / validRange, plus solver algebra intersects / subset / gtr / ltr / outside / simplifyRange (prerelease-precise). Struct Version. |
session | import "session.j"; | full | server-side sessions over a kvstore.Store (the in-process kv, or memcache / redis on the default binary): a json.Value under sess:ID with a sliding TTL. create / load / save / touch / destroy, exists / rotate (call on login / logout; check exists before saving a client-sent id); ttl >= 1; UUID v4 IDs, base64-wrapped JSON values. Volatile (a cache, not a store of record). |
smtp | import "smtp.j"; | no (net) | send mail (SMTP client) over net: plaintext / STARTTLS / implicit TLS; SASL AUTH PLAIN, LOGIN, XOAUTH2, CRAM-MD5 or SCRAM. smtp.send(opts, from, recipients, message), or open a Session and sendOn many messages over one handshake; message built by mime. A rejected command throws an smtp.SmtpError. |
snmp | import "snmp.j"; | no (net) | an SNMP v1 / v2c client and agent over UDP, on asn1 + net. Client: client / clientWith -> Client, then get / getNext / set / subtree walk return a list of Varbind {oid, type, value, number} (typed by SNMP value type - integer / octetString / oid / counter32 / timeTicks / ipAddress / ...). Agent (server / hardware simulator): agent(community, version, bindings) + serve / serveOn answer GET / GETNEXT / SET for a MIB. Community-string auth; intVar / stringVar / oidVar / varbind build bindings. No SNMPv3 / traps. Needs the default binary. |
soap | import "soap.j"; | no (net) | SOAP 1.1 / 1.2 over http + xml. Client: connect(endpoint) -> Client (withVersion / withBasicAuth / withToken / withDigestAuth / withHeader / withSoapHeader / TLS / withMaxBytes), call(c, action, body) -> xml.Value (a fault throws) or send -> Reply{status, envelope, isFault, fault}; operation(ns, name, params, qualified) builds a request, values reads a result. Server: transport-agnostic handle(body, action, handler) / handleWith -> Response{status, contentType, body}, with VersionMismatch / MustUnderstand / Client / Server faults and senderFault. Codec: envelope / parse, Fault{code, subcode, reason, actor, detail} via parseFault / faultEnvelope. WSDL 1.1: parseWsdl / parseWsdlWith -> Wsdl, wsdlCall / wsdlCallAt / wsdlCallTo -> WsdlCall, wsdlConnect, wsdlRequest. DOCTYPEs refused. Needs the default binary. |
sqlmigrate | import "sqlmigrate.j"; | no (sql) | version-tracked schema migrations over the sql library, decoupled from orm: a Migration{version, description, up, down} whose up / down are list of string DDL statements (from orm's DDL helpers or hand-written). migrate(conn, migrations) applies pending versions in lexical order (each in its own transaction, recorded in schema_migrations; idempotent), rollbackMigrations(conn, migrations, steps) reverses the newest N, migrationStatus reports applied / pending. A database advisory lock serialises concurrent runners. Version allowlisted + description escaped (injection-safe). Needs the default binary. |
tengine | import "tengine.j"; | full | a lightweight-CMS text template engine (a subset of Go text/template) over a json.Value tree: newSet / add / render. .path / $ root / $var, if / else if with eq / and / or / not, range (with $i, $e) / with / block, {{ $x := }} variables, define / template layout inheritance, {{- -}} trim markers, and pipes upper / lower / title / trim / html / urlize / default / truncate / join / len / printf. |
totp | import "totp.j"; | full | time-based one-time passwords (RFC 6238 / 4226): generate / verify (+/-1-step skew), generateAt / verifyAt (explicit time), and verifyWindow (configurable skew), plus crypto-grade generateSecret / generateSecretN, an exported RFC 4226 hotp, and uri for the otpauth:// provisioning string. base32 secrets; SHA-1 / SHA-256 / SHA-512. Over hash.hmac + encoding + time. |
transport | import "transport.j"; | full | the shared connection-security mode for every socket client (smtp / pop / imap / redis / amqp / mqtt): one Security enum (None / Tls / Starttls) instead of a stringly-typed security field per module, plus encrypted(s). No networking; both binaries. |
uri | import "uri.j"; | full | URL / URI parsing, building, and query-string handling (RFC 3986): parse -> Uri (scheme / user / host / port / path / query / fragment) and build back; encode / decode (RFC 3986 percent-encoding) and encodeForm / decodeForm (application/x-www-form-urlencoded, space as +); buildQuery / parseQuery between a map of string to string and a query string; and resolve for RFC 3986 relative-reference resolution. Pure .j over strings + encoding + convert + regex; both binaries. The shared URL layer the network modules build on. |
validate | import "validate.j"; | full | declarative data validation: check a map of string to string (a form body, query, or config) against a rule set and get a structured Failure list. Rules compose per field as value-semantic descriptors - required / integer / number / boolean / min / max / minLen / maxLen / pattern / email / url / datetime / oneOf / noneOf (blacklist) / password (a password.Schema policy) / custom (a func predicate) / withMessage; check -> list of Failure ({field, rule, param, message}), ok short-circuits, messages / byField render, localize(errs, templates) re-messages for i18n (rule-id -> template, %param% / %field%); checkValue checks one value, ensure / ensureValue throw Error{kind: "validation"}. An absent / blank field passes all but required. Over regex + uri + time + password + convert; both binaries. |
vcard | import "vcard.j"; | full | vCard (RFC 6350, vCard 4.0) contacts build and parse: a Card of contact fields encoded to a VCARD and parsed back. Value-semantic builders (card / withName / withFullName / withOrg / withNickname / addEmail / addPhone / addAddress and their *Typed forms with a TYPE / withBday / withPhoto / addCategory / withUrl / withNote), encode / encodeAll / parse (one or many cards, vCard 2.1 / 3.0 / 4.0; malformed input throws a VcardError). RFC 6350 text escaping and 75-char line folding, shared with ical. Pure text over strings / lists; both binaries. |
web | import "web.j"; | no (net) | a small HTTP framework over the httpd engine: register routes against handler func values (web.get / post / ...), :param capture, middleware, web.Context request / response helpers; web.run owns the accept loop. Handlers dispatch as func values called in their home context. Pairs with jennifer serve. |
webapi | import "webapi.j"; | no (net) | a JSON-API conventions layer over web: a uniform error envelope, request validation (reusing validate), versioned route mounting (mount / alias / deprecate), pluggable bearer auth + rate limiting (entry-program func values, like route handlers; 429 + Retry-After, keyed per identity or client host, or a limitKey function), content negotiation, and pagination. A value-semantic Api builder finished with install, enforced by one before guard shim; the Spec evaluation (evaluate) is a pure, testable core. Auth / Produces enums. Over web + validate + json; default binary only. |
webdav | import "webdav.j"; | no (net) | a WebDAV client (RFC 4918) for any server (Nextcloud, ownCloud, Apache, nginx, a NAS): connect(url) -> Client (withBasicAuth / withToken / withHeader / TLS), readDir / walk / stat / exists, get / put / putWith (ETag ifMatch, onlyIfNew), mkdir / mkdirAll, delete, move / copy, and any property via propfind / proppatch (Clark names). The protocol layer is exported for a server: Resource, parseMultistatus / multistatus, path and href helpers. Over http + xml. |
webhook | import "webhook.j"; | full | HMAC-signed webhooks (GitHub X-Hub-Signature-256): sign(payload, secret) / verify(payload, signature, secret), signedHeaders(payload, secret) for a delivery posted through http (default binary); plus replay-protected timestamped signing schemes - Stripe (stripeSign / stripeVerify), Slack (slackSign / slackVerify), and a generic digest/encoding variant (timestampedSign / timestampedVerify). All pure, over hash.hmac + encoding (hex). |
websocket | import "websocket.j"; | no (net) | an RFC 6455 WebSocket client over net (ws:// / wss://): connect / connectWith do the HTTP Upgrade handshake (verifying the SHA-1 + base64 Sec-WebSocket-Accept), then send / sendBytes (masked frames) and receive -> Message (auto-pong, fragment reassembly), ping / close; connectOptions adds handshake headers, subprotocols and TLS trust. Binary framing + masking with the bitwise ops over hash + encoding + crypto. Needs the default binary. |
zmq | import "zmq.j"; | no (net) | ZeroMQ over ZMTP 3.1 (no libzmq): one socket per peer, connect / listen + accept; PAIR, PUB / SUB, REQ / REP, DEALER / ROUTER, PUSH / PULL; multipart send / receive / poll, reply with the REP / ROUTER envelope; NULL and PLAIN (no CURVE). Errors are zmq.ZmqError. |
Writing your own
A module is a declarations-only file: its top level permits only def const, def struct, func, use, and import - no mutable module state and no free-standing statements. Prefix a top-level func / def struct / def const with export to publish it; unmarked names stay module-private. Each file states its own use imports (use is not transitive across a module boundary).
Every module that ships in this repository carries a co-located white-box test overlay (NAME_test.j) run with jennifer test, and most have a runnable demo under examples/modules/. See modules/README.md for the contributor checklist.
See also
- Imports guide -
usevsincludevsimport, resolution rules, and the module boundary in depth. - Libraries catalog - the Go system libraries a module builds on.