# Milestone 01 — Infrastructure and Database Foundation ## Reference Read `plans/wedding-bootstrap-plan.md` first. It is the source of truth for architecture, naming, schema intent, and constraints. ## Goal Create the local/runtime foundation for the app: dependencies, Docker Compose services, environment template, Kysely database client, SQL migration script, and initial schema. ## Scope Implement only: - Required dependencies for PostgreSQL, Kysely, migrations, validation, auth/upload placeholders where needed. - `docker-compose.yml` with PostgreSQL and MinIO services, plus MinIO bucket initialization. - `.env.example` with all required bootstrap variables. - Typed config helper. - Kysely PostgreSQL client. - Node `.mjs` SQL migration runner under `scripts/`. - Initial pure SQL migration for the core schema. - Initial database typings, either hand-written or generated if practical. - Package scripts needed to run migrations. ## Non-goals Do not implement: - Google auth. - `/admin` pages. - shadcn UI setup unless strictly required by project initialization. - Guest RSVP pages. - MinIO upload endpoints. - Presigned upload logic. - Song/toast/message forms. - Final visual design. ## Required constraints - Use PostgreSQL. - Use Kysely. Do not add Prisma, Drizzle, TypeORM, Sequelize, or another ORM. - Keep SQL schema aligned with `wedding-bootstrap-plan.md`. - `invitations.language` is required from the first migration. - `invitation_members.attending` is the source of truth for attendance. - Do not duplicate attendance status on `invitation_responses`. - `photo_uploads.invitation_id` must be unique to enforce one photo per invitation. ## Implementation tasks - Add dependencies: - `kysely` - `pg` - `zod` - `nanoid` - AWS S3 packages if useful to install now - Add dev dependencies: - `@types/pg` - `kysely-codegen` if used - Add `.env.example`. - Add `docker-compose.yml` with: - `postgres` - `minio` - `minio-init` - Add `lib/config.ts` for server-side env parsing. - Add `lib/db/client.ts`. - Add `scripts/migrate-sql.mjs`. - Add `migrations/0001_initial_schema.sql`. - Add `lib/db/types.ts`. - Add package scripts: - `db:migrate` - optionally `db:generate` if using `kysely-codegen` ## Initial tables Create: - `invitations` - `invitation_members` - `invitation_responses` - `photo_uploads` - `song_requests` - `toast_requests` - `guest_messages` - optionally `admin_audit_events` ## Verification Run: ```bash docker compose up -d postgres minio minio-init npm run db:migrate npm run lint npm run build ``` If Docker is unavailable in the execution environment, still implement the files and clearly report that Docker verification could not be run. ## Acceptance criteria - Docker Compose defines working PostgreSQL and MinIO services. - `.env.example` documents all required variables. - Migrations create the planned schema. - The Node `.mjs` migration script can run pure SQL files against PostgreSQL. - The app still passes lint/build. - No future milestone features were implemented.