A TheDarkArtist's Project
read more at https://www.thedarkartist.in/projects
rusty-blog-webapp
This is a modular Rust web application built using Actix-web for the backend, Tera for templating, and HTMX for client-side interactivity. It features structured routing, authentication, and logging with tracing. The app serves static files, handles dynamic page rendering, and integrates easily with databases.
Rust Web App with Actix-web, Tera, and HTMX: A Story of Performance, Elegance, and Control
Welcome to yet another TDA Blog. You’re not here to scaffold another boilerplate CRUD app. You’re here because you want control—of every route, every byte, every render cycle. You’re here because you want to craft a web application, not just assemble it. This is the story of a minimalist, modular web app built with Rust, driven by Actix-web, sculpted with Tera, and energized by the finesse of HTMX.
Let’s begin.
🦀 Why Rust, Why Now?
In a world bloated with monolithic JavaScript stacks and spaghetti frontends, you chose Rust. Because Rust respects you. It doesn’t hide complexity behind magic—it lets you master it. This project embodies that same philosophy.
It’s not just fast—it’s predictable, secure, and testable. Rust doesn’t crash at runtime. Your types, your compiler, your ownership—they’ve got your back.
⚙️ The Engine: Actix-web
Actix-web is the beast of the backend. It’s not just “fast”—it’s absurdly fast, built on a highly concurrent actor model. It’s the Rustacean’s answer to high-throughput web servers. In this application, every route is tightly defined, every handler precise. No guesswork, no garbage.
Routing is modular. You don’t wire endpoints into one tangled file. Instead, routes are composed, layered, namespaced—just like your thoughts.
// src/routes/mod.rs
pub mod auth;
pub mod pages;
pub mod api;
Each module cleanly manages its concern. Want to trace a request across services? Just follow the logs.
📄 Templating with Tera
Tera is like Jinja2 but Rusty. It speaks in HTML, but it listens to logic. Your templates aren’t a mess of JS and data-fetching chaos. Instead, server-side rendering is clean and testable, separating content from logic.
You control exactly what gets rendered, when, and how.
<h1>Welcome, {{ user.name }}</h1>
No hydration, no client-side diffing battles. Just HTML. Fast. Predictable.
🔄 HTMX: Interactivity Without JS Frameworks
HTMX is your silent partner. It sits quietly on the page and springs into action only when needed. No virtual DOMs, no reactivity wars—just attributes that breathe life into your pages.
<button hx-get="/dashboard/ping" hx-target="#live-ping">Ping</button>
<div id="live-ping"></div>
You get reactivity without the overhead. The browser makes a GET request. Rust renders the response. HTMX swaps the DOM. You didn’t write a single line of JS—and you didn’t need to.
🧩 Modular Design
You don’t want a tangled mess of logic. You want clarity.
src/routes/
handles navigation.src/models/
holds your domain structures—likeUser
,Post
,Session
.src/services/
connects the logic—business rules, database interaction.src/utils/
is your toolkit—validation, formatting, helpers.
Everything has its place. Everything can be tested, logged, extended. Nothing is accidental.
🧪 Tracing and Structured Logging
You don’t debug with println!
. You trace.
Powered by tracing
and tracing-actix-web
, this app gives you structured logs:
[INFO] 2025-05-16T12:00:00Z: GET /profile
[TRACE] 2025-05-16T12:00:00Z: Auth token valid for user_id=12
[ERROR] 2025-05-16T12:00:01Z: DB connection timed out
Logs aren’t noise—they’re signal. You can even pipe them to files in logs/
, analyze them, trigger alerts.
❌ Custom 404s and Error Handling
Users will hit broken links. Instead of showing them a generic "Not Found", you greet them with a custom 404 page that fits your brand and mindset. Errors aren’t just handled—they’re designed.
And behind the scenes? The error logs give you everything you need to fix the problem—without ever exposing it to the user.
🗂 Static Files? Handled.
CSS, JS, images—all served via actix-files
. No need for Nginx in front unless you want it. This app can stand on its own.
📦 Getting Started
git clone https://github.com/IAmKushagraSharma/tda-web.git
cd tda-web
cargo run
Define a .env
file:
DATABASE_URL=your_db_url
SECRET_KEY=ultra_secret
And you’re live at http://127.0.0.1:3000
.
🛠 The Developer Experience
The app is built to scale—not just for production, but for you. Clear folder structure. Predictable behavior. Minimal dependencies. It doesn't require a devops degree to get started, nor a webpack config to edit a button.
You’re free to focus on the things that matter—architecture, performance, security.
🤝 Contribute if You Dare
If you want to sharpen your Rust web skills, fork it, break it, patch it. Your PRs are welcome—but bring your A-game. This isn’t a playground. This is a place for builders.
Final Words
This project is more than a blog backend. It's an architectural statement. A balance of performance and sanity. A rejection of unnecessary abstraction. A vote for clarity, speed, and control.
Welcome to the Rusty Web. Let’s build like it’s 1999—but faster, safer, and cleaner.
Created At
Mon, Jun 23, 2025
Last Updated at
Tue, Jun 24, 2025
Project Tags
- Rust
- Blog
- ActixWeb
- Tera
- UI
Average Reading Time
4 Minutes | 729 Words