Rust rewrite of The House
  • Rust 81.8%
  • Jinja 17.1%
  • CSS 1.1%
2026-01-08 16:46:51 +03:00
.sqlx Revamped settings page 2026-01-08 16:46:51 +03:00
assets Revamped settings page 2026-01-08 16:46:51 +03:00
migrations Revamped settings page 2026-01-08 16:46:51 +03:00
src Revamped settings page 2026-01-08 16:46:51 +03:00
.gitignore Added basic login and registration 2025-10-05 23:36:17 +03:00
askama.toml Revamped settings page 2026-01-08 16:46:51 +03:00
build.rs Added basic login and registration 2025-10-05 23:36:17 +03:00
Cargo.lock Revamped settings page 2026-01-08 16:46:51 +03:00
Cargo.toml Ugraded packages 2025-11-30 11:29:38 +03:00
LICENSE Added basic login and registration 2025-10-05 23:36:17 +03:00
README.md Revamped settings page 2026-01-08 16:46:51 +03:00

THRust

A work-in-progress rewrite of The House - Reloaded using poem, sqlx and askama.

Why?

My last rewrite of The House had extremely questionable design decisions, little to no performance optimizations, and was written in Python. This Rust rewrite is supposed to address all these issues. Yes, I didn't rewrite it in Go, because I really wanted that extra 10% of performance that I will probably never notice.

This one will no longer store unhashed auth tokens in the database, nor have O(n) time complexity for every route that needs a database call, and will finally have simple pagination. It's also supposed to be much more performant than its Python counterpart, and be an excellent learning project for me.

I also switched up the development stack completely from my previous API rewrite attempt. I switched from actix-web to poem because it's easier to play with and prohibits unsafe, from diesel to sqlx because it's fun and async, and I added askama for templates. I avoided tera for askama's compile-time safety guarantees.

Setup

Clone the repository and then $ cargo build (with or without the --release flag) and grab the binary.

Running $ ./thrust with no custom configuration will create a data directory in the current working directory for storing the SQLite database, and an uploads directory inside of it to store user uploads, then run the web server with the default configuration.

THRust can be configured extensively, but not everyone needs that. A server administrator would probably only need to configure a cookie secret so user sessions are valid after restarting the server.

Configuration

You can configure THRust by passing command line arguments (see thrust --help).

You can also use the --config option to pass the path to a TOML configuration file, similar to the following:

address = "0.0.0.0:7301"
database-url = "sqlite://prod.db"
uploads-path = "./user-uploads"

You can also set the following environment variables:

  1. THRUST_DATABASE_URL must be set to a valid URI of a SQLite database (default: sqlite://data/thrust.db)
  2. THRUST_ADDRESS can be a valid address with the format host:port (default: 127.0.0.1:9456)
  3. THRUST_UPLOADS_DIR can be the path to a directory for storing user uploads (default: ./data/uploads)
  4. THRUST_CUSTOM_ABOUT can be the path to a custom about.html file (default: disabled)
  5. THRUST_SITE_NAME can be the name of the forum (default: The House)
  6. THRUST_COOKIE_SECRET can be a 64-character long string for signing the session cookie (default: random key every run)
  7. THRUST_ENABLE_ADMIN_SECRET must be yes in order to enable the functionality below (default: disabled)
  8. THRUST_ADMIN_SECRET can be a secure password, as it allows you to promote your member account to an administrator account using the /promote route (default: disabled)
  9. THRUST_THREADS_PER_PAGE can be the desired number of threads shown when displaying a category (default: 15)
  10. THRUST_REPLIES_PER_PAGE can be the desired number of replies shown in the user inbox (default: 15)

THRust will register and prefer configuration options using the following hierarchy: command line arguments > configuration file > environment variables > default values

Progress

There's still some work to be done:

  • Basic login & registration
  • Set up all database models
  • Pagination
  • 1:1 Feature support with THR
  • Token Auth & External API

And a few quick TODOs to finish:

  • Add the ability to block/mute users and the ability to hide threads
  • Use askama macros to generate the comment tree itself in view_thread?
  • Remove and replace the few O(n) queries in the index and view_category routes

License

THRust is licensed under the GNU Affero General Public License V3.0.