A lightweight, blazing-fast CMS built with Rust β WordPress parity without the bloat.
π―π΅ Japanese documentation: README_ja.md
RedLeaf is a modern CMS powered by Rust.
It combines the stability of systems programming with the flexibility of web publishing.
- β‘ Fast β compiled Rust backend, in-memory page cache, minimal runtime overhead
- πͺΆ Lightweight β single binary + SQLite, zero external runtime dependencies
- π Secure β Argon2id password hashing, JWT auth, role-based capabilities
- π Headless Ready β full REST API included
- π³ Docker Ready β multi-stage build, production-grade image
- π§© WordPress Compatible β WXR import/export, familiar admin UX
| Layer | Technology |
|---|---|
| Language | Rust (stable, 2021 edition) |
| Web Framework | Axum 0.8 |
| Database | SQLite via SQLx 0.8 |
| Templates | Askama 0.14 (compiled at build time) |
| Auth | JWT (jsonwebtoken) + Argon2id |
| Search | SQLite FTS5 (full-text search) |
| Image Processing | image 0.25 (resize + WebP) |
| XML Parsing | quick-xml 0.37 (WXR import) |
| Cache | In-memory page cache (Tower middleware) |
git clone https://github.com/yourname/redleaf.git
cd redleaf
cp .env.example .env # set JWT_SECRET before production use
cargo runOpen http://localhost:3000
First run: visit http://localhost:3000/setup to create the admin account.
docker build -t redleaf .
docker run -p 3000:3000 \
-v redleaf-data:/app/data \
-v redleaf-uploads:/app/static/uploads \
-e JWT_SECRET=$(openssl rand -hex 32) \
redleaf| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
sqlite:redleaf.db |
SQLite file path |
HOST |
127.0.0.1 |
Bind address |
PORT |
3000 |
Listen port |
JWT_SECRET |
(required in production) | Token signing secret |
redleaf/
βββ src/
β βββ main.rs # Entry point β server startup
β βββ lib.rs # App builder β router + middleware wiring
β βββ auth.rs # JWT generation & validation
β βββ cache.rs # In-memory page cache (Tower middleware)
β βββ db.rs # SQLite connection pool
β βββ errors.rs # Unified AppError type
β βββ filters.rs # Askama template filters
β βββ hooks.rs # Action/filter hook registry (WordPress-style)
β βββ image_processing.rs # Image resize + WebP variant generation
β βββ middleware.rs # Auth middleware + capability checks
β βββ shortcodes.rs # Shortcode registry ([gallery], [caption], β¦)
β βββ util.rs # slugify / render / Pagination / FTS helpers
β βββ wxr.rs # WordPress WXR XML parser
β βββ assets.rs # Script/style enqueue registry
β βββ models/
β β βββ activity_log.rs # Admin activity log
β β βββ category.rs # Categories
β β βββ comment.rs # Comments (threaded)
β β βββ media.rs # Media library + image variants
β β βββ nav_menu.rs # Custom navigation menus
β β βββ page.rs # Static pages
β β βββ post.rs # Posts (CRUD, FTS, revisions, scheduling)
β β βββ post_meta.rs # Custom fields (KV store per post)
β β βββ post_revision.rs # Post revision history
β β βββ setting.rs # Site settings KV store
β β βββ tag.rs # Tags
β β βββ user.rs # Users (roles, profiles)
β β βββ widget.rs # Widget areas + widgets
β βββ routes/
β βββ mod.rs # Public pages (home, search, setup, sitemap, β¦)
β βββ admin.rs # Admin panel (all CRUD + import/export)
β βββ api.rs # REST API (/api/posts)
β βββ auth.rs # Auth API (/auth/login, /auth/register)
β βββ feed.rs # RSS 2.0 & Atom feeds
β βββ posts.rs # Public post pages
β βββ taxonomy.rs # Category & tag archive pages
βββ templates/
β βββ admin/ # Admin panel (dashboard, posts, media, β¦)
β βββ themes/default/ # Default public theme (single, archive, β¦)
β βββ base.html # Public base layout
β βββ index.html # Homepage
β βββ search.html # Search results
β βββ setup.html # First-run setup wizard
βββ migrations/ # 15 SQLx migrations (embedded in binary)
βββ static/
β βββ uploads/ # User-uploaded media files
βββ tests/ # Integration tests
βββ ai_docs/ # Project documentation & Claude Code skills
βββ build.rs # Captures RUST_VERSION at compile time
βββ Dockerfile
| Method | Path | Description |
|---|---|---|
| GET | / |
Homepage |
| GET | /posts |
Post archive (paginated) |
| GET | /posts/{slug} |
Single post |
| GET | /categories/{slug} |
Category archive |
| GET | /tags/{slug} |
Tag archive |
| GET | /author/{username} |
Author archive |
| GET | /pages/{slug} |
Static page |
| GET | /search?q=β¦ |
Full-text search |
| GET | /feed |
RSS 2.0 feed |
| GET | /feed/atom |
Atom feed |
| GET | /sitemap.xml |
XML sitemap |
| GET | /robots.txt |
robots.txt (editable in admin) |
| GET | /health |
Health check ({"status":"ok"}) |
| Method | Path | Description |
|---|---|---|
| POST | /auth/login |
Login β JWT |
| POST | /auth/register |
Register β JWT |
| Area | Paths |
|---|---|
| Dashboard | GET /admin (+ quick draft POST) |
| Posts | /admin/posts CRUD + bulk actions, toggle, revisions |
| Pages | /admin/pages CRUD |
| Categories | /admin/categories CRUD + bulk delete |
| Tags | /admin/tags + bulk delete |
| Media | /admin/media upload/delete (auto-generates variants) |
| Comments | /admin/comments approve/reject/spam |
| Users | /admin/users + role management |
| Menus | /admin/menus CRUD + drag-and-drop items |
| Widgets | /admin/widgets CRUD + reorder |
| Settings | /admin/settings + robots.txt |
| Activity Log | GET /admin/activity-logs |
| Import | GET/POST /admin/import (WXR) |
| Export | GET /admin/export β JSON / WXR / SQLite backup |
| Method | Path | Description |
|---|---|---|
| GET | /api/posts |
Post list (JSON) |
| GET | /api/posts/{id} |
Single post (JSON) |
| POST | /api/posts |
Create post (auth) |
| PUT | /api/posts/{id} |
Update post (auth) |
| DELETE | /api/posts/{id} |
Delete post (auth) |
| GET | /api/users/{id}/posts |
Posts by user |
| Feature | Status |
|---|---|
| Post CRUD + Markdown rendering | β |
| Category & tag management | β |
| Media upload & library | β |
Image resize + WebP variants + <img srcset> |
β |
| JWT authentication + role-based capabilities | β |
| REST API | β |
| FTS5 full-text search | β |
| Site settings | β |
| Docker / health check | β |
| Web installer (setup wizard) | β |
| Static pages (Pages) | β |
| Featured images + OGP | β |
| Custom fields (Post Meta) | β |
| Scheduled posts | β |
| Post revisions | β |
| Sticky posts | β |
| Template system (themes) | β |
| Hook system (actions / filters) | β |
Shortcode API ([gallery], [caption], [audio]) |
β |
| Custom navigation menus | β |
| Breadcrumbs + JSON-LD | β |
| Widget areas | β |
| User roles & profiles | β |
| Author archive pages | β |
| Comment system (threaded) | β |
| Comment moderation | β |
| RSS 2.0 / Atom feeds | β |
| XML sitemap | β |
| SEO meta + Open Graph + Twitter Card | β |
| Structured data (JSON-LD Article) | β |
| Bulk actions (posts / categories / tags) | β |
| Activity log | β |
| Dashboard (stats / quick draft / site health) | β |
| In-memory page cache + ETag / Last-Modified | β |
| WordPress WXR import (+ dedup / slug rename) | β |
| JSON export / WXR export / SQLite backup | β |
Custom commands for AI-assisted development:
Implements a task from ai_docs/wordpress-parity-tasks.md, runs cargo build, and marks the checkbox.
/wp-implement γγ§γΌγΊ 8
/wp-implement RSS feed
/wp-implement β list all pending tasks
Appends a new task to the roadmap file.
cargo testIntegration tests in tests/: auth_test.rs Β· admin_posts_test.rs Β· public_posts_test.rs Β· api_test.rs Β· taxonomy_test.rs
cargo build --release
# copy binary + static/ to /opt/redleaf
# configure /etc/systemd/system/redleaf.service with JWT_SECRET env var
# put Nginx in front for TLS + static file servingfly launch --no-deploy
fly volumes create redleaf_data --size 1
fly volumes create redleaf_uploads --size 5
fly secrets set JWT_SECRET="$(openssl rand -hex 32)"
fly deploy
# visit https://your-app.fly.dev/setupDownload a live SQLite snapshot anytime from Admin β Export β Download DB.
"RedLeaf β grows naturally, powered by Rust."
Every page is a leaf. Every site is a tree. And Rust is the root that keeps it strong.
MIT