docs-site/content/blog/hello-world.md
+++ title = "What if Rails was Built on Rust?" description = "Introducing Loco: a Rails-inspired Rust web framework. See how Rust can be as expressive as Ruby and how we can build a good deal of magic that Rails has with Rust." date = 2023-11-24T09:19:42+00:00 updated = 2023-11-24T09:19:42+00:00 draft = false template = "blog/page.html"
[taxonomies] authors = ["Team Loco"]
+++
<center>What if Rails was built on Rust and not Ruby?
</center>Then it would look like this:
async fn current(
auth: middleware::auth::Auth,
State(ctx): State<AppContext>,
) -> Result<Response> {
let user = users::Model::find_by_pid(&ctx.db, &auth.claims.pid).await?;
format::json(CurrentResponse::new(&user))
}
pub fn routes() -> Routes {
Routes::new().prefix("user").add("/current", get(current))
}
Loco is a Rails inspired web framework for Rust. It inlcudes almost every Rails feature with best-effort Rust ergonomics:
devise)It's full stack for real.
If you're happy with Ruby, use Rails. Don't spend time looking elsewhere because of performance -- Rails and Ruby are good enough.
But if you love Rust, you can now build companies like Rubyists have been building for ages -- use Loco.
Inspired by DHH's approach, Loco's guiding principle is above all:
The one person framework
From this single guiding principles comes everything else.
For example, one person team, or one person company:
Loco is the one person framework for indy hackers, hobbyists, and startups.
With around 20mb of a deploy binary, and 50k requests/sec - all you need is a single small/medium server, Postgres or Sqlite and an internet connection. Startups should be cheap!
Get started with Loco today!