A modern Rust backend application for sharing Rust backend development content with dynamic blog rendering.
- Dynamic Blog System: JSON-based component system for flexible content layouts
- High Performance: Built with Actix Web for maximum throughput
- Type Safety: SQLx for compile-time checked SQL queries
- Modern Templates: MiniJinja templating with Tailwind CSS
- Component-Based Content: Reusable components (headings, code blocks, callouts, cards, etc.)
- Framework: Actix Web
- Database: PostgreSQL with SQLx ORM
- Templates: MiniJinja with custom filters
- Styling: Tailwind CSS + custom CSS
Instead of traditional Markdown, this system uses JSON components for maximum flexibility:
{
"type": "callout",
"style": "warning",
"markdown": "Important information with **bold** text"
}Supported component types:
heading- Section headingsparagraph- Text content with markdown supportcode- Syntax-highlighted code blockscallout- Styled information boxescard- Link cards with titles and descriptionsimage- Images with optional captionsquote- Blockquotes with optional attribution
src/
├── main.rs # Application entry point
├── config.rs # Configuration management
├── database.rs # Database connection and queries
├── models/
│ └── blog.rs # Blog post data models
├── services/
│ └── blog.rs # Business logic layer
├── handlers/
│ ├── web.rs # Web page handlers
│ └── api.rs # API endpoint handlers
└── templates/
└── mod.rs # Template engine and filters
templates/
├── base.html # Base template
├── home.html # Homepage
├── blog_list.html # Blog listing page
├── blog_post.html # Individual blog post
└── contact.html # Contact page
migrations/
└── 001_create_blog_posts.sql # Database schema
- Install PostgreSQL and create a database
- Copy
.env.exampleto.envand configure your database URL - Run migrations:
sqlx migrate run - Start the server:
cargo run
The application will be available at http://localhost:8080
GET /- HomepageGET /blog- Blog listing with paginationGET /blog/{slug}- Individual blog postGET /contact- Contact pageGET /api/blog- Blog posts API (JSON)GET /api/blog/{slug}- Single blog post API (JSON)
The component rendering system is extensible - add new component types by:
- Adding the variant to
BlogComponentenum inmodels/blog.rs - Implementing rendering logic in
templates/mod.rs - The system automatically handles the new component type
This architecture provides maximum flexibility for creating rich, interactive blog content while maintaining type safety and performance.