Files
osdb-1-claude-opusplan/Makefile
T
juliaandClaude Sonnet 4.6 4d28916c7b fix: address code review findings from story #01
- Makefile: -include .env (soft) so fresh clone doesn't hard-fail
- main.go: replace log.Fatalf-in-goroutine with error channel; startup
  failures now reach main goroutine so defer pool.Close() always runs
- main.go: context.WithTimeout(30s) on database.Connect to fail fast
  instead of hanging indefinitely on unreachable Postgres
- router.go: store pool on Echo context via middleware so future story
  handlers can retrieve it with c.Get("pool")
- config.go: require DATABASE_URL explicitly (log.Fatal if missing)
  instead of falling back to hardcoded credentials
- HelloWorld.test.ts: URL-aware fetch stub + afterEach restoreAllMocks;
  add flushPromises test verifying backend status renders

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 17:14:29 +02:00

42 lines
1.1 KiB
Makefile

# -include: silently skip if .env doesn't exist (e.g. fresh clone before 'cp .env.example .env')
-include .env
export
.PHONY: dev-db migrate-up migrate-down run-backend run-frontend test fmt
## dev-db: start postgres and block until healthy
dev-db:
docker compose up -d db
@echo "Waiting for Postgres to be healthy..."
@until [ "$$(docker inspect --format='{{.State.Health.Status}}' osdb-db 2>/dev/null)" = "healthy" ]; do \
echo " still starting..."; \
sleep 2; \
done
@echo "Postgres is healthy."
## migrate-up: apply all pending migrations
migrate-up:
cd backend && go run ./cmd/server migrate
## migrate-down: roll back one migration step
migrate-down:
cd backend && go run ./cmd/server migrate down
## run-backend: start the Echo API server
run-backend:
cd backend && go run ./cmd/server
## run-frontend: start the Vite dev server
run-frontend:
cd frontend && npm run dev
## test: run all backend and frontend tests
test:
cd backend && go test ./...
cd frontend && npm run test -- --run
## fmt: format all code
fmt:
cd backend && gofmt -w .
cd frontend && npx prettier --write .