This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Personal website (jonathansm.com) built as a single Rust binary with embedded templates/static files, served alongside a read-only SQLite database. Content is managed in a separate repo and deployed as a .db file.
Uses just (justfile) as the task runner. The justfile loads .env automatically.
- Build:
just self(macOS) orjust linux(cross-compile to x86_64-unknown-linux-gnu) - Dev server:
just auto-reload(alias:just ar) — watches.rsand.htmlfiles, auto-recompiles and restarts - Format:
just fmt— runscargo fmtandprettieron CSS/HTML files - Lint:
just lint— runscargo fmtthencargo clippywith strict pedantic rules - Test:
just test— runscargo test - Deploy:
just deploy— rsync release binary to server, restart systemd service
Request flow: Axum router → route handlers (routes.rs) → services (services/) → SQLite via r2d2 connection pool → Tera templates (templates/)
Key source files:
src/main.rs— server startup, router setupsrc/app.rs— AppState, Tera template initializationsrc/db.rs— connection pool management, hot-swap support (swap active database without restart viaarc-swap)src/routes.rs— all route handlerssrc/post.rs— Post/Link/Quote data typessrc/services/post.rs— database queries, type conversionssrc/services/search.rs— full-text search (SQLite FTS)src/services/search_query.rs— search query parsing (supportstag:,from:,to:,type:syntax)src/services/image.rs— serves images stored in SQLitesrc/services/test_helpers.rs— shared test infrastructure: in-memory SQLite schema, canonical seed data (12 posts + about page, commits, image), andtest_db()helper that returns a seededArc<DbHandles>src/rss.rs— RSS feed generation
Templates: Tera (Jinja2-like) in templates/. Base layout in base.html, reusable components in macros.html.
Static assets: Embedded at compile time via rust-embed. CSS in static/css/style.css, fonts (fbb family) in static/fonts/.
Database: Read-only SQLite with vector search via sqlite-vec for related post recommendations. Posts include git commit metadata for "last updated" tracking.
Unit tests live alongside source files in #[cfg(test)] modules. Integration-style tests that need a database use test_db() from src/services/test_helpers.rs, which spins up a temporary SQLite file seeded with canonical fixture data (no mocking). Coverage spans db.rs, post.rs, rss.rs, services/post.rs, services/search.rs, and services/search_query.rs.
- Commits follow conventional commit format:
feat:,fix:,style:,refactor:,chore:,docs: - Clippy runs with
-D clippy::correctness -D clippy::perf(deny) and-W clippy::suspicious -W clippy::complexity -W clippy::style -W clippy::pedantic(warn)