loco-rs / loco
- ΡΡΠ±Π±ΠΎΡΠ°, 23 Π΄Π΅ΠΊΠ°Π±ΡΡ 2023β―Π³. Π² 00:00:09
π π¦ The one-person framework for Rust for side-projects and startups
Loco is "Rust on Rails".
Loco is strongly inspired by Rails. If you know Rails and Rust, you'll feel at home. If you only know Rails and new to Rust, you'll find Loco refreshing. We do not assume you know Rails.
To work with Loco, you need to know Rust to a beginner-moderate level. There are no crazy lifetime twisters and most of the development will be linear: request handling, workers, tasks, etc.
$ cargo install loco-cli
Now you can create your new app (choose "Saas app").
$ loco new
β― App name? [myapp]:
β― Saas app (with DB and user auth)
Stateless service (minimal, no db)
π Loco app generated successfully in:
myapp
loco:loco
and a db named loco_app
.
You can use Docker to run a Postgres instance:
$ docker run -d -p 5432:5432 -e POSTGRES_USER=loco -e POSTGRES_DB=loco_app -e POSTGRES_PASSWORD="loco" postgres:15.3-alpine
Now cd
into your myapp
and start your app:
$ cd myapp
$ cargo loco start
Finished dev [unoptimized + debuginfo] target(s) in 21.63s
Running `target/debug/myapp start`
:
:
:
controller/app_routes.rs:203: [Middleware] Adding log trace id
β β
β β
β β β β ββ
β βββ
β β β βββββ
βββ
βββββββ βββββββββ βββββββββββ βββββββββ βββ
ββββββ βββββ βββ βββββ βββ βββββ βββ ββ
ββββββ βββββ βββ βββββ βββ βββββ βββ βββ
ββββββ βββββ βββ βββββ βββββ βββ βββββ
ββββββ βββββ βββ βββββ βββ βββββ βββ βββββ
ββββββ βββββ βββ ββββ βββ βββββ βββ βββββ
ββββββ ββββββββββ ββββββββββ ββββββββββ βββ
βββββββββββββββββββββββββββββββββββββββ
started on port 3000
Loco is feature complete, but features are still being added rapidly.