| Crates.io | rustyroad |
| lib.rs | rustyroad |
| version | 1.0.26 |
| created_at | 2023-01-09 22:42:39.187703+00 |
| updated_at | 2026-01-11 01:26:23.746986+00 |
| description | Rusty Road is a framework written in Rust that is based on Ruby on Rails. It is designed to provide the familiar conventions and ease of use of Ruby on Rails, while also taking advantage of the performance and efficiency of Rust. |
| homepage | |
| repository | https://github.com/RileySeaburg/RustyRoad |
| max_upload_size | |
| id | 754834 |
| size | 923,156 |
Rails-flavored scaffolding and migrations for Rust web apps (Actix + Tera + SQLx).
RustyRoad is under active development. For day-to-day use, prefer the latest released version on crates.io.
In loving memory of Rusty (2014–2023), a wonderful loving pup. I am forever grateful for the time I had with him.
RustyRoad is a Rust CLI + generator toolkit inspired by Ruby on Rails.
It focuses on:
Under the hood, generated projects use Actix for HTTP, Tera for templates, and SQLx for database support.
If you're curious about the motivation, there's a short write-up here: https://rileyseaburg.com/posts/rust-needs-a-rails
rustyroad new)rustyroad generate ...)rustyroad migration ...)rustyroad db ..., rustyroad query ...)rustyroad-mcp)rustyroad feature add grapesjscargo install rustyroad
git clone --recurse-submodules https://github.com/RustyRoad/RustyRoad
cd RustyRoad
cargo build --release
Create a new project:
rustyroad new my_project
Generate a route/controller:
rustyroad generate route users
rustyroad.toml is usedRustyRoad reads your database settings from a TOML file in your project root.
./rustyroad.tomlENVIRONMENT is set and not dev: RustyRoad reads ./rustyroad.<ENVIRONMENT>.tomlExamples:
ENVIRONMENT=prod → reads rustyroad.prod.tomlENVIRONMENT=test → reads rustyroad.test.tomlThere is no special rustyroad.dev.toml—dev is the plain rustyroad.toml file.
Tip: You can also use ENV=prod as a shorthand for ENVIRONMENT=prod.
If you're unsure what RustyRoad is going to read on your machine, run:
rustyroad config
(It prints ENVIRONMENT=..., the config filename, and a sanitized view of the parsed database settings.)
RustyRoad expects migrations in this exact location (do not create a plain ./migrations/ folder):
./config/database/migrations/<timestamp>-<name>/up.sql
./config/database/migrations/<timestamp>-<name>/down.sql
List migrations:
rustyroad migration list
Run all migrations (up) in order:
rustyroad migration all
Run a single migration by name (the name is the part after the timestamp in the folder name):
rustyroad migration run create_users_table
Rollback a migration:
rustyroad migration rollback create_users_table
Generate a migration (folder + files):
rustyroad migration generate create_users_table id:serial:primary_key email:string:not_null,unique
If you (or an AI agent) accidentally created migrations in the wrong location (like ./migrations/), RustyRoad can detect and convert them:
# Preview what would be converted
rustyroad migration convert --dry-run
# Convert and keep source files
rustyroad migration convert
# Convert and remove source files
rustyroad migration convert --remove-source
RustyRoad will also warn you when running any migration command if it detects rogue migrations.
Inspect schema:
rustyroad db schema
Run ad-hoc queries:
rustyroad query "SELECT * FROM users LIMIT 10;"
rustyroad query "SELECT COUNT(*) AS total_users FROM users;"
RustyRoad includes an MCP (Model Context Protocol) server that exposes database tools to AI agents like OpenCode, Claude, etc. This prevents agents from using raw psql commands or connecting to the wrong database.
rustyroad_query - Execute SQL queriesrustyroad_schema - Get database schemarustyroad_migrate - Run migrationsrustyroad_migration_generate - Create new migrationsrustyroad_config - View configurationrustyroad_convert_migrations - Fix rogue migrationsRegister with OpenCode:
rustyroad-mcp --register
Or manually add to ~/.config/opencode/opencode.json:
{
"mcp": {
"rustyroad": {
"type": "local",
"command": ["/path/to/rustyroad-mcp"],
"enabled": true,
"environment": {
"RUSTYROAD_PROJECT_DIR": "/path/to/your/project"
}
}
}
}
RustyRoad can scaffold an optional GrapesJS editor experience:
rustyroad feature add grapesjs
You can learn more about GrapesJS at https://grapesjs.com/ and see the example project at example-grapesjs/.
example/ – a basic generated appexample-grapesjs/ – a generated app with GrapesJS enabledIf you build this repository from source on Windows and see errors about POSTGRES_LIB_PATH or libpq.lib:
POSTGRES_LIB_PATH environment variable to the directory containing libpq.lib (e.g., C:\Program Files\PostgreSQL\13\lib).cargo/config.toml in your project root:[target.'cfg(windows)']
rustflags = ["-C", "link-arg=/LIBPATH:C:\\Program Files\\PostgreSQL\\13\\lib"]
Contributions are welcome! Please see CONTRIBUTING.md.
MIT — see LICENSE.