How this site is built
kori.my is a small Rust program that serves every page from memory, with a private dashboard that publishes changes to it.
On this page
kori.my is two Rust programs built from one repository. kori-site is the public site. kori-dash is a private dashboard where the content is edited. There is no Node.js and no client-side framework. This page explains how they work, so the site can be maintained and checked.
Why a Rust server#
Two designs were compared: a Rust program that generates static files for a separate web server, and a Rust server that serves the pages itself. They cost the same per request, because in both cases a request ends in sending bytes that were prepared in advance. The server design won because it needs one runtime component instead of two, and because search can run on the server, which makes it work without JavaScript.
Where the content comes from#
The public site builds its pages from one of two sources:
- The built-in content. The Markdown docs, updates and pages in
content/, the assets inassets/and the project data insrc/data.rsare compiled into the binary. This is the seed, used when nothing has been published yet. - A published snapshot. When
KORI_PUBLISHEDpoints to a folder, the site serves the snapshot the dashboard last wrote there instead. It checks the folder every two seconds and swaps in the new version without a restart. If a new snapshot is broken, the site logs it and keeps serving the previous one.
Startup#
When kori-site starts, it:
- loads the published snapshot, or the built-in content when there is none;
- renders every page through Askama templates, which are type-checked at compile time;
- compresses each response once with gzip and computes its ETag;
- builds the search index;
- starts listening.
After that, nothing is rendered or parsed for normal page requests. Every page is served from memory.
Requests#
| Path | Handled by |
|---|---|
| Any page or asset | A lookup in an in-memory table, then the prepared bytes |
/search/?q= | Rendered per request from the in-memory index |
/healthz | A fixed ok response for the platform's health check |
| Old addresses | Permanent redirects to their new location |
| Anything else | The 404 page with a real 404 status |
Only GET and HEAD are accepted. Responses carry a strict Content Security Policy, HSTS and other security headers. Hashed CSS and JavaScript are cached for a year; pages are cached for five minutes and revalidated with ETags.
The dashboard#
kori-dash is the private editing side. It is not part of the public site and only accepts connections from allowed networks.
- Content is edited in the browser and stored in a SQLite database, together with the published revisions.
- Publish writes the snapshot into
KORI_PUBLISHED, where the public site picks it up within two seconds. - Project data from GitHub, such as the repository description, the latest release and contributors, is synced on a schedule, every 15 minutes by default. When a check finds changes, the dashboard publishes them automatically.
- It can make encrypted backups of its database on a schedule.
Markdown#
- Documentation lives in
content/docs/<section>/<page>.mdwith a short front matter block. See Write a docs page. - Updates live in
content/updates/<date>-<name>.md.
Markdown is rendered with pulldown-cmark. Raw HTML in Markdown is shown as text rather than rendered, and javascript: links are dropped, so content cannot inject markup or script.
Deployment#
The production image is built in two stages. The first compiles the binary with Cargo. The second contains only that binary on a minimal base image, runs as a non-root user with a read-only filesystem and no extra capabilities, and exposes one port. Coolify routes traffic to it and uses the binary's own --healthcheck mode, so the image needs no shell or curl.
kori-site reads these environment variables:
| Variable | Default | What it does |
|---|---|---|
PORT | 8080 | Port to listen on |
BIND | 0.0.0.0 | Address to listen on |
KORI_PUBLISHED | not set | Folder with the dashboard's published snapshot. Without it, the built-in content is served. |
To build and run the public site locally:
cargo run --release --bin kori-siteThen open http://localhost:8080. kori-site --check builds the site and exits, which CI uses as a smoke test.
Source: src/main.rs, src/publish.rs, src/bin/kori-dash.rs, src/dash/server.rs and build.rs in this repository, checked 2 November 2026.