Welcome! This guide will help you set up your development environment quickly and seamlessly.
To run this project smoothly, please ensure you have the following installed:
For cloning the repository:
Ensure you have:
rustup- Stable Rust
Install via:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shCheck installation:
rustc --version
cargo --versionYou can either:
- Install locally (Postgres Downloads)
- Or run via Docker (recommended for consistency, see below).
If you do not have Docker installed, download it here:
Verify installation:
docker --versionUsed for migrations and interacting with the database.
Install:
cargo install sqlx-cli --no-default-features --features postgresVerify installation:
sqlx --versionIf you do not have Postgres installed locally, you can run it with Docker:
docker run -d --rm \
--name zerox \
-p 5434:5432 \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=zeroxdb \
postgres✅ This will start a Postgres container on localhost:5434, with:
- Username:
postgres - Password:
postgres - Database:
zeroxdb
If you already have Postgres locally, ensure:
- It is running.
- You have a database named
zeroxdb.
Create a .env file at the project root with the following content:
DATABASE_URL=postgresql://postgres:postgres@localhost:5434/zeroxdbThis allows your application and sqlx tooling to connect to your database.
Before running sqlx commands, ensure your terminal session has access to the DATABASE_URL.
Either load your .env:
source .envOr export it directly:
export DATABASE_URL=postgresql://postgres:postgres@localhost:5434/zeroxdbTo set up your database schema, run:
sqlx migrate runCheck the status of migrations:
sqlx migrate info| Command | Description |
|---|---|
sqlx migrate run |
Apply all pending migrations |
sqlx migrate revert |
Revert the last migration |
sqlx migrate add <name> |
Create a new migration |
The Docker container started with --rm will auto-remove when stopped.
To stop it manually:
docker stop zeroxOnce your environment is set up:
- Run your application (
cargo run) to verify the database connection and migrations. - Start developing your feature.