Skip to content
Jennifer Programming Language

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:

jennifer
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, so you can read it, fork it, or write your own. The modules listed here are the reference set that ships 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 (see jennifer version -v or meta.SYSMODDIR), then any -I DIR passed to jennifer 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 - 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).

ModuleImport withTinyGoContents
acmeimport "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 / ES256) over http + json; keys / CSR / JWK from crypto. Needs the default binary.
amqpimport "amqp.j";no (net)an AMQP 0-9-1 client for RabbitMQ over net: connect runs the connection / channel handshake (SASL PLAIN), then declareQueue -> QueueInfo, publish / publishText (method + content-header + body frames), get(c, queue, autoAck) -> Message (synchronous Basic.Get pull), ack, close. Server-pushed Basic.Consume via blocking receiveDelivery, declareExchange / bindQueue, message Properties on publish, nack / requeue, and publisher confirms (confirmSelect / waitConfirm). Binary frame / method encoding hand-built with the bitwise ops. The largest protocol module. Needs the default binary.
ansiimport "ansi.j";fullterminal styling as string wrappers. color / bgColor / style / rgb / strip plus per-colour and per-style shortcuts; TTY-aware.
argsimport "args.j";fulla 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.
barcodeimport "barcode.j";fullgenerate scannable codes as images. encode(data, symbology, opts) -> Symbol for qr (Reed-Solomon over GF(256), EC L/M/Q/H, versions 1-10, mask scoring, byte mode) and 1D code128 / code39 / ean13 / ean8 / itf; 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.
bloomimport "bloom.j";fulla 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 + strings + binary; both binaries.
cronimport "cron.j";fullcron 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.
csvimport "csv.j";fullRFC 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.
discordimport "discord.j";no (net)post to a Discord channel Webhook on http: send(webhookUrl, content) for a plain message, or build a rich message with message / content / embed(m, title, description, color), full embeds (embedField / embedFooter / embedAuthor), and per-message username / avatar identity override, and post it with sendMessage. render gives the JSON payload; strings JSON-escaped. Sibling of slack / gotify. Needs the default binary.
docblockimport "docblock.j";fullJennifer doc-comment format + parser. docblock.parse(source) -> a typed FileDoc (module preamble, per-construct FuncDoc / StructDoc / 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.
dotimport "dot.j";fullGraphviz 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.
dotenvimport "dotenv.j";full.env config files: parse(text) / read(path) -> map of string to string, and load(path) (parse + os.setEnv each). Handles # comments, export, single / double quoting, inline comments. Over fs + strings + os.
feedimport "feed.j";partialRSS 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 / feedUpdated / entryId / entryPublished / entryUpdated / entrySummary / entryContent), build / parse / kind, and fetch over http. Over xml + time (build / parse both binaries); fetch needs the default binary. Untrusted-feed-hardened (nesting cap, no billion-laughs, 64 MiB body cap).
flatdbimport "flatdb.j";fulla file-backed JSON document store over json + fs: open a file into a value-semantic DB, query / edit by JSON Pointer (get / has / keys / length / set / append / remove), save with a crash-atomic temp+rename. Crash-atomic snapshotting of small data, not a database engine.
fontimport "font.j";fulla pure-Jennifer TrueType / SFNT font parser (no Go): parse(b) / open(path) -> Font, then unitsPerEm / name / advance(f, cp) 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 / loca / glyf (simple + composite glyphs, quadratic curves) / name. TrueType glyf backend; CFF later. Both binaries.
gotifyimport "gotify.j";no (net)push notifications to a Gotify server, on top of http: push(cfg, title, message, priority) POSTs the message form with the X-Gotify-Key header, plus pushMarkdown / pushWith (click action) / pushExtras for markdown + click-action notifications via extras; value-semantic Config (url + token).
gpioimport "gpio.j";fullRaspberry-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; JENNIFER_GPIO_BASE overrides the sysfs root (tests / mounts). Absent-platform errors are clear, not crashes.
graphqlimport "graphql.j";no (net)a thin GraphQL client over http / rest: client(endpoint) plus bearer / basic / header / withCA / insecure 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 error with the joined messages; a non-2xx status also raises. tryQuery returns the envelope without raising (inspect via hasErrors / errorMessages + json accessors for extensions.code); queryNamed / tryQueryNamed add an operationName for multi-operation documents. Query is opaque; a mutation is just a query string.
htmlimport "html.j";fullbuild 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.
httpimport "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; requestRawBody / requestRawBodyTls send a raw bytes body byte-for-byte (multipart file upload). Redirects returned, not followed.
icalimport "ical.j";fulliCalendar (RFC 5545) build and parse: a Calendar of Events encoded to a VCALENDAR of VEVENTs and parsed back. calendar / event / describe / locate / add value-semantic builders, encode / parse. DTSTAMP / DTSTART / DTEND go through time (UTC DATE-TIME); text values RFC 5545-escaped, long lines folded, so parse(encode(cal)) round-trips. Pure text over strings / lists + time; both binaries. VEVENT-only (no RRULE / VALARM / TZID).
idnaimport "idna.j";fullinternationalized 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.
imapimport "imap.j";no (net)IMAP4rev1 client over net - read and manage folders: connect / folders (LIST) / status / selectFolder / search (filtered) / fetch / append / flag / copy / expunge / logout, plus fetchAll; messages parsed by mime. RFC 2177 IDLE push (idle -> receiveNotification / pollNotification -> done, typed EXISTS / EXPUNGE / RECENT). A practical subset, not read-only.
influxdbimport "influxdb.j";no (net)an InfluxDB time-series client on http, both 1.x and 2.x / 3.x (a Version enum on the Client; the line protocol is shared): build line-protocol points with value-semantic builders (point / tag / field / intField / stringField / boolField / at, mixed field types via pre-rendered fragments), line / write them (/write for 1.x, /api/v2/write?org=&bucket= for 2.x). client / clientWith (1.x, Basic auth) and client2(url, org, bucket, token) (2.x, token auth, redacted from errors); query runs InfluxQL, queryFlux runs Flux over /api/v2/query. Nanosecond precision. Needs the default binary.
ipnetimport "ipnet.j";fullIP 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. Addresses held as raw bytes (4 / 16); bitwise subnet math for allow-lists. Pure .j over strings + convert; both binaries.
jsonlimport "jsonl.j";fullJSON 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 / writeRecord / closeWriter) for files too large to hold in memory. A thin framing layer over json + fs; both binaries.
jsonrpcimport "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 Error{kind: "jsonrpc"}), plus a transport-agnostic handle(requestBody) -> replyBody that dispatches to the entry program's func NAME(params) methods by name (via meta.callMain), handling notifications, batches, and the reserved error codes. Needs the default binary.
jwtimport "jwt.j";partialJSON Web Tokens (RFC 7519): sign(claims, key, alg) / verify(token, key, alg) / decode(token) / header(token) over a json.Value claims object. Ten algorithms - HMAC HS256/384/512, RSA RS256/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). Over crypto + hash + encoding + json + time. HS\* / EdDSA on both binaries; RS\* / ES\* need the default binary.
kvstoreimport "kvstore.j";fullselectable key/value backend with per-key TTL: one Store (a sum-type enum) is a memcache connection, a redis connection, or the in-process kv library (inProcessStore in-memory / fileStore persisted). Uniform set / get / delete / touch / incrWindow; the shared backend layer under session and ratelimit. The distributed backends need the default binary; the local backend runs on both.
labelimport "label.j";partialindustrial 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.
ldapimport "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.
logimport "log.j";partialleveled, 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.
markdownimport "markdown.j";fullrender a small CommonMark subset (headings, emphasis, links, lists, code, GFM tables) to HTML (through html) and styled terminal text (through ansi) with toHtml / toAnsi; parse(md) surfaces the document as a Node tree walked like xml / html (typeOf / children / text / attr / get / findAll), and render(doc, format) renders a parsed or hand-built tree; toPdf(md) / toPdfWith(md, opts) / renderPdf(doc, opts) lay the document out to a paginated PDF (through pdf); plus authoring helpers (header / style / link / bullets / numbered / codeBlock / table) and tablePretty to align table source.
mcpimport "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) + initialize / listTools / callTool / readResource / getPrompt are the client over jsonrpc. Needs the default binary.
memcacheimport "memcache.j";no (net)a memcached client (classic text protocol) over net: set / add / get / delete / incr / decr / touch, every store with a TTL. For caches, sessions, counters, and locks (a volatile store, not a system of record).
mikrotikimport "mikrotik.j";no (net)a MikroTik RouterOS API client over net (8728 / api-ssl 8729): connect (plaintext login, MD5 fallback), talk(s, command, attrs) -> list of map of string to string (each !re row), print read sugar, run for add / set / remove (returns the !done =ret=). .tag-correlated commands and /listen-style server-push streaming (listen / receiveReply / cancel); a bounded read no longer leaks a stale deadline. Sentence-based binary framing (variable-length word codec) hand-built with the bitwise ops; !trap throws. Needs the default binary.
mimeimport "mime.j";fullbuild 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.
mqttimport "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.setDeadline), 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.
multipartimport "multipart.j";fullbuild 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. Byte-level delimiter matching so binary bodies round-trip. Pairs with web / http. Pure .j; both binaries.
ntpimport "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.
oauthimport "oauth.j";no (net)a generic OAuth2 client (the get-a-token half) on http + json: Client Credentials, Refresh Token, and Device Authorization grants, google / microsoft presets, expiry + on-disk token store. Tokens feed sasl XOAUTH2 for mail.
ormimport "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 "mysql" / "postgres" dialect), 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 / hasOne / hasMany / 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.
passwordimport "password.j";fullgenerate / 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.
pdfimport "pdf.j";fullgenerate simple PDF documents (text / lines / rectangles) the way html / label generate their formats: document / page / text / line / rect / color / addPage builders, info metadata (+ pdfDate), render() -> bytes writing the PDF object / xref structure by hand with FlateDecode content streams (via compress). Standard-14 fonts; points, 0-255 RGB. Byte-identical (no timestamps), qpdf-clean output - golden-test friendly; both binaries. A writer, not a reader (no embedded fonts / images yet).
plotimport "plot.j";fullData 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.
popimport "pop.j";no (net)receive mail (POP3 client) over net: plaintext / STLS / implicit TLS, USER / PASS. connect / stat / sizes / retrieve / deleteMessage / quit, plus fetchAll; messages parsed by mime.
prometheusimport "prometheus.j";partialmetrics in two halves. Exposition (counter / gauge / histogram / summary / observe / observeAt / render) builds a metric set and renders the Prometheus text format - histograms emit cumulative _bucket / _sum / _count, summaries emit quantile lines, an optional per-sample timestamp, plus pushgatewayPath for a Pushgateway grouping key. Pure text, runs on both binaries. Retrieval (query / queryRange -> Result) is a read client for the HTTP query API over http + json, so it needs the default binary. Strict name / label validation and escaping.
ratelimitimport "ratelimit.j";no (net)a fixed-window rate limiter on memcache (atomic incr + per-key TTL): allow(mc, key, limit, window) -> bool, remaining(mc, key, limit). The window resets on its own when it expires.
redisimport "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, and a production-safe scan cursor (keys now flagged production-unsafe).
resqueimport "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.
restimport "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.
ringbufferimport "ringbuffer.j";fulla 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.
s3import "s3.j";no (net)S3-compatible object storage (AWS S3 / MinIO / R2 / B2), AWS Signature V4-signed: connect -> Client, then get / put / delete / listObjects (+ objectKeys). Path-style; configurable endpoint. Over hash.hmac + http + time.
saslimport "sasl.j";fullSASL auth encoders shared by the mail clients: plain / loginUser / loginPass / bearer (XOAUTH2, the "use a token" half of OAuth2). Pure base64, no networking.
transportimport "transport.j";fullthe 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.
screenimport "screen.j";partialterminal 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.
semverimport "semver.j";fullstrict 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.
sessionimport "session.j";no (net)server-side sessions on memcache: a map of string to string under sess:ID with a sliding TTL. create / load / save / touch / destroy; UUID v4 IDs, base64-wrapped JSON values. Volatile (a cache, not a store of record).
slackimport "slack.j";no (net)post to a Slack Incoming Webhook on http: send(webhookUrl, text) for a plain message, or build a Block Kit message with message / text / section / header / divider, plus contextBlock / fieldsSection / actionsBlock (button) blocks, and post it with sendMessage. render gives the JSON payload; strings JSON-escaped. Sibling of discord / gotify. Needs the default binary.
smtpimport "smtp.j";no (net)send mail (SMTP client) over net: plaintext / STARTTLS / implicit TLS, AUTH PLAIN, MAIL FROM / RCPT TO / DATA. smtp.send(opts, from, recipients, message); message built by mime.
snmpimport "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.
sqlmigrateimport "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 plain DDL strings (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. Version allowlisted + description escaped (injection-safe). Needs the default binary.
statsdimport "statsd.j";no (net)a fire-and-forget StatsD metrics client over UDP: client / clientWith -> Client (agent address + optional name prefix), then count / increment / decrement (counter c), gauge (g), timing (ms), set (s) each emit one metric:value|type datagram. The push counterpart to a pull-based scrape; no reply, no error when no agent listens. Extensions: countRate / timingRate (|@rate), *Tagged verbs (DogStatsD |#k:v tags), countFloat / gaugeFloat, and a value-semantic Batch (batch / add* / flush) packing several metrics into one datagram; every line control-character validated. Needs the default binary.
telegramimport "telegram.j";no (net)a Telegram Bot API client on http + json: bot / botWith -> Bot, getMe, sendMessage / sendMessageWith (parse mode) / sendPhoto / sendChatAction -> Message / bool, and getUpdates(bot, offset, timeout) long-poll -> list of Update for a stateful receive loop. Inline keyboards (sendMessageWithKeyboard), callback_query handling (parseCallbackQuery / answerCallbackQuery), local-file upload (sendPhotoFile / sendDocumentFile), and bot-token redaction from errors. Form-encoded params, {"ok":false} throws. Needs the default binary.
tengineimport "tengine.j";fulla 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.
totpimport "totp.j";fulltime-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.
uriimport "uri.j";fullURL / 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; both binaries. The shared URL layer the network modules build on.
validateimport "validate.j";fulldeclarative 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 / isInt / isFloat / isBool / 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}). An absent / blank field passes all but required. Over regex + uri + time + password + convert; both binaries.
vcardimport "vcard.j";fullvCard (RFC 6350, vCard 4.0) contacts build and parse: a Card of contact fields encoded to a VCARD and parsed back. card / withName / withOrg / addEmail / addPhone / address / addAddress / withUrl / withNote value-semantic builders, encode / encodeAll / parse (one or many cards). Structured N / ADR / ORG, RFC 6350 text escaping and 75-char line folding - shares the content-line codec with ical. Pure text over strings / lists; both binaries. A contact subset (no BDAY / PHOTO / parameter round-trip).
webimport "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.
webapiimport "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), 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.
webhookimport "webhook.j";full (send net)HMAC-signed webhooks (GitHub X-Hub-Signature-256): sign(payload, secret) / verify(payload, signature, secret) are pure (both binaries); plus replay-protected timestamped signing schemes - Stripe (stripeSign / stripeVerify), Slack (slackSign / slackVerify), and a generic digest/encoding variant (timestampedSign / timestampedVerify); send(url, payload, secret) POSTs the signed body via http (default binary). Over hash.hmac + encoding (hex).
websocketimport "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. Binary framing + masking with the bitwise ops over hash + encoding + math. Needs the default binary.

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 a runnable demo under examples/modules/. See modules/README.md for the contributor checklist.

See also

  • Imports guide - use vs include vs import, resolution rules, and the module boundary in depth.
  • Libraries catalog - the Go system libraries a module builds on.