Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Plinth

A self-hosted personal website platform built with Dioxus 0.7 — server-side rendering, WASM hydration, semantic search, and Typst blog support.

Features

  • SSR + WASM hydration — Fast initial page loads with server-side rendering, then seamless interactivity via WASM hydration powered by Dioxus 0.7.
  • Postgres + pgvector — Schema-backed relational storage with junction-table tagging and approximate vector search.
  • Semantic search — Built-in vector embeddings via fastembed with cosine similarity search — find content by meaning, not just keywords.
  • Typst & Markdown — Author blog posts in Typst or Markdown. The CLI handles frontmatter, image uploads, embeddings, and publishing.
  • Immich integration — Self-hosted image proxy backed by Immich. Upload images from the CLI, serve them through a caching proxy with aggressive cache headers.
  • Plausible analytics — Optional self-hosted Plausible integration — privacy-friendly analytics with a single config toggle. No tracking when unconfigured.
  • NixOS deployment — Declarative NixOS module with systemd hardening, reverse proxy configuration, and reproducible builds via Nix flakes.

Source code

github.com/caniko/plinth

Installation

Prerequisites

Plinth builds with Nix flakes. You need:

  • Nix (2.18+) with experimental-features = nix-command flakes
  • Or: Rust nightly, wasm32-unknown-unknown target, Dioxus CLI, tailwindcss, wasm-bindgen-cli, binaryen

The recommended approach is Nix — it handles the entire toolchain.

Clone and enter dev shell

git clone https://github.com/caniko/plinth.git
cd plinth
nix develop

This drops you into a shell with Rust nightly, Dioxus CLI, PostgreSQL 16 with pgvector, Tailwind CSS, and all native dependencies (OpenSSL, ONNX Runtime, libclang).

Build for production

nix build .#plinth

The output is in result/:

  • result/bin/plinth-server — Dioxus server binary (compatibility service name; wrapper sets DIOXUS_PUBLIC_PATH)
  • result/site/ — compiled WASM, JS, CSS, and static assets
  • result/share/plinth/plinth.toml — example configuration

Build variants

CommandProfileUse case
nix build .#plinthRelease (opt-level 3)Production deployment
nix build .#plinth-devDebugFast compile, debugging
nix build .#plinth-minimalRelease (opt-level z)Minimal binary size

Run locally

# Start the development server with hot reload
dx serve --web --fullstack

The server starts at http://127.0.0.1:3000 by default. For local database setup, run ./scripts/dev-db.sh start inside nix develop.

Quick Start

This guide walks through getting Plinth running locally and publishing your first blog post.

1. Start the server

git clone https://github.com/caniko/plinth.git
cd plinth
nix develop
./scripts/dev-db.sh start
dx serve --web --fullstack

The dev-db.sh script starts a local Postgres cluster with pgvector and creates the plinth database. The dev shell exports DATABASE_URL automatically.

Open http://127.0.0.1:3000 in your browser. You should see the default Plinth homepage.

2. Customise your site

Create or edit plinth.toml in the project root:

[site]
name = "My Site"
tagline = "Welcome to my corner of the internet"

[site.author]
name = "Your Name"
email = "you@example.com"

Restart the server to pick up changes.

3. Publish a blog post

Create a Markdown file my-first-post.md:

---
title: My First Post
tags: ["hello", "plinth"]
description: Getting started with Plinth
---

# Hello, world!

This is my first blog post on Plinth.

Publish it using the CLI:

cargo run --package plinth-cli -- publish my-first-post.md

The CLI parses frontmatter, generates a vector embedding for semantic search, and sends the article to the server API.

4. View your post

Navigate to http://127.0.0.1:3000/posts to see your published post.

Next steps

Architecture Overview

Plinth is a Rust workspace built on Dioxus 0.7.9 with fullstack SSR and WASM hydration.

Workspace layout

crates/
  shared/    plinth-shared   Domain types shared by all crates
  dioxus-ui/ plinth-web      Dioxus frontend and fullstack server entrypoint
  client/    plinth-client   Legacy Leptos frontend retained during rollback window
  server/    plinth-server   Framework-neutral Axum API, actors, and bootstrap
  cli/       plinth-cli      CLI for publishing and management

Crate responsibilities

plinth-shared

Domain types used across the stack: BlogPost, BlogListItem, PortfolioItem, SiteConfig, Tag, SiteContent, ContentFormat, PublishArticleRequest. Also contains serde_helpers for flexible database ID deserialization.

Compiled to both native (server/CLI) and wasm32-unknown-unknown (client).

plinth-web

Dioxus frontend compiled to WASM and native fullstack server. Contains:

  • Typed routes: the complete public URL contract in crates/dioxus-ui/src/lib.rs
  • Loaders: Dioxus fullstack server functions backed by the existing read model (cache actors for publish-cadence bricks; direct PostgreSQL plus a non-blocking refresh poke for activity)
  • Cache policy: explicit cached/fresh/streaming route policy and invalidation keys
  • Server entrypoint: API composition, static assets, security headers, and SSR

Feature-gated: web for browser hydration, server for native SSR, and one feature per content brick.

plinth-server

Axum backend library consumed by the Dioxus entrypoint. Contains:

  • Actors (actors/): Kameo actors for in-memory caching and vector search
  • API (api/): REST endpoints for admin, search, and image proxy
  • Services (services/): Postgres access, migrations, row decoding, markdown processing
  • Bootstrap/router: framework-neutral initialization and stable /api/* routes
  • Config (config.rs): PlinthConfig loaded from plinth.toml with env var overrides

AppState holds actor refs (CoreCache, brick-specific caches, VectorSearch), the Postgres pool, HTTP client, and config. The legacy Leptos options field is compiled only behind the rollback feature and is not present in the Dioxus production feature graph.

plinth-cli

CLI binary for content management:

  • publish — publish Markdown or Typst articles with embedding generation
  • tag — manage tags (list, add, remove)
  • content — update site content blocks

Typst support includes local image scanning, Immich upload, and typst-as-lib compilation to HTML.

SSR + WASM hydration flow

  1. Browser requests a page
  2. Axum receives the request and invokes Dioxus SSR
  3. Dioxus fullstack loaders fetch data from the cache actors, which read from Postgres on cache misses
  4. Server renders full HTML (with out-of-order streaming reserved for the home aggregate)
  5. Browser loads the WASM bundle and hydrates the page for interactivity
  6. Subsequent navigation happens client-side via Dioxus router and generated server-function endpoints

Data flow: publishing an article

  1. Author writes a .md or .typ file
  2. CLI parses frontmatter, processes content (Markdown to HTML, or Typst compilation)
  3. CLI generates a 384-dimensional fastembed vector embedding
  4. CLI sends POST /api/admin/articles with content, metadata, and embedding
  5. Server stores the article in Postgres, creates tag junction rows, syncs the read-side tag array, and invalidates caches
  6. pgvector stores the embedding and the HNSW index supports approximate similarity search

Actor System

Plinth uses Kameo actors for concurrent, in-memory operations that would be expensive to run on every request.

Content Caches

Location: crates/server/src/actors/core_cache.rs, crates/server/src/bricks/*/cache.rs

In-memory caches for blog posts, portfolio items, todos, tags, and site content. They avoid hitting Postgres on every page load.

Messages:

  • GetAllBlogPosts — returns cached Vec<BlogListItem>
  • GetBlogPost(String) — returns a full BlogPost by slug
  • GetPostsByTag(String) — returns posts filtered by tag slug
  • GetAllPortfolioItems — returns cached portfolio items
  • GetPortfolioItemBySlug(String) — returns a single portfolio item
  • GetAllTodos and GetTodosByTag(String) — return todo list items
  • GetAllTags — returns all tags with post counts
  • GetSiteContent(String) — returns site content by key
  • InvalidateCache — clears the cache, forcing a reload from DB on next access

The cache is lazily populated: the first request after invalidation triggers a DB query, and subsequent requests are served from memory.

VectorSearch

Location: crates/server/src/actors/vector_search.rs

Handles semantic search using fastembed 384-dimensional embeddings and cosine similarity.

Messages:

  • SearchSimilarArticles { query, limit } — embeds the query text and finds the most similar articles
  • FindRelatedArticles { slug, limit } — finds articles related to a given post
  • TrackOpinionEvolution { topic, min_similarity } — finds posts about a topic sorted chronologically (for tracking how opinions evolve over time)

The vector search path stores embeddings in Postgres via pgvector and uses the HNSW index for approximate nearest-neighbour lookup.

Lifecycle

Actors are spawned during server startup in main.rs and stored in AppState. They receive a clone of the Postgres pool for lazy data loading. Cache invalidation is triggered automatically after admin API operations (publish, delete, tag changes).

Rendering

Plinth builds the same Dioxus app for browser and native targets. The route source of truth is Route in crates/dioxus-ui/src/lib.rs; the table below documents the default all-bricks build.

Route Modes

RouteModeWhy
/Streaming SSR (StreamingMode::OutOfOrder)The home page is the only route allowed to introduce server futures; the shell can stream while its content resolves.
/aboutCached SSRSite content changes only when an admin publishes the about key; external page-cache invalidation is explicit.
/support, /posts, /posts/:slug, /posts/tag/:tag, /series, /series/:slug, /projects, /projects/:slugCached SSRPublish-cadence content is served through PageCache; writes invalidate affected keys/tags.
/activity, /activity/:idFresh SSRActivity is ranked and refreshed at request time.
/todos, /todos/tag/:tag, /todos/:slugFresh SSRTodo ordering and completion state are mutable.

Custom builds with one or more bricks disabled keep the static site-content routes and omit the disabled brick routes at compile time.

Decision Rule

Use external page caching for publish-cadence content: site pages, blog posts, series, and portfolio entries. Use streaming SSR only for the home aggregate. Use fresh SSR for user-curated, ranked, or externally refreshed data. Dioxus hydration is kept at the app boundary; interactive widgets use ordinary Dioxus signals and event handlers.

Islands Boundary

The SSR/hydrate build renders the same Dioxus route tree on both targets. The mobile menu is a local signal boundary, so read-only content does not need a separate framework island.

Static Regeneration

Admin publish paths send page-cache invalidation events after a successful write:

