--- name: Phase 1 task 1.1 scaffold decisions description: Implementation decisions made during Phase 1 task 1.1 (project scaffold) for trm/directus type: project --- # Phase 1 task 1.1 — project scaffold decisions **Why:** These are non-obvious deviations from the task spec that future task implementers need to know. - **entrypoint.sh calls `node cli.js bootstrap` then `exec pm2-runtime start /directus/ecosystem.config.cjs`**, not `exec /directus/cli.js start`. The `bootstrap` step is idempotent and required for admin user creation. pm2-runtime provides crash recovery. - **`postgresql16-client` is pre-installed in the Dockerfile via `apk add --no-cache postgresql16-client`**. This allows task 1.2's `apply-db-init.sh` to use `psql` without adding it later. Alpine 3.20 uses version-specific package names (no generic `postgresql-client`). - **Volume mount for db service is `/pgdata`**, not `/var/lib/postgresql/data`. The `timescaledb-ha` image sets `PGDATA=/pgdata`. - **`directus-uploads` named volume** maps to `/directus/uploads` in the directus service. No uploads use-case in Phase 1, but declared now to avoid volume-mount pain later. - **`KEY` and `SECRET` in compose have no default** — blank env var means Directus will fail loudly at boot, which is the right behavior. - **`packageManager` field omitted from package.json** because the local pnpm version (10.x) doesn't match what the task spec implied (9.x). pnpm 10 is backward-compatible. - **Dockerfile is single-stage in Phase 1.** Multi-stage build with a Node builder for extensions lands in Phase 5. **How to apply:** Read this before implementing tasks 1.2–1.7 to avoid re-discovering these facts.