Packages
These are Tern's first-party packages: maintained with the language, but not part of the standard library. Two kinds:
roost,auth,openapi,sentry,grpc,queue,pg,migrateandsqlgenlive in repositories of their own.tern add roostputs one in your project'stern.modand fetches it intodeps/(an installed Tern carries a copy of each, so this works offline). The web template (tern new NAME --template web) adds roost, auth and migrate for you, and thetern migrateandtern sqlgencommands run Tern's own copies.sqliteandredisare packages too, but for now they come with Tern, because the runtime works closely with them: a program just imports them.
They're written the way any package is: see Writing and publishing a package to make your own.
| Package | What it's for |
|---|---|
| roost | A web framework on the http engine: routing, middleware, WebSockets, SSE, static files, uploads, validation, rate limits, metrics |
| sqlite | SQLite databases with bound parameters and typed row reading |
| pg | A PostgreSQL client with a connection pool shared by tasks |
| redis | A Redis client with automatic pipelining |
| migrate | Schema migrations for PostgreSQL and SQLite from numbered .sql files: up, down, status, locking |
| sqlgen | Typed Tern functions generated from SQL queries, checked against PostgreSQL or SQLite (like sqlc) |
| auth | JSON Web Tokens and signed-cookie sessions |
| openapi | OpenAPI 3.1 documents, Swagger UI and a typed TypeScript client from roost routes described with Tern types |
| sentry | Error reporting to Sentry: runtime errors with stack traces, request data, breadcrumbs |
Two more have no page yet; their API is the comment at the top of their source, in deps/grpc/grpc.tn and deps/queue/queue.tn once added: grpc (gRPC over HTTP/2) and queue (a client for the ternq broker). tern guide NAME prints any package's API.