Admin writeInvalidated static routes
Blog publish, update, delete, or tag change/posts, matching /posts/:slug, matching /posts/tag/:tag, /series, and matching /series/:slug when a series is involved
Portfolio publish/projects and matching /projects/:slug
Site content publishMatching site-content route such as /about or /support

The invalidation signal is narrow: fresh activity/todo routes are never cached.

Build Targets

Build the default SSR/islands target with:

cargo build --package plinth-web --bin plinth-web --features server,brick-blog,brick-portfolio,brick-todo,brick-activity

The Nix package additionally builds the browser target, runs wasm-bindgen, and emits target/site/pkg plus Tailwind CSS. The same route table controls server rendering and the hydration boundary.

Build the client-only CSR target with:

nix build .#plinth-csr

The CSR package emits static files only. It renders routes in the browser and uses public GET /api/* endpoints instead of server-only Dioxus functions. Use it for static previews or static hosting paired with a separate Plinth API server; prefer the default SSR package when the deployment should serve rendered HTML, feeds, admin APIs, and proxied images from one process.

WASM Safety

Server-only dependencies stay behind the Dioxus server feature. The web crate is built with default-features = false, and browser builds must not pull in Axum, Tokio server actors, SQLx, forge refresh code, or other server-only runtime dependencies. Data that the browser needs comes through shared types, hydrated resources, generated fullstack endpoints, or public REST calls in the CSR build.

plinth.toml

Plinth reads configuration from plinth.toml (or the path in PLINTH_CONFIG). All fields have defaults — an empty file produces a working configuration.

[site]

KeyTypeDefaultDescription
namestring"Plinth"Site name in header and page titles
taglinestring"Welcome to my website"Short tagline on the home page
descriptionstring"A personal website"Default meta description
langstring"en"HTML lang attribute
default_themestring"dark"Default colour theme ("dark" or "light")
animated_backgroundstring"flow-field"Home page background preset

Accepted animated_background values:

  • "none" disables the animated canvas and uses a static page background.
  • "flow-field" renders an Odysseus-style procedural particle flow field.
  • "constellation" renders drifting nodes with proximity lines.
  • "aurora-ribbons" renders translucent wave ribbons.
  • "orbital-trails" renders orbiting particles with fading trails.
  • "digital-rain" renders sparse terminal-style falling glyphs.
  • "topographic-waves" renders animated contour lines.

[site.author]

KeyTypeDefaultDescription
namestring"Admin"Default author name for articles
emailstring""Email shown in footer (empty = hidden)

[site.social]

KeyTypeDefaultDescription
githubstring""GitHub profile URL (empty = hidden)
gitlabstring""GitLab profile URL
codebergstring""Codeberg profile URL
mastodonstring""Mastodon profile URL
blueskystring""Bluesky profile URL
KeyTypeDefaultDescription
project_namestring"Plinth"Project name in footer attribution
project_urlstring"https://github.com/caniko/plinth"Project URL in footer

Navigation items (order matters). Each entry has:

KeyTypeDescription
labelstringLink text
pathstringURL path

Default navigation:

[[site.nav]]
label = "Posts"
path = "/posts"

[[site.nav]]
label = "Projects"
path = "/projects"

[[site.nav]]
label = "About"
path = "/about"

[pages.home]

KeyTypeDefaultDescription
titlestring""Home page title (empty = use site name)
descriptionstring""Home page meta description

[pages.blog]

KeyTypeDefaultDescription
titlestring"Posts"Blog listing page title
subtitlestring""Subtitle below the title
descriptionstring""Meta description

[pages.portfolio]

KeyTypeDefaultDescription
titlestring"Projects"Portfolio page title
subtitlestring""Subtitle below the title
descriptionstring""Meta description

[pages.about]

KeyTypeDefaultDescription
titlestring"About Me"About page title
descriptionstring""Meta description

[server]

KeyTypeDefaultDescription
hoststring"127.0.0.1"Bind address
portu163000Bind port

[database]

KeyTypeDefaultDescription
database_urlstring"postgres://plinth:plinth@localhost:5432/plinth"Postgres connection URL

[observability]

KeyTypeDefaultDescription
service_namestring"plinth"OTLP service name
log_levelstring"info"Rust log level (RUST_LOG format)
otlp_endpointstring""OTLP endpoint URL (empty = disabled)
otlp_headersstring""OTLP auth headers (comma-separated key=value)
KeyTypeDefaultDescription
default_limitusize10Default search result count
related_limitusize5Default related articles count
min_similarityf320.5Minimum cosine similarity for opinion tracking

[content]

KeyTypeDefaultDescription
words_per_minuteusize200WPM for reading time calculation
vector_truncationusize5000Max characters before generating embeddings

[feeds]

KeyTypeDefaultDescription
blog_limitusize50Max entries in /feeds/blog.xml
projects_limitusize50Max entries in /feeds/projects.xml
activity_limitusize50Max entries in /feeds/activity.xml

[ranking]

Controls how activity entries are scored for the ranked /activity page, the home strip, and the public API. Score is computed at read time, so changes take effect on the next request.

KeyTypeDefaultDescription
strategystring"exponential""exponential", "linear", or "pure"
half_life_daysfloat365.0Exponential ranking: impact * 0.5 ^ (age_days / half_life_days)
window_daysfloat730.0Linear ranking: impact * max(0, 1 - age_days / window_days)

age uses the reference date coalesce(merged_at, closed_at, created_at). pure uses impact alone, with the most recent reference date as a tiebreaker. Results are ordered by score descending, then reference date descending.

[forge]

Controls how the server fetches and refreshes activity metadata from code forges. Tokens are provided via environment variables only, never in this file. See Environment Variables.

KeyTypeDefaultDescription
refresh_ttl_secsinteger3600Refresh an entry in the background when its fetched_at is older than this many seconds
refresh_backoff_secsinteger900Minimum seconds between refresh attempts for an entry that errored
github_base_urlstring"https://api.github.com"GitHub API base URL, overrideable for GitHub Enterprise or testing
codeberg_base_urlstring"https://codeberg.org/api/v1"Codeberg/Forgejo API base URL, overrideable for self-hosted Forgejo or testing
[ranking]
strategy = "exponential"
half_life_days = 365.0
window_days = 730.0

[forge]
refresh_ttl_secs = 3600
refresh_backoff_secs = 900
github_base_url = "https://api.github.com"
codeberg_base_url = "https://codeberg.org/api/v1"
# tokens via GITHUB_TOKEN / CODEBERG_TOKEN env vars, not here

[immich]

KeyTypeDefaultDescription
api_urlstring""Immich server URL (empty = image proxy disabled)

[images]

KeyTypeDefaultDescription
cache_max_ageu6431536000Cache-Control max-age for proxied images (seconds)

[analytics]

KeyTypeDefaultDescription
plausible_domainstring""Site domain tracked by Plausible (empty = disabled)
plausible_script_urlstring""URL to your Plausible script (e.g. https://plausible.example.com/js/script.js)

Both fields must be set for the Plausible <script> tag to be injected. This keeps analytics fully opt-in.

[donation]

KeyTypeDefaultDescription
enabledboolfalseEnable donation links across the site
cta_textstring""Custom text for end-of-article CTA (default: “If you found this useful, consider supporting my work.”)

Each entry defines a donation platform link:

KeyTypeDefaultDescription
platformstring(required)Platform identifier: "kofi", "github_sponsors", "liberapay", or "custom"
urlstring(required)URL to your profile on the platform
labelstring""Custom display label (empty = auto-generated from platform name)

When enabled, donation links appear in three places:

  • Header: A “Support” link with heart icon in the navigation bar
  • End of articles: A compact CTA after blog post content
  • Footer: A heart icon alongside social links
  • /support page: A dedicated page showing all configured platforms as cards
[donation]
enabled = true
cta_text = "If you found this useful, consider supporting my work."

[[donation.links]]
platform = "kofi"
url = "https://ko-fi.com/yourusername"

[[donation.links]]
platform = "github_sponsors"
url = "https://github.com/sponsors/yourusername"

[[donation.links]]
platform = "liberapay"
url = "https://liberapay.com/yourusername"

Full example

[site]
name = "My Site"
tagline = "Systems, science, and software"
description = "Personal website and blog"
lang = "en"
default_theme = "dark"
animated_background = "flow-field"

[site.author]
name = "Jane Doe"
email = "jane@example.com"

[site.social]
github = "https://github.com/janedoe"
mastodon = "https://fosstodon.org/@janedoe"

[site.footer]
project_name = "Plinth"
project_url = "https://github.com/caniko/plinth"

[[site.nav]]
label = "Posts"
path = "/posts"

[[site.nav]]
label = "Projects"
path = "/projects"

[[site.nav]]
label = "About"
path = "/about"

[pages.blog]
title = "Blog"
subtitle = "Notes on software and systems"

[server]
host = "127.0.0.1"
port = 3000

[database]
database_url = "postgres://plinth:plinth@localhost:5432/plinth"

[observability]
log_level = "info"

[search]
default_limit = 10

[content]
words_per_minute = 200

[feeds]
blog_limit = 50
projects_limit = 50
activity_limit = 50

[ranking]
strategy = "exponential"
half_life_days = 365.0
window_days = 730.0

[forge]
refresh_ttl_secs = 3600
refresh_backoff_secs = 900
github_base_url = "https://api.github.com"
codeberg_base_url = "https://codeberg.org/api/v1"

[analytics]
plausible_domain = "example.com"
plausible_script_url = "https://plausible.example.com/js/script.js"

[donation]
enabled = true

[[donation.links]]
platform = "kofi"
url = "https://ko-fi.com/janedoe"

[[donation.links]]
platform = "github_sponsors"
url = "https://github.com/sponsors/janedoe"

Environment Variables

Environment variables override values from plinth.toml. This is useful for secrets and deployment-specific overrides.

Configuration path

VariableDefaultDescription
PLINTH_CONFIGplinth.tomlPath to the TOML configuration file

Server

VariableDefaultDescription
PLINTH_SITE_ADDR127.0.0.1:3000Dioxus server bind address
DIOXUS_PUBLIC_PATHexecutable sibling public/Path to compiled site assets (set by Nix wrapper)
PLINTH_RENDER_CACHE_DIR(disabled)Optional writable directory for completed Dioxus HTML responses; use a state directory, never the immutable asset tree
LEPTOS_SITE_ADDR / LEPTOS_SITE_ROOTlegacyAccepted only by the rollback Leptos binary

Authentication

VariableDefaultDescription
PLINTH_API_KEYdev_api_key_change_in_productionBearer token for admin API endpoints

Database

These override the [database] section in plinth.toml:

VariableTOML keyDescription
PLINTH_DATABASE_URLdatabase.database_urlPostgres connection URL
DATABASE_URLdatabase.database_urlPostgres connection URL

Observability

These override the [observability] section:

VariableTOML keyDescription
RUST_LOGobservability.log_levelLog level filter (e.g. info,plinth=debug)
OTEL_EXPORTER_OTLP_ENDPOINTobservability.otlp_endpointOTLP endpoint URL
OTEL_EXPORTER_OTLP_HEADERSobservability.otlp_headersOTLP auth headers
OTEL_SERVICE_NAMEobservability.service_nameTelemetry service name

Immich

VariableTOML keyDescription
IMMICH_API_URLimmich.api_urlImmich server URL (enables image proxy)
IMMICH_API_KEY—Immich API key (env-only, not in TOML)

Forge tokens

Optional tokens for fetching activity from code forges. Public data works without them but is rate-limited. These tokens are read only from the environment, have no TOML equivalent in [forge], and are never sent to the browser.

VariableDescription
GITHUB_TOKENGitHub personal access token; raises the rate limit for GitHub API requests
CODEBERG_TOKENCodeberg or Forgejo access token

Activity metadata is served from the database immediately. When an entry’s fetched_at is older than forge.refresh_ttl_secs, the server starts a background refresh and continues serving the cached entry. Configure the TTL and failed-refresh backoff in the [forge] table.

Analytics

These override the [analytics] section:

VariableTOML keyDescription
PLAUSIBLE_DOMAINanalytics.plausible_domainSite domain tracked by Plausible
PLAUSIBLE_SCRIPT_URLanalytics.plausible_script_urlURL to self-hosted Plausible script

CLI-only

These are used by plinth-cli, not the server:

VariableDefaultDescription
PLINTH_API_URLhttp://localhost:3000Target server URL for CLI operations

Precedence

  1. Environment variables (highest priority)
  2. plinth.toml values
  3. Compiled defaults (lowest priority)

NixOS Module

Plinth ships a NixOS module for declarative deployment with systemd hardening.

Adding the flake

# flake.nix
{
  inputs.plinth.url = "github:caniko/plinth";

  outputs = { self, nixpkgs, plinth, ... }: {
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      modules = [
        plinth.nixosModules.default
        # Make packages available via overlay
        { nixpkgs.overlays = [ plinth.overlays.default ]; }
      ];
    };
  };
}

Minimal deployment

services.plinth.instances.default = {
  host = "127.0.0.1";
  port = 3000;
};

This starts Plinth on port 3000 with all defaults. The module also enables PostgreSQL 16, loads pgvector, creates the plinth database and plinth role, and starts the service after postgresql.service with DATABASE_URL=postgres:///plinth?host=/run/postgresql&user=plinth.

Site personalisation

services.plinth.instances.default = {
  site = {
    name = "Jane's Blog";
    tagline = "Thoughts on systems programming";
    defaultTheme = "dark";

    author = {
      name = "Jane Doe";
      email = "jane@example.com";
    };

    social = {
      github = "https://github.com/janedoe";
      mastodon = "https://fosstodon.org/@janedoe";
    };

    nav = [
      { label = "Blog"; path = "/posts"; }
      { label = "Projects"; path = "/projects"; }
      { label = "About"; path = "/about"; }
    ];
  };

  pages.blog = {
    title = "Blog";
    subtitle = "Notes on software and systems";
  };
};

Production with Caddy

services.plinth.instances.default = {
  host = "127.0.0.1";
  port = 3000;
  stateDir = "/var/lib/plinth";
  apiKeyFile = "/run/secrets/plinth-api-key";

  database = {
    name = "plinth";
    url = "postgres:///plinth?host=/run/postgresql&user=plinth";
  };
};

services.caddy = {
  enable = true;
  virtualHosts."example.com".extraConfig = ''
    reverse_proxy localhost:3000
  '';
};

networking.firewall.allowedTCPPorts = [ 80 443 ];

Observability

services.plinth.instances.default.observability = {
  enable = true;
  otlpEndpoint = "https://openobserve.example.com:5081";
  serviceName = "plinth-prod";
  logLevel = "info,plinth=debug";
};

Secrets with agenix

age.secrets.plinth-api-key = {
  file = ./secrets/plinth-api-key.age;
  owner = "plinth";
  group = "plinth";
};

services.plinth.instances.default = {
  apiKeyFile = config.age.secrets.plinth-api-key.path;
};

Secrets with sops-nix

sops.secrets."plinth/api-key".owner = "plinth";

services.plinth.instances.default = {
  apiKeyFile = config.sops.secrets."plinth/api-key".path;
};

All module options

OptionTypeDefaultDescription
instancesattrset{}Named Plinth instances to run
packagepackagepkgs.plinthPlinth package to use
userstringThe PostgreSQL database name by defaultSystem user; must match database.name for local peer authentication
groupstringThe user value by defaultSystem group
hoststring"127.0.0.1"Bind address
portport3000Bind port
stateDirpath/var/lib/plinthStateful data directory
apiKeyFilepath or nullnullPath to API key file (loaded via systemd LoadCredential)
site.*——Site identity (see plinth.toml)
pages.*——Page-specific config (see plinth.toml)
database.namestring"plinth" for default, otherwise "plinth_<name>"Postgres database name
database.urlstringpostgres:///plinth?host=/run/postgresql&user=plinth for defaultPostgres connection URL
observability.enableboolfalseEnable OTLP export
observability.otlpEndpointstring""OTLP endpoint URL
observability.otlpHeadersstring or nullnullOTLP auth headers
observability.serviceNamestring"plinth"Telemetry service name
observability.logLevelstring"info"Log level (RUST_LOG)
search.defaultLimitint10Search result limit
search.relatedLimitint5Related articles limit
search.minSimilarityfloat0.5Min similarity for opinion tracking
content.wordsPerMinuteint200Reading time WPM
content.vectorTruncationint5000Embedding char limit
immich.apiUrlstring""Immich URL (empty = disabled)
immich.apiKeystring""Immich API key
images.cacheMaxAgeint31536000Image cache max-age (seconds)
extraEnvlines""Additional env vars (KEY=value per line)

Systemd hardening

The module applies security hardening by default:

  • NoNewPrivileges, ProtectSystem=strict, ProtectHome
  • PrivateTmp, PrivateDevices, PrivateMounts
  • RestrictAddressFamilies (AF_UNIX, AF_INET, AF_INET6 only)
  • RestrictNamespaces, LockPersonality, RestrictRealtime
  • ReadWritePaths limited to stateDir

Reverse Proxy

Plinth binds to localhost by default. Use a reverse proxy to handle TLS and expose it to the internet.

Caddy automatically provisions TLS certificates via Let’s Encrypt.

services.caddy = {
  enable = true;
  virtualHosts."example.com".extraConfig = ''
    reverse_proxy localhost:3000
  '';
};

networking.firewall.allowedTCPPorts = [ 80 443 ];

Nginx

services.nginx = {
  enable = true;
  virtualHosts."example.com" = {
    forceSSL = true;
    enableACME = true;
    locations."/" = {
      proxyPass = "http://127.0.0.1:3000";
      proxyWebsockets = true;
    };
  };
};

security.acme = {
  acceptTerms = true;
  defaults.email = "admin@example.com";
};

networking.firewall.allowedTCPPorts = [ 80 443 ];

Notes

  • Plinth serves static assets (WASM, CSS, JS) directly — no separate static file hosting needed
  • The image proxy endpoint (/api/images/) streams from Immich with 1-year cache headers, so the reverse proxy benefits from caching
  • WebSocket support is not currently needed (Dioxus uses standard HTTP for SSR)

CSR Static Build

Plinth’s default deployment target is the SSR + hydrate server package. Use that for production sites that should render HTML on the server, serve feeds, proxy images, and expose the admin API from the same process.

The plinth-csr package is a client-only static build. It is useful for serverless/static-host previews or deployments where another Plinth API server is available. The bundle renders all routes in the browser and reads public content with relative GET /api/* REST calls instead of server-only Dioxus functions.

Build it with:

nix build .#plinth-csr

The result is a static directory containing index.html, pkg/plinth.js, pkg/plinth_bg.wasm, pkg/plinth.css, and copied assets from public/.

By default the CSR bundle assumes the API is available on the same origin as the static files. For a separate API origin, build with PLINTH_CSR_API_BASE set to the API origin, for example https://plinth-api.example.com. Cross-origin deployments require the API host to allow browser CORS requests.

Publishing Blog Posts

Plinth supports two authoring formats: Markdown and Typst. The CLI detects the format by file extension (.md or .typ).

Markdown workflow

Frontmatter

Use YAML frontmatter at the top of your .md file:

---
title: My Post Title
tags: ["rust", "dioxus"]
description: A brief description for search engines
author: Jane Doe
published: true
featured: false
---

# Your content here

Regular Markdown with headings, code blocks, links, and images.

All frontmatter fields are optional. If title is omitted, you must provide it via the CLI or API.

FieldTypeDefaultDescription
titlestringrequiredArticle title
tagsstring[][]Tag names
descriptionstring—Meta description
authorstringsite authorAuthor name
publishedbooltrueWhether the post is visible
featuredboolfalseWhether to feature the post

Publishing

plinth-cli publish article.md

Or during development:

cargo run --package plinth-cli -- publish article.md

The CLI:

  1. Parses YAML frontmatter
  2. Converts Markdown to HTML (pulldown-cmark)
  3. Generates a 384-dim fastembed vector embedding from the text
  4. Sends POST /api/admin/articles with content, HTML, metadata, and embedding

Typst workflow

Typst files (.typ) offer richer formatting with programmatic layout capabilities.

Frontmatter

Typst uses comment-based YAML frontmatter:

// ---
// title: My Typst Post
// tags: ["typst", "rust"]
// description: A post authored in Typst
// ---

= Introduction

This is a Typst document with rich formatting.

Image functions

The Plinth Typst template (templates/blog.typ) provides image layout functions:

#blog-image("photo.jpg", placement: "inline", caption: "A photo", alt: "Description")

Placements: inline, hero, float-left, float-right, full-width

Convenience functions:

#hero-image("banner.jpg", alt: "Banner image")
#gallery((src: "a.jpg", alt: "First"), (src: "b.jpg", alt: "Second"))

Publishing with images

When your .typ file references local images, the CLI handles upload:

plinth-cli publish post.typ --immich-url https://immich.example.com --immich-api-key KEY

The CLI:

  1. Extracts comment-based YAML frontmatter
  2. Scans for local image references (#blog-image("local.jpg", ...))
  3. Uploads local images to Immich, receives asset IDs
  4. Replaces local paths with /api/images/{asset_id} proxy URLs
  5. Compiles Typst to HTML via typst-as-lib + typst-html
  6. Generates a fastembed embedding from the text content
  7. Sends pre-rendered HTML + metadata to the server API

Managing tags

# List all tags
plinth-cli tag list

# Add a tag to a post
plinth-cli tag add --post my-post-slug --tag "new-tag"

# Remove a tag from a post
plinth-cli tag remove --post my-post-slug --tag "old-tag"

Managing site content

Update content blocks (e.g. the about page) via the CLI:

plinth-cli content update --key about --file about.md

Project Sites

plinth-project builds static project landing sites from a plinth-project.toml file. Each [[pages]] page renders to {slug}/index.html (index.html for the home page), plus style.css and any [[assets]].

plinth-project render --config website/plinth-project.toml --out public

Site metadata

FieldTypeDefaultDescription
titlestringrequiredSite title, shown in the nav bar and tab
descriptionstringrequiredFallback <meta name="description">
base_urlstring"/"Base URL used for absolute links
canonical_domainstring—Canonical domain (e.g. "example.com"). Used for absolute sitemap URLs and the GitHub Pages CNAME file
stylesheetsstring array[]Extra stylesheet URLs, linked after the built-in /style.css so site CSS wins the cascade
faviconstring—Favicon URL (<link rel="icon">); type="image/svg+xml" is added for .svg paths
og_imagestring—Social preview image. Also emits Open Graph (og:title, og:description, og:type, og:image, and og:url with canonical_domain) and twitter:card meta. A path becomes an absolute https://<canonical_domain> URL when canonical_domain is set
footer_notestring""Text displayed in the site footer
primary_personstring—ID of a [[people]] entry shown as the site author

Machine-readable output

Every build also emits companions for search engines and LLM traversal:

FileContents
sitemap.xmlOne <loc> per page; absolute when canonical_domain (or an absolute base_url) is set, path-only otherwise
robots.txtAllow: /, plus a Sitemap: line when the origin is known
llms.txtSite title/description, every page (title, URL, description), and every [[projects]] entry with its source/demo/links
projects.jsonThe [[projects]] table verbatim as JSON
CNAMEThe canonical domain, only when canonical_domain is set

Set canonical_domain for any site published to GitHub Pages: the CNAME file flows through the Pages artifact automatically, so the custom domain survives redeploys with no workflow changes.

Blog posts

Add a [blog] table to publish Markdown posts from a directory beside the config file:

[blog]
title = "Notes"      # optional, defaults to "Blog"
posts_dir = "posts"  # optional, relative to plinth-project.toml

Posts are <posts_dir>/<slug>.md, where the file stem is the URL slug (^[a-z0-9]+(-[a-z0-9]+)*$) and the file starts with YAML frontmatter:

---
title: "My post"           # required
description: "One-liner"
date: "2026-11-10"          # required, YYYY-MM-DD
tags: ["rust", "release"]
author: "Name"
published: true             # false keeps the post out of every output
---
Markdown body…

title and date are required; description and tags default to empty, and author is optional. A build writes blog/index.html (newest first), blog/<slug>/index.html inside the site chrome, and blog/feed.xml when canonical_domain is set. Blog pages join sitemap.xml and llms.txt, and a navigation link labelled with the blog title appears once a published post exists. Invalid frontmatter, a missing title/date, an invalid date or slug, an unreadable posts directory, or a page slug under blog/ all fail check and build; unpublished posts are validated too. Raw HTML in a post passes through unchanged: posts are trusted input from the site owner. Sites without [blog] render exactly as before.

mkProjectSite stages only the config and staticPaths, so a Nix build passes the posts directory next to the config:

plinth.lib.${system}.mkProjectSite {
  pname = "example-site";
  domain = "example.com";
  configPath = ./website/plinth-project.toml;
  staticPaths = [
    {
      source = ./website/posts;
      target = "website/posts";
    }
  ];
}

Guided landing composition

Set scalable_text = true on a [[pages]] entry to honor browser default font sizes on that project page (html uses 100%). Split-hero headings use REM-only sizes: 3rem desktop, 1.875rem through 700px, 1.5rem through 360px. Hero actions use .75rem horizontal padding; mobile navigation can wrap and task-card content stacks to leave room for enlarged text. Anywhere wrapping remains a fallback for unbreakable content. Links reserve 1rem scroll margin for keyboard focus. Check your actual copy at enlarged text sizes; this is not a universal word-fit guarantee.

The boolean defaults to false. Unconfigured pages keep their existing HTML; sites without enabled pages keep their exact stylesheet. In mixed project sites, added rules only match enabled pages. Company rendering ignores this project-page option, including its root font policy and stylesheet.

The renderer uses tartan-ui-assets for responsive grids, surfaces, wrapping actions, control sizing, and focus treatment. [theme] maps Plinth colors onto the shared semantic variables. Interactive Plinth pages consume the same pinned tartan-ui revision through tartan-ui-dioxus.

A hero with preview_src uses a split desktop composition and stacks on narrow screens. preview_mobile_src optionally supplies a narrow-screen illustration through <picture>. preview_still adds a still image served under prefers-reduced-motion (only meaningful with preview_src). preview_alt describes the illustration; eyebrow and note provide supporting copy. Existing heroes without previews stay centered.

[theme]
preset = "gruvbox-hard-dark"
font_family = "Atkinson Hyperlegible Next"
font_url = "/assets/readable.woff2"

[[nav]]
label = "Enter workspace"
href = "/app"
primary = true

[[pages]]
slug = "index"
title = "Research library"

[[pages.sections]]
type = "hero"
eyebrow = "RESEARCH"
title = "Find references you can use"
tagline = "Search, compare, and keep source context attached."
subtitle = ""
preview_src = "/assets/preview.png"
preview_mobile_src = "/assets/preview-mobile.png"
preview_alt = "Illustrative search result with source context"

[[pages.sections]]
type = "feature_grid"
eyebrow = "START WITH A QUESTION"
heading = "What do you need to do?"
intro = "Choose a workbench."

[[pages.sections.features]]
title = "Find a reference"
description = "Search the authorized library."
action = { label = "Open search", href = "/search", primary = true }

Feature-grid headings are optional. With a section heading, card headings use h3; otherwise they use h2. Workflow and trust sections also accept eyebrow. On narrow guided landings, task-entry cards become compact linked rows while retaining the action’s accessible name. Navigation links marked primary remain visible alongside the brand.

Font URLs refer to variable WOFF2 files (weights 100–900). Package fonts, illustrations, and their licenses with [[assets]]; configure the host to serve their output paths. Route destinations and domain copy belong to the consuming project. The editable reference is design/project-landing.fig; its extraction provenance is in design/migration.json.

Install routes

An install section ([[pages.sections]] with type = "install") requires guide_href. Set guide_label to override “Open full install guide.”

In [[pages.sections.primary_routes]] or [[pages.sections.secondary_routes]], set note to add a short paragraph below the route title and link_label to override “Open guide” (for example, with “Download”). Both keys are optional. Blank values for note, link_label, and guide_label are treated as omitted. A recommended primary route shows its “Recommended” badge even without a note.

Broker theme, theme toggle and minimal look

[theme] broker_css points (relative to the config file) at a nix-theme-broker web stylesheet, the theme.css of packages.<system>.web-theme-blackbox. It emits --tb-<group>-<role> custom properties: light on :root, dark through @media (prefers-color-scheme: dark) (skipped when data-theme="light") and [data-theme=dark|light].

[theme]
broker_css = "broker-theme.css"
# Optional: used as the fallback if the broker stylesheet is missing a role.
accent = "#076678"

When broker_css is set the generator:

  • copies the file to /broker-theme.css and links it before /style.css;
  • aliases the palette to the broker: --pp-paper to --tb-ui-background, --pp-surface to --tb-ui-surface, --pp-ink / --pp-ink-soft to --tb-ui-foreground / --tb-ui-foreground-muted, --pp-line to --tb-ui-border, --pp-accent to --tb-ui-accent, --pp-secondary to --tb-status-success, --pp-warning / --pp-rust to --tb-status-warning / --tb-status-error, and derives --pp-accent-soft from the accent. The colours (or preset) configured in [theme] stay as var() fallbacks;
  • adds a system / light / dark toggle to the nav and applies the minimal look below (<body class="pp-minimal">).

Sites without broker_css render exactly as before: no extra file, link, script, class or rule changes.

The toggle is a segmented control of three icon buttons (system, light, dark; inline Lucide SVGs, ISC licence) in a role="group" labelled “Theme”, each with an aria-label and aria-pressed for the active mode. It sets data-theme on <html> (system removes it) and stores the choice in localStorage under tartan-theme, the key tartan-ui uses. A three-line head script restores a stored light/dark choice before first paint. It is the only JavaScript the theme adds, has no dependencies, and the control stays hidden without JavaScript.

The minimal look uses 1px borders, one 6px radius, no shadows or gradients, a 4px spacing scale, and the accent only for primary actions (btn-primary, the primary nav link) and text selection. It also introduces a display type size, used only by the hero H1: 40px, or 32px at 480px and narrower.

Layout under the minimal look, all inside the minimal cascade layer:

  • the brand is plain lowercase text without the dot;
  • nav, footer and every section share one container (--pc-width, 1200px) and sections are separated by full-width 1px rules; site CSS that sets its own max-width/padding on a section overrides this (unlayered rules win);
  • the split hero is about 45% text and 55% media, the media capped at min(60vh, 33rem) with object-fit: contain, the note under the media; it stacks at 700px and narrower;
  • screenshot_grid items are a bare image plus caption in three columns, one column at 480px and narrower;
  • workflow_steps are columns with a 1px top rule and a zero-padded index (01, 02, …) above the title, stacked at 700px and narrower.

With Nix, pass the broker stylesheet to project-site.nix; it is copied to website/broker-theme.css next to the config, and the build fails when the config does not set broker_css = "broker-theme.css":

plinth.lib.${system}.mkProjectSite {
  pname = "example-site";
  domain = "example.com";
  brokerCss = nix-theme-broker.packages.${system}.web-theme-blackbox;
}

brokerCss accepts a CSS file or a directory containing theme.css, and is also read from project definitions (mkProjectDefinition { brokerCss = ...; }), where the site-check and visual-audit targets then expect /broker-theme.css.

Scroll sequence

screenshot_grid and workflow_steps sections accept scroll_sequence = true (default false). The section gets a data-scroll-sequence attribute and each item (.screenshot-slot, .workflow-step) fades in (opacity 0 to 1) and slides up (16px to 0) as it enters the viewport; scrolling back reverses it.

[[pages.sections]]
type = "workflow_steps"
heading = "How it works"
intro = ""
scroll_sequence = true

It is pure CSS, with no JavaScript: @supports (animation-timeline: view()) applies animation-timeline: view() with animation-range: entry 0% cover 40% and animation-fill-mode: both. Browsers without scroll-driven animations, and visitors with prefers-reduced-motion: reduce, get the static layout.

plinth-project audit site appends a rule to the audit copy of style.css that pins the static layout, because full-page captures sit at scroll 0 and would otherwise show below-the-fold items mid-fade. The shared visual-rubric capture can emulate prefers-color-scheme (light / dark) but not prefers-reduced-motion, so the reduced-motion layout is verified through this pinned static capture rather than a separate media-emulated one.

Company Sites

plinth-company turns a TOML file into a modular company website: static HTML, local fonts, CSS, a small progressive-enhancement script, and declared assets. It uses the same renderer, development server, diagnostics, and publishing workflow as plinth-project.

Start a company site

plinth-company init --title "Your Company" --description "What you do, and why."
plinth-company check
plinth-company dev
plinth-company build
plinth-company preview
plinth-company publish --out dist/company

The command finds website/plinth-company.toml, then plinth-company.toml in the current directory. Use --config path/to/site.toml to choose another file. init refuses to overwrite an existing configuration unless given --force. dev watches configuration and declared assets and reloads the browser. publish produces a local bundle and plinth-company-manifest.json. Build, development, publish, and audit output cleanup rejects directories that contain the configuration or declared source inputs, including symlink aliases. Keep generated output in a subdirectory such as website/public or dist/company.

Install from this repository with nix build .#plinth-company, or cargo install --path crates/project --bin plinth-company. A small build needs brick-company,brick-hero; additional existing project bricks can be enabled individually. The Nix package includes feature grids, workflow steps, trust panels, prose content, and screenshot galleries as well as the company sections.

Composition and identity

The [site], [theme], [[nav]], [[footer_links]], [[assets]], and [[pages]] tables follow Project Sites. Sections render in configuration order; pages can contain any combination of enabled bricks. Each company section has a unique id, a heading, and an optional eyebrow. IDs share a page-wide namespace with existing project bricks and generated member cards (<team-id>-member-<member-id>). main-content and company-navigation are reserved. Raw prose HTML and custom-rendered markup must also use distinct IDs. Without an eyebrow, desktop headings keep their editorial column; on mobile, headings and content use the full available width. An empty team, quote, partnership, metrics, or case-study section is omitted. Navigation and hero links to empty company sections are omitted too.

[company] selects the editorial company presentation. It provides an optional legal_name, location, logo_src, favicon_src, and social_image (defaulting to [site] favicon and og_image), plus language (default en). The site title is the visible organization name. Company copy is plain text; \n in headings creates deliberate line breaks. Use the existing content brick for rich prose.

The default palette is warm paper, charcoal ink, and muted green. Override the existing theme colors or choose a theme preset. Inter is bundled locally with its SIL Open Font License. To use another font, provide both font_family and font_url in [theme] and declare any local font file in [[assets]].

[site]
title = "Your Company"
description = "Good work, with good people."
canonical_domain = "company.example"

[company]
legal_name = "Your Company Ltd"
location = "Your city · Working everywhere"
language = "en"

[company.motion]
motif = "contour"
duration_secs = 32
intensity = 0.3
enabled = true

Serve the generated directory at the site’s origin root. Navigation, font, script, and stylesheet URLs are root-relative. For multi-page sites, use /#mission to link to a home-page section from any page, or /people/ for a separate team page. Set canonical_domain for canonical links, Organization JSON-LD, social metadata, sitemap URLs, and the Pages CNAME file.

Sections

TypeContent
heroExisting hero fields: title, tagline, eyebrow, note, and CTAs; company presentation adds ambient artwork and location
missionRequired statement; optional vision and values with title/description
teamOrdered member IDs, optional intro; layout = "full" or "compact", and compact sections accept size = "small" (default), "medium", or "large"; optional link with label and href; an omitted/empty list selects all members
testimonialsquotes with quote/name and optional role, organization, source
partnershipspartners with name, relationship, optional logo_src, description, href
metricsitems with value, label, and required context
case_studiesstudies with title, client, problem, approach, outcome; optional image_src/href
contactHeading, optional intro, and a required label/href

Members live in a top-level list and can appear on more than one page. Portraits and personal URLs are optional; initials provide a deliberate fallback.

[[members]]
id = "maya"
name = "Maya Holm"
role = "Strategy & design"
bio = "Connects business intent to the experience people have."
# portrait_src = "/assets/maya.webp"
[[members.links]]
label = "Say hello"
href = "mailto:maya@example.com"

[[pages]]
slug = "index"
title = "Your Company"
[[pages.sections]]
type = "mission"
id = "mission"
heading = "Good work,\nwith good people."
statement = "We turn complex ideas into useful experiences."
[[pages.sections.values]]
title = "Built together"
description = "Honest conversations and shared ownership."
[[pages.sections]]
type = "team"
id = "team"
heading = "The people behind the work."
members = ["maya"]
[[pages.sections]]
type = "testimonials"
id = "testimonials"
heading = "In good company."
[[pages.sections.quotes]]
quote = "An example quote. Replace it with a real, attributed testimonial."
name = "Example client"
organization = "Example organization"
[[pages.sections]]
type = "partnerships"
id = "partners"
heading = "Better, together."
[[pages.sections.partners]]
name = "Example partner"
relationship = "partner"
description = "Explain this relationship."
[[pages.sections]]
type = "contact"
id = "contact"
heading = "Let’s talk."
label = "Get in touch ↗"
href = "mailto:hello@example.com"

Relationship values are partner, customer, investor, and affiliation. They remain visibly distinct. Testimonials are semantic quotes with attribution; optional source links lead to their original context. Metrics require context so their values have a clear meaning.

Team on the landing page, a team page, or both

Without layout, a team section renders the full cards: portraits or initials, name, role, biography, and member links. layout = "compact" keeps portraits or initials, name, and role, and omits biographies and member links. Compact sections also accept size = "small" | "medium" | "large" (default small). small is the shortest strip, with round avatars beside the name and role; medium uses small square tiles; large uses large square tiles. size applies only to compact layouts and is rejected on a full team. Either layout can carry a link to a dedicated team page.

# Compact strip on the landing page, full cards on /people/.
[[pages.sections]]
type = "team"
id = "team"
eyebrow = "THE PEOPLE BEHIND THE WORK"
heading = "Different perspectives.\nA shared direction."
members = ["maya"]
layout = "compact"
size = "small"
[pages.sections.link]
label = "Meet the whole team →"
href = "/people/"

[[pages]]
slug = "people"
title = "Our people"
[[pages.sections]]
type = "team"
id = "people"
heading = "The people behind the work."
members = ["maya"]

Use only the first section, without its [pages.sections.link], for a landing-only team, or only the second for a team page. Use layout = "full" (or omit it) when the landing page should show the complete cards. A page without a team section has no team content.

For an offering section, reuse feature_grid; for a working process, reuse workflow_steps. Case studies connect the challenge, approach, and result. Culture, history, careers, and FAQs can use the content brick. Company heroes use ambient artwork. Project-hero preview images, per-hero logos, and person bylines produce an explicit company.hero.unsupported diagnostic; use the company logo, team, gallery, or content sections for that material.

Motion

Choose one site-wide motif: contour (nested breathing contours), orbit (slowly revolving ellipses), or ribbon (flowing parallel curves). duration_secs accepts 8–120 seconds; intensity controls opacity, from 0 to 0.6. enabled = false preserves the static artwork and removes its control.

Motion uses CSS transforms on decorative SVG layers. Content never moves. The script provides pause/resume, responds to reduced-motion preferences, and suspends animation while the document is hidden. Without JavaScript the artwork remains static and navigation stays available. On mobile the menu has an expanded state, keyboard focus, and Escape-to-close behavior.

Fixtures and verification

website/company-examples/north.toml is a synthetic two-person consultancy. vector.toml is a dark product company with a separate people page, metrics, and case studies. ribbon.toml is a minimal third-motion reference. mixed.toml combines company modules with prose, feature cards, and a gallery, plus local portrait/logo assets and a custom-font declaration. Their people, quotations, relationships, and figures are illustrative.

plinth-company dev --config website/company-examples/north.toml
cargo test --locked -p plinth-project
cd e2e
npm ci
npm run test:company # includes a headed visibility check; needs a display

The browser suite verifies responsive geometry, accessibility, navigation, asset readiness, gallery keyboard interaction, pause/resume, reduced motion, disabled motion, real background-tab suspension, and all motion variants, and writes settled captures under target/company-evidence/local/. Set CHROMIUM_PATH to an installed Chromium executable, or use Playwright’s installed browser. For the complete CI environment, run nix develop .#company-tests -c bash scripts/test-company.sh. This uses Xvfb for the headed check when available. Simit’s company-browser gate runs the same script in GitHub Actions. The visibility test uses an isolated raw CDP context because Playwright’s ordinary page attachments emulate focus. plinth-company audit site also shares the project-site visual-rubric workflow.

Build and audit destinations are checked before cleanup or writes. Configs, assets, and the symlink entries needed to reach them are protected. Audit render and capture trees must be separate; report files must not overwrite authoring inputs, rendered files, capture images, or other reports. The default report inside the screenshot directory remains supported. Shared capture checks its job, manifest, report, capture tree, and optional cache before rendering.

The GitHub browser gate retains target/company-evidence/ and e2e/test-results/ as company-browser-evidence for 14 days, including failed runs. Playwright keeps screenshots and traces for failures. The gate is declared in simit.toml; regenerate and check the workflows with:

simit init ci --platform github --ci-provider actions --runtime nix
simit init ci --check

The editable reference is design/company-site.fig; design/README.md records its artboards and local parity evidence. Company presentation is opt-in within the shared plinth-project library: one engine owns serving, output, and CLI behavior, while brick-company owns company contracts and presentation.

Nix site output

The shared packaging helper exposes mkCompanySite alongside mkProjectSite. It accepts the same domain, static asset, documentation, and footer parameters. checks.<system>.plinth-company-site builds an asset-bearing example through this helper and checks its packaged executable, HTML, fonts, images, and domain.

let
  companySites = import "${plinth}/nix/project-site.nix" {
    inherit pkgs;
    inherit (pkgs) lib;
    plinthCompany = plinth.packages.${pkgs.system}.plinth-company;
  };
in companySites.mkCompanySite {
  pname = "company-site";
  domain = "company.example";
  configPath = ./website/plinth-company.toml;
}

Progress Pages

plinth-progress turns a small progress.toml in your repository into one self-contained index.html: a status page for collaborators that shows the current release in full and earlier releases as collapsed history. A bump guard makes sure the page is updated every time the project’s version changes.

The source format, validation rules and diagnostics are documented in crates/progress/README.md, with a complete example in crates/progress/examples/progress.toml and a JSON Schema in crates/progress/progress.schema.json. Start your file with #:schema <path-to>/progress.schema.json to get completion and inline errors in editors that support it.

Commands

CommandDoes
plinth-progress check --version <V> <SOURCE>Validates the whole file, then fails unless it has an entry for exactly <V>. Silent on success.
plinth-progress build <SOURCE> --out <FILE> [--config <FILE>]Validates, then writes the page. Never touches --out on failure.
plinth-progress draft --version <V> [--since <REF>] [--date <YYYY-MM-DD>] <SOURCE>Prints an entry skeleton for <V> with the commits since the last tag. Never edits files.

Exit codes: 0 success, 1 validation, guard or I/O failure, 2 usage error. Errors read error: <file>:<line>:<column>: <field-path>: <message>.

The page

The page is a single file with inline CSS. It has no scripts, stylesheet links, images or fonts to fetch, carries noindex,nofollow, and sets a Content-Security-Policy meta tag of default-src 'none'; style-src 'unsafe-inline'. Text fields accept plain text with `code` spans and [label](https://...) links (http, https, / and # only); everything else is escaped.

--config points at your existing plinth-project.toml. Only its [theme] table is read, so the page matches your project site. Two theme settings are treated differently:

  • font_url is dropped with a warning, because the page fetches nothing; font_family stays and falls back to system fonts.
  • broker_css is refused. Set explicit [theme] colours instead.

Colour values must be plain CSS colours (#hex, names, rgb(), hsl(), oklch(), color-mix() and similar). Anything else fails the build.

The page is not access control. If it is private, serve it behind your own authentication and keep it out of public static assets.

Nix

progressPage = plinth.lib.${system}.mkProgressPage {
  src = ./progress.toml;                    # required
  config = ./website/plinth-project.toml;   # optional, [theme] only
  version = cargoToml.workspace.package.version;  # optional bump guard
  pname = "my-project-progress";            # optional
};
# => $out/index.html

With version set, the derivation runs plinth-progress check first, so a version bump without a matching entry fails the build. The CLI is also available as plinth.packages.${system}.plinth-progress.

Wiring the bump guard

The guard only helps if it runs where versions change. Call it from both your bump command and your qualification (CI) path, reading the version from the file that owns it:

version=$(cargo metadata --no-deps --format-version 1 \
  | jq -r '.packages[] | select(.name == "my-crate") | .version')
plinth-progress check --version "$version" progress.toml

Passing version to mkProgressPage covers the Nix build path with no extra step.

Updating on every bump (LLM workflow)

Give an agent this prompt when the version changes. It works for a human too.

The project version is now <NEW_VERSION>. Update progress.toml so it has a
complete, truthful entry for it.

1. Run: plinth-progress draft --version <NEW_VERSION> progress.toml
   It prints a skeleton plus the commits since the last tag. If it warns that
   no tag was found, or the listed range looks wrong, rerun with
   --since <previous release tag> and say which ref you used.
2. Paste the skeleton at the top of the [[entries]] list, above the previous
   release. Do not edit or reorder older entries.
3. Fill every field from the listed commits, the CHANGELOG section for
   <NEW_VERSION> and the previous entry's `next` and `risks`:
   - summary: one or two sentences on what this release means for readers.
   - done: shipped items, one per line, user-facing wording.
   - next / risks: carry forward what is still open; drop what is resolved.
   - milestones: update statuses (done, in_progress, blocked, planned,
     dropped); add a label only when it adds a date or a reason.
   - sections: only for content that does not fit the lists.
   Use only facts you can point to in the commits, changelog or previous entry.
   If something is unclear, leave it out and ask; never invent dates, numbers
   or outcomes.
4. Run: plinth-progress check --version <NEW_VERSION> progress.toml
   Fix every reported error (file:line:column: field path) and rerun until it
   passes silently.
5. Run the project's page build (mkProgressPage or plinth-progress build) and
   confirm it succeeds.
6. Delete the draft's `#` comment lines before committing.

Checklist for reviewing the result:

  • The new entry is first and its version equals the bumped version.
  • summary is filled; no field still holds draft placeholder comments.
  • Every done item traces to a commit or changelog line.
  • Open items from the previous entry are carried forward or explicitly closed.
  • plinth-progress check --version <V> progress.toml passes.
  • The page builds, and nothing private landed in a public asset.

Fleetix Hub Module

plinth-desktop is a Dioxus 0.8 component library that hosts embed as a workspace for writing and publishing posts to Plinth sites. It renders only the workspace body: the host keeps its sidebar, topbar and status bar, passes the site list, and appends the module stylesheet.

The crate lives in crates/desktop/ as its own Cargo workspace because the rest of Plinth is pinned to Dioxus 0.7.10 and the root Cargo.lock is a Nix contract input. The module has no renderer feature; its desktop feature exists only for the preview example, which enables dioxus/desktop.

sites.toml

[[site]]
id = "personal"
name = "tartanoglu.com"
kind = "personal"
api_url = "https://example.com"
api_key_file = "/run/agenix/plinth-api-key"
public_url = "https://tartanoglu.com"

[[site]]
id = "pink-raven"
name = "Pink Raven"
kind = "project"
root = "/path/to/repo/website"
base_url = "https://pinkraven.example"
  • personal: posts go through the Plinth admin API. api_key_file is read at load time; the key never appears in the file or in Debug output.
  • project: posts are Markdown files under <root>/<posts_dir>/ ([blog] posts_dir, default posts). root must contain plinth-project.toml.
  • public_url (personal) and base_url (project) are optional: the address readers use. Post links, the slug hint and receipts are built from it; a personal site without public_url falls back to api_url.

load_sites returns Result<Vec<Site>, ConfigError>.

Post files

Project posts use the fixed contract the plinth-project blog brick reads:

---
title: "My post"
description: "One-line summary"
date: "2026-11-10"
tags: ["rust", "release"]
published: true
---
<body>

Strings are emitted as JSON-escaped double-quoted YAML scalars, tags as a flow sequence, and date as local-today YYYY-MM-DD. Publishing writes <root>/<posts_dir>/<slug>.md atomically and refuses to overwrite an existing file (SlugTaken). posts_dir comes from the [blog] table in plinth-project.toml (default posts); without that table the static build renders no posts, so the module refuses to publish and says so.

Hub integration

# Cargo.toml — the Dioxus pin must match the host's `=0.8.0-alpha.3`.
plinth-desktop = { git = "https://github.com/caniko/plinth.git", rev = "<commit>", default-features = false }
#![allow(unused)]
fn main() {
use plinth_desktop::{
    BlogWorkspace, STYLE, WORKSPACE_HINT, WORKSPACE_ICON_SVG, WORKSPACE_LABEL, load_sites,
};

// Load once at startup; keep the key files readable for the hub user.
let sites = load_sites(std::path::Path::new("/etc/fleetix/sites.toml"))
    .unwrap_or_default();

enum Workspace {
    // …
    Sites,
}

impl Workspace {
    fn label(self) -> &'static str {
        match self {
            Workspace::Sites => WORKSPACE_LABEL,
            // …
        }
    }

    fn hint(self) -> &'static str {
        match self {
            Workspace::Sites => WORKSPACE_HINT,
            // …
        }
    }
}

// Point the nav at the module icon.
let icon = match workspace {
    Workspace::Sites => WORKSPACE_ICON_SVG,
    // …
};

// Dispatch renders the module in the host's main stage.
Workspace::Sites => rsx! {
    BlogWorkspace {
        sites: sites.clone(),
        drafts_dir: Some(drafts_dir.clone()),
    }
},
}

Append the stylesheet once, after the hub theme:

#![allow(unused)]
fn main() {
let css = format!("{}\n{STYLE}", include_str!("theme.css"));
rsx! { style { dangerous_inner_html: css } }
}

The module’s CSS uses the hub tokens when present and falls back to the same palette. Layout is chosen with container queries, so the host’s sidebar and inspector widths are honoured.

When drafts_dir is set, the in-progress draft is autosaved per site to <drafts_dir>/<site id>.json about a second after each edit, restored when the site is selected, and deleted after a successful publish.

Drafts already saved on a site are listed with its posts. Markdown drafts have an Open action that loads them into the editor, keeping the editor’s previous content one Undo away; sending an opened draft replaces it, so it can be edited, renamed or published. Replacing only works while the site still holds exactly the draft that was opened (the server’s draft id, or the file’s text on a project site); otherwise nothing is written and the draft must be opened again. A plain new post never overwrites anything: a taken slug, draft or not, is refused. Typst drafts are listed but edited with plinth-cli. On a project site the draft is the published: false file; it is moved aside, checked, and only then replaced, so a post published meanwhile is never touched.

Personal API traffic

  • GET {api_url}/api/posts — existing posts (published).
  • GET {api_url}/api/admin/drafts — unpublished posts with their source (id, slug, title, description, tags, content, content_format, published_at). Servers without this route (404/405) are treated as having no drafts.
  • POST {api_url}/api/admin/articles — PublishArticleRequest with content_format = "markdown", creating a post. The receipt URL is {api_url}/posts/{slug}.
  • PUT {api_url}/api/admin/drafts/{id} — the same body, replacing that draft in one transaction. Every replace gives the draft a new id, so a stale copy gets 410 Gone, which the module reports as DraftChanged (“Keep as a new post” then moves the text to a free slug). A 404 stays a rejection. Author, featured and series fields the module does not send keep the draft’s values. Declarative (Nix content) drafts are not listed and cannot be replaced.

Admin calls send Authorization: Bearer <key>. 401/403 map to Unauthorized, connection and timeout failures to Unreachable, 409 Conflict (the slug already exists) to SlugTaken, and other non-2xx responses to Rejected.

Preview

cd crates/desktop
cargo run --features desktop --example preview
PREVIEW_SIZE=760x900 PREVIEW_FIXTURE=offline cargo run --features desktop --example preview

The example starts an in-process mock of the personal API and a throwaway project site, then renders the module inside a minimal stand-in hub shell. PREVIEW_FIXTURE accepts empty (no sites), offline (personal site on a closed port), badkey (key rejected), readonly (project posts/ not writable), fresh (project site without posts) and dense (seven sites, 43 posts). PREVIEW_SIZE takes WIDTHxHEIGHT (default 1440x900), PREVIEW_DELAY_MS holds each publish, PREVIEW_API_LATE_MS starts the mock API late, and PREVIEW_DRAFTS_DIR keeps drafts across launches.

The preview needs WebKitGTK/GTK, which the library targets do not. Build or run it inside the hub devshell:

cd /path/to/infernix-hub
nix develop -c cargo run \
  --manifest-path /path/to/plinth/crates/desktop/Cargo.toml \
  --features desktop --example preview

Image Handling

Plinth integrates with Immich for self-hosted image management. Images are stored in Immich and served to readers through Plinth’s image proxy.

Architecture

Author                  Plinth CLI              Immich            Plinth Server          Browser
  |                        |                      |                    |                    |
  |-- publish post.typ --> |                      |                    |                    |
  |                        |-- upload images ---> |                    |                    |
  |                        |<-- asset IDs ------- |                    |                    |
  |                        |-- POST article ----->|                    |                    |
  |                        |   (with /api/images/{id} URLs)           |                    |
  |                        |                      |                    |                    |
  |                        |                      |     GET /api/images/{id} <------------- |
  |                        |                      |<---- fetch with API key --------------- |
  |                        |                      |---- stream bytes ---------------------->|

Immich is never exposed publicly. Plinth authenticates with Immich using an API key and streams the image bytes to the browser with aggressive caching.

Server configuration

Enable the image proxy by setting the Immich URL and API key:

# plinth.toml
[immich]
api_url = "http://immich:2283"

[images]
cache_max_age = 31536000  # 1 year in seconds

The API key is set via environment variable (not in TOML, for security):

export IMMICH_API_KEY="your-immich-api-key"

Or in NixOS:

services.plinth.immich = {
  apiUrl = "http://immich:2283";
  apiKey = "your-key";  # or use secrets management
};

Image proxy endpoint

GET /api/images/{asset_id}?size=original|preview|thumbnail
ParameterDefaultDescription
asset_idrequiredImmich asset UUID
sizeoriginalImage variant: original, preview, or thumbnail

Response headers include Cache-Control: public, max-age=31536000, immutable for browser and CDN caching.

The asset_id is validated as a UUID to prevent path traversal.

CLI image upload

When publishing Typst posts with local image references:

plinth-cli publish post.typ \
  --immich-url https://immich.example.com \
  --immich-api-key YOUR_KEY

The CLI scans for #blog-image("local-file.jpg", ...) references, uploads each file to Immich, and replaces the local path with /api/images/{asset_id} in the compiled HTML.

Environment variables IMMICH_API_URL and IMMICH_API_KEY can be used instead of flags.

Curating External Activity

The activity feature showcases pull requests and issues you have landed on other people’s repositories across GitHub and Codeberg, ranked by impact and recency. It is distinct from the portfolio, which is for your own projects.

Each entry is fetched from the forge once, at add time, by the CLI. The CLI also computes the search embedding locally; the server never runs fastembed for activity publishing. The server keeps forge metadata fresh in the background according to the [forge] settings in plinth.toml.

Adding a contribution

plinth activity add \
  --forge github \
  --repo owner/name \
  --pr 1234 \
  --impact 7 \
  --featured

For an issue, use --issue <n> instead of --pr <n>.

FlagRequiredDescription
--forgeyesgithub or codeberg
--repoyesRepository in owner/name form
--pr <n>one ofPull-request number
--issue <n>one ofIssue number, mutually exclusive with --pr
--impact <1-10>yesCurated impact score
--featurednoShow in the home-page strip

On add, the CLI fetches the PR or issue metadata from the forge, embeds the title and body with fastembed (AllMiniLML6V2, 384 dimensions), and posts the result to /api/admin/activity.

<id> is the numeric entry id shown by plinth activity list.

plinth activity update <id> --impact 9 --featured true

At least one of --impact or --featured is required.

Removing

plinth activity remove <id>

Listing

plinth activity list

The list is read from the public /api/activity endpoint and is already ranked by the server.

Authentication and rate limits

The CLI uses PLINTH_API_URL and PLINTH_API_KEY to publish, update, and remove entries from your Plinth instance.

Public forge data works without forge tokens, but unauthenticated requests are rate-limited. Set GITHUB_TOKEN or CODEBERG_TOKEN when fetching activity to raise GitHub’s limit and reduce throttling. See Environment Variables.

Admin API

All admin endpoints are protected by Bearer token authentication. Set the token via PLINTH_API_KEY.

Authorization: Bearer <your-api-key>

Publish article

POST /api/admin/articles
Content-Type: application/json

Request body (PublishArticleRequest):

FieldTypeRequiredDescription
titlestringnoArticle title (can come from frontmatter)
slugstringnoURL slug (auto-generated from title if omitted)
descriptionstringnoMeta description
contentstringyesMarkdown or Typst source content
html_contentstringnoPre-rendered HTML (required for Typst)
tagsstring[]noTag names
authorstringnoAuthor name (defaults to site author)
publishedboolnoVisibility (default: true)
featuredboolnoFeatured flag (default: false)
embeddingfloat[]no384-dim fastembed vector
content_formatstringno"Markdown" (default) or "Typst"

Response (200):

{
  "success": true,
  "slug": "my-article",
  "id": "blog_posts:abc123",
  "message": "Article 'My Article' published successfully"
}

Error (400):

{
  "error": "Title is required",
  "details": "Provide title in request or frontmatter"
}

Error (409): a post with this slug already exists, published or not. Replace a draft with PUT /api/admin/drafts/{id} instead.

List drafts

GET /api/admin/drafts

Unpublished posts created through this API, with their source, newest first. Published posts are listed by the public GET /api/posts. Declarative drafts (from the Nix content directory) are owned by that directory and not listed.

Response (200):

[
  {
    "id": 42,
    "slug": "field-notes",
    "title": "Field notes",
    "description": "",
    "tags": ["notes"],
    "content": "Started on the train.",
    "content_format": "markdown",
    "published_at": "2026-11-09T18:00:00Z"
  }
]

Replace draft

PUT /api/admin/drafts/{id}
Content-Type: application/json

Takes the same body as Publish article and stores it in place of the draft with that id, in one transaction. The body’s slug may differ (a rename) and published: true makes it public. author, featured and the series fields keep the draft’s values when the body leaves them out; an embedding is not kept, since the content may have changed. The stored post gets a new id, so an editor holding an older copy gets 410 Gone instead of overwriting newer work. A published post or a declarative draft is never replaced (410), and a slug that belongs to another post gives 409 with the draft kept.

List tags

GET /api/admin/tags

Returns all tags with metadata.

Response (200):

[
  { "id": "tags:abc", "name": "rust", "slug": "rust", "post_count": 5 }
]

Add tag to post

POST /api/admin/posts/{post_slug}/tags
Content-Type: application/json

Request body (AddTagRequest):

{ "tag": "new-tag" }

Creates the tag if it doesn’t exist, then creates a tagged graph relation.

Remove tag from post

DELETE /api/admin/posts/{post_slug}/tags/{tag_slug}

Removes the tagged graph relation. Does not delete the tag itself.

Update site content

PUT /api/admin/content/{key}
Content-Type: application/json

Request body (UpdateSiteContentRequest):

FieldTypeDescription
titlestringContent block title
contentstringMarkdown source
html_contentstringRendered HTML

Upserts the content block — deletes existing entry with the same key and creates a new one.

Get site content

GET /api/admin/content/{key}

Returns the site content block, or null if not found.

Search API

The search API is publicly accessible (no authentication required). It uses fastembed vector embeddings for semantic similarity.

GET /api/search?q=<query>&limit=<n>
ParameterTypeDefaultDescription
qstringrequiredSearch query text
limitinteger10Maximum results

The query text is embedded into a 384-dimensional vector and matched against article embeddings in Postgres using pgvector’s HNSW approximate nearest-neighbour index with cosine distance.

Response (200):

[
  {
    "post": {
      "id": "blog_posts:abc",
      "slug": "my-article",
      "title": "My Article",
      "description": "First 200 characters of content...",
      "published_at": "2025-01-15T10:00:00Z",
      "author": "Jane Doe",
      "tags": ["rust"],
      "featured": false,
      "reading_time_minutes": 5
    },
    "similarity": 0.87
  }
]

Results are sorted by similarity (highest first). Because HNSW is approximate, very close neighbours may not be returned in perfect exhaustive order.

GET /api/articles/{slug}/related?limit=<n>
ParameterTypeDefaultDescription
slugpathrequiredSource article slug
limitinteger5Maximum results

Finds articles whose embeddings are most similar to the given article’s embedding. Useful for “related posts” sections.

Response: same format as semantic search.

Opinion evolution

GET /api/opinion?topic=<topic>&min_similarity=<threshold>
ParameterTypeDefaultDescription
topicstringrequiredTopic to track
min_similarityfloat0.5Minimum similarity threshold

Returns articles related to the topic sorted chronologically (oldest first), allowing you to see how your writing about a topic has evolved over time. Only articles above the similarity threshold are included.

Response: same format as semantic search, but sorted by published_at date.

Image Proxy

The image proxy serves images from a private Immich instance through Plinth, adding authentication and caching.

Endpoint

GET /api/images/{asset_id}?size=original|preview|thumbnail
ParameterTypeDefaultDescription
asset_idpath (UUID)requiredImmich asset ID
sizequery stringoriginalImage variant

Size variants

SizeDescriptionImmich endpoint
originalFull-resolution image/api/assets/{id}/original
previewResized preview/api/assets/{id}/thumbnail?size=preview
thumbnailSmall thumbnail/api/assets/{id}/thumbnail?size=thumbnail

Response headers

Content-Type: <forwarded from Immich>
Cache-Control: public, max-age=31536000, immutable

The 1-year cache duration is configurable via images.cache_max_age in plinth.toml.

Error responses

StatusCause
400asset_id is not a valid UUID
404Asset not found in Immich
502Failed to connect to Immich
503Image proxy not configured (no IMMICH_API_URL)

Security

  • The asset_id is validated as a UUID to prevent path traversal attacks
  • Immich API key is never exposed to the client — Plinth authenticates server-side
  • The endpoint is publicly accessible (images are meant to be viewed by readers)

Activity API

Endpoints for curated external contributions: pull requests and issues you landed on other repositories, ranked by impact and recency.

Admin

Admin endpoints require Bearer token authentication with PLINTH_API_KEY.

Authorization: Bearer <your-api-key>

Publish activity

POST /api/admin/activity
Content-Type: application/json

Upserts by the natural key (forge, repo_owner, repo_name, kind, number).

Request body (PublishActivityRequest):

FieldTypeRequiredDescription
forgestringyes"github" or "codeberg"
repo_ownerstringyesRepository owner
repo_namestringyesRepository name
kindstringyes"pr" or "issue"
numberintegeryesPR or issue number, greater than 0
urlstringyesCanonical forge URL
titlestringyesContribution title
bodystringnoContribution body or description
statestringyes"open", "closed", or "merged"
created_atstringyesISO-8601 creation timestamp
closed_atstringnoISO-8601 close timestamp
merged_atstringnoISO-8601 merge timestamp
impactintegernoCurated impact score, 1..=10, default 1
additionsintegernoLines added
deletionsintegernoLines deleted
comments_countintegernoNumber of comments reported by the forge
labelsstring[]noLabel names
repo_starsintegernoRepository star count
embeddingfloat[]no384-dimensional fastembed vector supplied by the CLI
featuredboolnoShow in the home strip, default false
publishedboolnoInclude in public surfaces, default true
content_hashstringnoOptional content fingerprint

Response (200):

{
  "success": true,
  "url": "https://github.com/owner/repo/pull/1234",
  "id": 42,
  "message": "Activity published successfully"
}

Update activity

PATCH /api/admin/activity/{id}
Content-Type: application/json

Updates curated fields for a numeric activity id.

FieldTypeRequiredDescription
impactintegernoNew impact score, 1..=10
featuredboolnoNew featured flag
publishedboolnoNew public visibility flag

Delete activity

DELETE /api/admin/activity/{id}

Deletes an activity entry by numeric id.

Public

List activity

GET /api/activity?limit=<n>&featured=<bool>

Returns entries ranked by score descending, then reference date descending. Reading a stale entry serves cached data immediately and triggers a single-flighted background refresh.

ParameterTypeDefaultDescription
limitintegerserver defaultMaximum entries
featuredboolomittedWhen true, return featured entries only

Response (200):

[
  {
    "id": 42,
    "forge": "github",
    "repo_owner": "owner",
    "repo_name": "repo",
    "kind": "pr",
    "number": 1234,
    "url": "https://github.com/owner/repo/pull/1234",
    "title": "Improve build output",
    "state": "merged",
    "impact": 7,
    "labels": ["rust"],
    "featured": true,
    "score": 6.92
  }
]

Get activity

GET /api/activity/{id}

Returns one activity entry by numeric id.

Feed

GET /feeds/activity.xml

RSS 2.0 feed for curated external activity. The response is application/rss+xml with Cache-Control: public, max-age=3600; entries link to the forge URL and are ordered by ranking.

Search

Activity entries are unioned into semantic search at GET /api/search. See the Search API.

Dev Environment

git clone https://github.com/caniko/plinth.git
cd plinth
nix develop

The dev shell provides:

  • Rust nightly with wasm32-unknown-unknown target
  • dioxus-cli, wasm-bindgen-cli, binaryen
  • Tailwind CSS standalone binary
  • PostgreSQL 16 with pgvector
  • sqlx-cli
  • OpenSSL, ONNX Runtime, libclang
  • Mold linker (Linux)
  • mdBook (for documentation development)

Local database

Start the development Postgres before running the server or integration tests:

./scripts/dev-db.sh start

The dev shell exports PGDATA=$PWD/.dev-pgdata, PGHOST=$PWD/.dev-pgsocket, and DATABASE_URL=postgres://localhost/plinth?host=$PWD/.dev-pgsocket. The lifecycle script initializes the cluster if needed, creates the plinth database, and installs the vector extension.

Other database commands:

./scripts/dev-db.sh stop
./scripts/dev-db.sh reset

pg_ctl requires PGDATA; run these commands inside nix develop unless you set the Postgres environment variables yourself.

Development server

dx serve --web --fullstack

This starts the Axum server with Dioxus hot reload at http://127.0.0.1:3000. Changes to Rust source files trigger recompilation of both the server and the WASM client.

Running checks

# Full CI check (build + clippy + fmt + tests)
nix flake check

# Individual commands
cargo fmt --all
cargo clippy --all-targets -- --deny warnings
cargo test --workspace --exclude plinth-client

The client crate is excluded from cargo test because it targets wasm32-unknown-unknown.

Building documentation locally

cd docs
mdbook serve

This starts a local preview server with live reload.

Important build notes

  • New files must be git add-ed before nix flake check or nix build can see them (Nix uses the git index)
  • reqwest::Client::new() panics in Nix sandbox — use Client::builder().build() and handle errors
  • fastembed::TextEmbedding::try_new() downloads models at runtime and fails in the Nix sandbox — all tests must avoid it
  • Raw string literals: use r##"..."## when content contains "# (common with Markdown headings)

Testing

Plinth uses unit tests for pure logic and Postgres-backed integration tests for database behaviour.

Running tests

# All tests and integration tests
cargo test --workspace --all-targets

# Single test
cargo test --package plinth-server test_name

# With output
cargo test --workspace --all-targets -- --nocapture

Test organisation

Unit tests

Unit tests live in #[cfg(test)] modules within source files. Examples:

  • crates/server/src/config.rs — config parsing and defaults
  • crates/server/src/api/admin.rs — request construction and error responses
  • crates/server/src/api/images.rs — Immich URL building and query defaults
  • crates/server/src/services/markdown_processor.rs — Markdown parsing, slug generation
  • crates/server/src/services/db.rs — database operations
  • crates/shared/src/blog_post.rs — reading time calculation

Integration tests

Located in crates/server/tests/. Database-backed integration tests use #[sqlx::test], which creates an isolated database for each test, runs crates/server/migrations/, and passes the test a PgPool.

  • migration_integration.rs — verifies migrations create the expected tables, pgvector extension, vector column, and HNSW index.
  • db_integration.rs — CRUD for core site_content and tags.
  • blog_admin_integration.rs — blog post lifecycle, tag junction rows, denormalized tag cache, ordering, slug uniqueness, and delete cascades.
  • tag_integration.rs — shared tag creation, post/todo tag attachment, counts, and tag-filtered list reads.
  • todo_integration.rs — todo lifecycle, completion, ordering, tagging, slug uniqueness, and delete cascades.

Local Postgres setup

Inside nix develop, start the local Postgres cluster:

./scripts/dev-db.sh start

The dev shell exports DATABASE_URL=postgres://localhost/plinth?host=$PWD/.dev-pgsocket. #[sqlx::test] uses that as the base URL for per-test databases. Outside the dev shell, set DATABASE_URL to a Postgres 16 instance where the test user can create and drop databases and where pgvector is installed.

DATABASE_URL='postgres://localhost/plinth?host=/path/to/socket' \
  cargo test -p plinth-server --test blog_admin_integration

Constraints

  • No network in Nix sandbox: tests cannot download fastembed models or make HTTP requests
  • Client crate: browser-specific code targets wasm32-unknown-unknown; prefer workspace checks for full coverage
  • Postgres extensions: pgvector must be installed in the base cluster before integration tests run

Contributing

Code style

  • Format with cargo fmt --all
  • Lint with cargo clippy --all-targets -- --deny warnings
  • Both are enforced in CI

Before submitting

Run the full CI check locally:

nix flake check

This runs build, clippy, formatting, and all tests in one command. It matches exactly what CI runs.

If you’ve added new files, remember to git add them first — Nix only sees files in the git index.

Architecture guidelines

  • Shared types go in plinth-shared — anything used by both server and client
  • Feature-gate server deps with #[cfg(feature = "ssr")] — the client compiles to WASM without tokio, axum, etc.
  • Actor messages should be small and cloneable — actors handle concurrency
  • Use parameterized SQLx queries — avoid string-built SQL, keep nullable values explicit, and add stable ORDER BY clauses for list reads
  • Keep tag writes transactional — blog and todo tags use junction tables plus denormalized tag caches; mutations that touch both must update them in one transaction
  • Write Postgres null checks explicitly — nullable columns use IS NULL / IS NOT NULL; = NULL never matches rows
  • Use r##"..."## for raw strings containing "# (Markdown headings in SQL)

CI

Woodpecker CI runs on Codeberg for push and PR events to main, poc, and develop branches:

  1. nix flake check — build, clippy, fmt
  2. cargo test --workspace --all-features
  3. Release build (main branch only)