diff --git a/backend/.env.example b/backend/.env.example new file mode 100644 index 0000000..64a9610 --- /dev/null +++ b/backend/.env.example @@ -0,0 +1,8 @@ +# Postgres connection string used by the web + worker binaries (and `just migrate`). +DATABASE_URL=postgres://xtablo:xtablo@localhost:5432/xtablo?sslmode=disable + +# HTTP port for cmd/web. +PORT=8080 + +# Environment selector: "development" enables the slog text handler; "production" switches to JSON. +ENV=development diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..894176d --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,24 @@ +# Local environment files (only .env.example is committed) +.env +.env.local + +# Bootstrap-downloaded CLIs and Tailwind binary (re-created by `just bootstrap`) +bin/ +!bin/.gitkeep + +# air rebuild output +tmp/ + +# Tailwind-compiled CSS (re-created by `just generate` / `just styles-watch`) +static/tailwind.css + +# HTMX bootstrap-downloaded by `just bootstrap` (never committed; the justfile is the single +# authoritative source for the pinned HTMX version — see CONTEXT D-10) +static/htmx.min.js + +# templ-generated Go files (regenerate via `templ generate` — Research Pitfall 1) +*_templ.go + +# sqlc-generated code (regenerate via `sqlc generate`); keep the .gitkeep +internal/db/sqlc/*.go +!internal/db/sqlc/.gitkeep diff --git a/backend/compose.yaml b/backend/compose.yaml new file mode 100644 index 0000000..1f5777f --- /dev/null +++ b/backend/compose.yaml @@ -0,0 +1,21 @@ +services: + postgres: + image: postgres:16-alpine + container_name: xtablo-backend-postgres + restart: unless-stopped + environment: + POSTGRES_DB: xtablo + POSTGRES_USER: xtablo + POSTGRES_PASSWORD: xtablo + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U xtablo -d xtablo"] + interval: 5s + timeout: 5s + retries: 10 + +volumes: + postgres_data: diff --git a/backend/migrations/0001_init.sql b/backend/migrations/0001_init.sql new file mode 100644 index 0000000..64cafd3 --- /dev/null +++ b/backend/migrations/0001_init.sql @@ -0,0 +1,6 @@ +-- +goose Up +-- Phase 1: no-op bootstrap migration. Real schema lands in Phase 2 (sessions/users) and Phase 3 (tablos). +SELECT 1; + +-- +goose Down +SELECT 1;