From db6183405e2d601858689c0f073d2409d0fb6b59 Mon Sep 17 00:00:00 2001 From: Anders Olsson Date: Tue, 2 Jun 2026 00:51:26 +0200 Subject: [PATCH] chore: add local Postgres, justfile, and env example Co-Authored-By: Claude Sonnet 4.6 --- .env.example | 5 +++++ .gitignore | 1 + docker-compose.yml | 14 ++++++++++++++ justfile | 20 ++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 .env.example create mode 100644 docker-compose.yml create mode 100644 justfile diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..55b822b --- /dev/null +++ b/.env.example @@ -0,0 +1,5 @@ +# Connection string for local development and tests. +# The role must be allowed to CREATE DATABASE (sqlx::test provisions temp DBs). +DATABASE_URL=postgres://postgres:postgres@localhost:5432/cms_dev +BIND_ADDR=0.0.0.0:8080 +APP_NAME=Collection Management System diff --git a/.gitignore b/.gitignore index ea8c4bf..fedaa2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +.env diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6fd7983 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + postgres: + image: postgres:17 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: cms_dev + ports: + - "5432:5432" + volumes: + - pgdata:/var/lib/postgresql/data + +volumes: + pgdata: diff --git a/justfile b/justfile new file mode 100644 index 0000000..c204c38 --- /dev/null +++ b/justfile @@ -0,0 +1,20 @@ +set dotenv-load + +# Run the server (reads .env) +run: + cargo run -p server + +# Run the full test suite +test: + cargo test --workspace + +# Format with the nightly toolchain +fmt: + cargo +nightly fmt + +# Lint, treating warnings as errors +lint: + cargo clippy --workspace --all-targets -- -D warnings + +# Format, lint, and test +check: fmt lint test