all templates
Blog Engines

Blog Engine — Zig · Postgres

The blog engine in Zig — std.http, pg.zig, and a hand-rolled HS256.

The most bare-metal member of the series: Zig's std.http.Server, pg.zig for Postgres, argon2 from std.crypto.pwhash, and a small self-contained HS256 JWT implementation — no framework anywhere, compiled to a fully static binary on a distroless image. The same eight endpoints as every sibling, in a codebase you can read top to bottom in one sitting.

What's inside

  • Full CRUD + publish flow for markdown posts
  • Local auth: users table, argon2, hand-rolled HS256 JWT
  • Drop-in Clerk & Auth0 JWT verifier examples
  • pg.zig — direct Postgres, no ORM
  • schema.sql applied on startup
  • compose stack — Postgres state in ./data, healthchecked

Quickstart

$ git clone https://github.com/devai-io/devai_boilerplates.git$ cd devai_boilerplates/blog-zig-postgres$ docker compose up --build   # API on http://localhost:8080

Browse the code

The full source, exactly as it ships in the repo.

loading…
Download .zip
loading tree…

about this series

Part of the devai.io blog engine series: one contract, eight backends — compare languages on identical ground.