Skip to content

MikeMoolenaar/RATH-stack

Repository files navigation

RATH stack demo

Demo application for the RATH stack (Rust + Axum + Turso + HTMX).

App runs at https://rust-api-plus-htmx.fly.dev. It can take up to 20 seconds to respond for the first request, because the Turso db and Fly.io app automaticly scale down to 0.

Technologies

Getting started

First, create a Turso account and get the DB url + Auth token.

Setting up:

mv .env.example .env
# Edit .env file and set the correct values

cd static
npm install
npm install -g tailwindcss

# Copies js files from node_modules into the /static/dist folder
bash init.sh 

Running the app:

cargo run
# Or run when any non-static file (-i) changes and clear console (-c)
cargo watch -c -x run -i /static

# Run tailwind in another window
cd static
npm run tailwind

Handy commands

You can execute prepush.sh to fix lint and format.

Run lint

# Check
cargo clippy -- -A clippy::needless_return
# Fix
cargo clippy --allow-dirty --fix -- -A clippy::needless_return

Run formatter

cargo +nightly fmt -- src/routes.rs

Fly commands

fly machine start
fly machine stop

fly deploy # Deploy using remote runner
sudo fly deploy --local-only # Deploy using local docker runner