Loco.rs (Rust) + HTMX codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.
This codebase was created to demonstrate a fully fledged fullstack application built with Loco.rs (Rust) + HTMX including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the Loco.rs (Rust) + HTMX community styleguides & best practices.
For more information on how to this works with other frontends/backends, head over to the RealWorld repo.
Loco.rs manages all the authentication, logic, database interactions and serves HTML. HTMX is used client-side to enhance the UX.
The project uses the SaaS starter which includes a User
model and authentication based on JWT.
You need:
- A local postgres instance
docker run -d -p 5555:5432 \
-e POSTGRES_USER=loco \
-e POSTGRES_DB=myapp_development \
-e POSTGRES_PASSWORD="loco" \
postgres:15.3-alpine
- A local Redis instance
docker run -p 6379:6379 -d redis redis-server
- (Optional) An Admin UI for the PostgreSQL Database
docker run --link <container name via 'docker ps'>:db -p 8080:8080 adminer
Check out your development configuration.
To configure a database , please run a local postgres database with
loco:loco
and a db named[app name]_development.
:docker run -d -p 5432:5432 -e POSTGRES_USER=loco -e POSTGRES_DB=[app name]_development -e POSTGRES_PASSWORD="loco" postgres:15.3-alpine
Now start your app:
$ 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
Check out a quick tour or the complete guide.