Skip to content

Releases: forinda/kzig

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 28 Oct 03:59
v0.3.0
884828e

kzig 0.3.0 gives the app's mode a kzig name: KZIG_ENV. Requires Zig 0.17.0. Pre-alpha: APIs will change.

Highlights

  • KZIG_ENV says how the app runs: development, test, or anything else (unset included) for production. It turns on dev_defaults, the migrations-at-boot policy, and Swagger with disable_in_prod. NODE_ENV is still read when KZIG_ENV isn't set, so KickJS .env files and deployment configs keep working; KZIG_ENV wins when both are set.
  • Process.env: inject *const kzig.Process and read .development, .@"test" or .production (dev_or_test is still there).
  • kzig new: the scaffolded Config no longer has a node_env field that defaulted to development while the app ran as production, and its tests boot with KZIG_ENV=test.
  • Releases now get their notes from scripts/release-notes.sh: hand-written highlights from .github/release-notes/<tag>.md, then the commits since the last tag. RELEASING.md documents the flow.

Changes to note when upgrading

  • kzig dev and kzig start set KZIG_ENV (to development / production) instead of NODE_ENV, and only when neither is set. If your own Config reads a node_env field, either set NODE_ENV yourself or read Process.env instead.

Features

  • KZIG_ENV says how the app runs (NODE_ENV still read when it's unset); Process.env; the scaffold's Config drops its misleading node_env

Maintenance

  • release notes from the commits since the last tag (scripts/release-notes.sh, used by the release workflow); RELEASING.md

Install

zig fetch --save git+https://github.com/forinda/kzig#v0.3.0

Prebuilt kzig CLIs for Linux (x86_64, aarch64) and macOS (x86_64, arm64) are attached, with SHA256SUMS.

Full changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 28 Oct 03:20
v0.2.0
b1c1ac3

kzig 0.2.0 adds scheduled jobs, file storage and a database layer, and moves the docs to
https://forinda.github.io/kzig/, with a tutorial from
kzig new to a Docker image. Requires Zig 0.17.0. Pre-alpha: APIs will change.

Highlights

Database (kzig.db)

kick/db's code-first layer, in Zig.

  • Postgres without libpq. A pure-Zig client with SCRAM-SHA-256, a pool and transactions, and rows decoded into structs by column name.

    • TLS follows libpq's sslmode, with sslrootcert or the system's CAs, and sslnegotiation=direct (Postgres 17).
    • Channel binding (SCRAM-SHA-256-PLUS).
    • Client certificates on TLS 1.3 and 1.2: EC, RSA and Ed25519 keys, encrypted keys with sslpassword.
    • Revocation lists (sslcrl).
  • Schema and queries. Tables are Zig struct literals. The query builder covers select, insert, update, delete, joins, upsert, findOrCreate and insertMany, and a wrong column or value type is a compile error.

  • Relations. one, many and through are resolved with kick/db's rules. client.query(.t).findMany(.{ .with = … }) reads nested rows in one statement.

  • Migrations. kzig db generate writes kick/db's migration folders from your schema, with renames by prompt or flag; kzig db check is for CI. kzig db migrate, rollback and status, or kzig.db.migrate.onBoot, apply them, so a kick/db app and a kzig app can share a folder.

  • SQLite, Turso and Cloudflare D1. The same schema, builder, relations and migrations, in three forms:

    • sqlite:path for local files. Needs -Dsqlite, which builds SQLite's C library; the default build stays C-free.
    • libsql:// for Turso, over HTTP.
    • d1:// for D1, over its REST API.

    On SQLite, Turso and D1, parameters bind by their Zig type.

Also new

  • Scheduled jobs. pub const crons = .{ … } on any service: 5- or 6-field expressions checked at compile time, timezones from zoneinfo, overlap control, manual runs.
  • Storage. kzig.storage over memory, a disk folder, or S3 (AWS, R2, MinIO, SeaweedFS), with SigV4 signing (no SDK), presigned links and listing.
  • Routing. Routes now match through a segment tree built at compile time.

Docs

  • The guides moved from the README to a site built with MkDocs (Material).
  • The API reference is built from the source by Zig's autodoc, at /api/.
  • The tutorial builds a bookmarks API: SQLite with migrations, validation, an API key, Swagger UI, tests, production settings and a 25 MB Docker image.

Changes to note when upgrading

  • Pool.queryParams / execParams (and the Tx versions) take []const kzig.db.Param; wrap raw text with kzig.db.Param.texts(arena, values).
  • kzig db generate and kzig db check need --db <name> when the app has more than one database adapter with a schema.

Install

zig fetch --save git+https://github.com/forinda/kzig#v0.2.0

Prebuilt kzig CLIs for Linux (x86_64, aarch64) and macOS (x86_64, arm64) are attached below, with SHA256SUMS.

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 27 Oct 11:10
v0.1.0
e7189b4