trestle

Crates.iotrestle
lib.rstrestle
version0.1.0
created_at2025-10-26 03:47:56.414578+00
updated_at2025-10-26 03:47:56.414578+00
descriptionA CLI tool to scaffold Rust web applications with Axum, Dioxus, or HTMX.
homepage
repositoryhttps://github.com/RedHoodJT1988/trestle
max_upload_size
id1900913
size41,420
Jonathan Reeves (RedHoodJT1988)

documentation

README

πŸ”₯ Trestle

Trestle a new path for Rust web development. One command to rule all your boilerplate.

Rust CI Crates.io MIT License

Trestle is a command-line tool designed to eliminate the boilerplate and setup cost of starting a new full-stack project in Rust. Inspired by frameworks like Django and Rails, Trestle scaffolds a complete, runnable application with a lightning-fast Axum backend, so you can start building features immediately.

Choose between a modern, reactive frontend with Dioxus (all in Rust!) or the elegant simplicity of server-rendered HTMX.

Core Features

  • Powerful Rust Backend: All projects are built on the fast, ergonomic Axum
  • Flexible Frontend: Choose your preferred paradigm:
    • Dioxus: For building rich, interactive SPAs entirely in Rust (compiled to WASM).
    • HTMX: For a traditional, server-rendered HTML approach using the Maud templating engine.
  • Database Integration: Out-of-the-box support for multiple databases. The default is a static site with no database.
    • SQL: PostgreSQL, MySQL (via sqlx)
    • NoSQL: MongoDB
    • BaaS:: Firebase (via REST API)
  • Ready to Run: Generated projects include a .env.example, pre-configured Cargo.toml, and all necessary connection logic.

πŸš€ Installation

Once published, you can install trestle directly from crates.io:

cargo install trestle

From Source

You can also build and install from the source code:

git clone https://github.com/RedHoodJT1988/trestle.git
cd trestle
cargo install --path .

Usage

The main command is Trestle new. It takes a project name and optional flags to configure the frontend and database.

trestle new <PROJECT_PATH> [OPTIONS]

Options

Flag Argument Description
--frontend dioxus (default), htmx The frontend framework to use.
--db postgres, mysql, mongodb, firebase The database to configure. If omitted, a static site (no DB) is created.
-h, --help Print help information.

Examples

  1. Create a default static site with Dioxus (no database):
trestle new my_static_site
  1. Create a static HTMX site (no database):
trestle new my_htmx_blog --frontend htmx
  1. Create a Dioxus app with PostgreSQL:
trestle new my_store --db postgres
  1. Create an HTMX dashboard with MongoDB:
trestle new my_dashboard --frontend htmx --db mongodb

Generated Project Structure

Running trestle new my_app --db postgres will generate the following structure:

my_app/
β”œβ”€β”€ .env.example            # Environment variables (e.g., DATABASE_URL)
β”œβ”€β”€ .gitignore
β”œβ”€β”€ Cargo.toml              # Pre-configured with Axum, Dioxus, SQLx, etc.
β”œβ”€β”€ Dioxus.toml             # Dioxus build configuration
β”œβ”€β”€ index.html              # Entrypoint for the Dioxus WASM app
└── src/
    β”œβ”€β”€ main.rs             # Axum server entrypoint, routing, and state
    β”œβ”€β”€ lib.rs                # The root Dioxus application component
    └── db.rs                 # Database connection pool logic and models

πŸ’– Contributing

We are thrilled you're interested in contributing to Trestle! This project is a community effort, and we welcome help of all kinds, from fixing bugs to adding new features.

How to Contribute

  1. Find an Issue: Look through our GitHub Issues. Good first issues are a great place to start.
  2. Open an Issue: If you have a feature idea or find a bug, please open an issue first to discuss it.
  3. Fork and Clone: Fork the repository and clone it locally.
git clone https://github.com/RedHoodJT1988/trestle.git
cd trestle
  1. Create a Branch: Create a new branch for your feature or bugfix.
git checkout -b feature/my-new-feature
  1. Make Your Changes:
  • The core logic is in src/main.rs and src/scaffold/mod.rs.
  • All project blueprints are located in the templates/ directory.
  • To add a feature (e.g., a new database), you would create new template directories (e.g., templates/redis-htmx and templates/redis-dioxus) and update the main.rs file to recognize the new --db redis flag.
  1. Test Your Changes: Build the CLI and test it locally.
cargo build --release
./target/release/trestle new test-project --db YOUR_NEW_DB
cd test-project
cargo run
  1. Submit a Pull Request: Push your branch to your fork and open a Pull Request against the main branch of the original repository.

πŸ—ΊοΈ Roadmap

We have big plans for trestle! Here are some of the features we'd love to add:

  • [] Authentication: Scaffold complete auth logic (registration, login, sessions) for different strategies (e.g., JWT, cookies).
  • [] More Databases: Add support for Redis, SQLite (great for simple apps!), and other popular databases.
  • [] Deployment: Add Dockerfile and fly.toml generation for easy deployment.
  • [] Interactive Mode: An interactive trestle new command that walks the user through the setup process.

Your contributions are essential to making this happen!

πŸͺͺLicense

This project is licensed under the MIT License. See the LICENSE file for details.

Commit count: 0

cargo fmt