This is an API backend. It provides HTTP API endpoints to be called from a frontend app and/or any other client apps
Install Rust
Install dependencies
cargo installcargo install sqlx-cliThis project uses sqlx.
SQLx requires having a live database for project to compile.
This may feel inconvenient at first
but it's actually very useful in development because it allows You to identify
issues with SQL queries early.
To use this feature DATABASE_URL env variable must be set.
# Run the database and apply the migrations
podman compose -f docker-compose.yml --profile=infra up -dexport DATABASE_URL=some_urlcargo runcargo testProduction builds run independently from database therefore SQLx queries must be prepared upfront. Run this command every time You make a change to the database:
cargo sqlx prepareThis will create (update) .sqlx directory with database metadata.
.sqlx directory must me checked in version control
Now You can build for production:
cargo build --releaseOptionally You can make build work offline
by setting SQLX_OFFLINE environment variable
but it's not recommended for local development
export SQLX_OFFLINE=trueunset DATABASE_URL