Blog Architecture
This blog is built with a custom Rust framework consisting of two binaries.
Builder
Static site generator that converts Markdown to HTML:
- Markdown parsing with pulldown-cmark (tables, footnotes, strikethrough, tasklists)
- Syntax highlighting via syntect (100+ languages, build-time rendering)
- Math formulas rendered by KaTeX at build time
- Template engine using Tera
- Output generation: search index (JSON), RSS/Atom feeds, sitemap
Example math:
Gateway
HTTP server (Axum) serving the static site:
- Static file serving with gzip compression
- Search API (
/api/search?q=query) - Page view analytics (SQLite, IP hashed with SHA-256)
- Rate limiting (token bucket algorithm)
- Security headers (CSP, X-Frame-Options, etc.)
Deployment Flow
plaintext
Local: git push vps main | v VPS: post-receive hook | v git checkout to /home/si/blog/site | v builder -c config.toml build | v Static files in dist/ served by gateway
Directory Structure
plaintext
blog/ ├── bin/ │ ├── builder # Static site generator │ └── gateway # HTTP server ├── site/ │ ├── config.toml # Configuration │ ├── content/ │ │ ├── posts/ # Markdown posts │ │ └── pages/ # Static pages │ ├── templates/ # Tera templates │ ├── static/ # CSS, JS, images │ └── dist/ # Generated output └── blog.git/ # Bare repo for deployment