- Go backend: Echo v4 + pgxpool + embedded golang-migrate; health endpoints at /health and /api/v1/health; TDD health handler (httptest) - Vue 3 frontend: Vite + TypeScript + Pinia + vue-router + Tailwind CSS v4; TDD HelloWorld component (@vue/test-utils + jsdom + vitest) - Infra: docker-compose postgres:16 with env-interpolated credentials; Makefile with dev-db health-wait loop, migrate-up/down, run, test, fmt - embed.FS migrations at backend/migrations/ (000001 no-op baseline) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1012 B
Makefile
41 lines
1012 B
Makefile
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 .
|