Ambi is a Rust-based web service that presents a basic HTML5 + JavaScript frontend and an HTMX frontend to display real time ambient room conditions like temperature, humidity, pressure, air quality, dust concentration, etc. It uses the Rocket web framework + Server Sent Events (SSE) to push updates to the client with no page refresh needed.
- First install the DB ORM Diesel CLI, then proceed to setting up the Postgresql DB
Setting up the Postgresql DB:
DATABASE_URL=postgres://postgres:postgres@localhost/ambi_rs_dev diesel setup
Now run the DB migrations to complete prepping the DB:
DATABASE_URL=postgres://postgres:postgres@localhost/ambi_rs_dev diesel migration run
The Ambi repository makes use of several Git hooks to ensure that code quality standards are met and consistent. To automatically configure these hooks for your local workspace, you can run the following:
./scripts/create-git-hooks
This will create symlinks to the Git hooks, preserving any hooks that you may have already configured.
To run:
ROCKET_DATABASES='{ambi_rs_dev={url="postgres://postgres:postgres@localhost/ambi_rs_dev"}}' cargo run
Or with Docker:
docker compose up -d