added api logic, vitest, minimal testing ui

This commit is contained in:
2025-11-15 23:26:57 -06:00
parent f4160b91db
commit 4eae966f96
95 changed files with 14155 additions and 469 deletions

View File

@@ -1,11 +1,5 @@
# docker-compose.yml (root)
version: "3.9"
x-env: &api_env
NODE_ENV: production
PORT: "8080"
DATABASE_URL: postgres://app:app@postgres:5432/skymoney
services:
postgres:
image: postgres:15
@@ -15,55 +9,53 @@ services:
POSTGRES_PASSWORD: app
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app -d skymoney"]
interval: 5s
timeout: 3s
retries: 10
api:
build:
context: ./api
dockerfile: Dockerfile
environment:
<<: *api_env
NODE_ENV: production
PORT: "8080"
DATABASE_URL: postgres://app:app@postgres:5432/skymoney
CORS_ORIGIN: http://localhost:5173
depends_on:
- postgres
expose:
- "8080"
ports:
- "8081:8080"
restart: unless-stopped
# OPTIONAL: build web and serve with Caddy
web:
# If you want Compose to build your Vite app automatically:
image: node:20-alpine
working_dir: /app
volumes:
- ./web:/app
- webdist:/build-out
command: >
sh -c "npm ci && npm run build && rm -rf /build-out/* && cp -r dist/* /build-out/"
environment:
# If your web build needs an API base url:
- VITE_API_BASE=/api
depends_on:
- api
# This runs once at up; to rebuild, `docker compose up -d --build web`
restart: "no"
healthcheck:
# runs *inside* the container; port 8080 is the app's internal port
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/health || exit 1"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
caddy:
image: caddy:2
ports:
- "80:80"
- "443:443"
- "8080:80"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddydata:/data
- caddyconfig:/config
# Serve built web files (if using web service above)
- webdist:/srv/site
- ./Caddyfile.dev:/etc/caddy/Caddyfile:ro
- ./web/dist:/srv/site:ro
depends_on:
- api
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost/ || exit 1"]
interval: 10s
timeout: 3s
retries: 10
volumes:
pgdata:
caddydata:
caddyconfig:
webdist: