@@ -180,3 +180,52 @@ model work without CORS or cookie special-casing.
180180- Database provider anti-pattern → never use if/else for database types
181181- Connection pool pollution → always reset session state after benchmark operations
182182- Frontend state → use Zustand selector hooks to avoid infinite re-render loops
183+
184+ ## Cursor Cloud specific instructions
185+
186+ The dev environment runs the stack ** natively (no Docker)** : Java 25 + Maven wrapper backend,
187+ Vite frontend, and locally-installed PostgreSQL 16 + Redis. System dependencies (JDK 25,
188+ Postgres, pgvector, Redis) are baked into the VM snapshot; the startup update script only
189+ refreshes ` npm install ` . Standard commands live in [ ` CLAUDE.md ` ] ( CLAUDE.md ) — this section
190+ only covers cloud-specific, non-obvious caveats.
191+
192+ ### Services (start these each session — systemd is NOT running in the VM)
193+
194+ - ** PostgreSQL 16** (vault DB, port 5432): start with ` sudo pg_ctlcluster 16 main start ` .
195+ DB ` dba_agent ` (user/pass ` postgres ` /` postgres ` ), extensions ` vector ` + ` pg_stat_statements `
196+ enabled. ` shared_preload_libraries=pg_stat_statements ` is already set in the cluster config.
197+ - ** Redis** (cache, port 6379): start with ` sudo redis-server /etc/redis/redis.conf --daemonize yes ` .
198+ Redis degrades gracefully but the local ` .env ` points at it.
199+ - ** Backend** (port 8080, base path ` /api ` ): ` bash scripts/start-backend.sh ` (wraps
200+ ` ./mvnw spring-boot:run ` ; it strips ` SPRING_PROFILES_ACTIVE=prod ` for local runs → dev mode).
201+ - ** Frontend** (port 3000): ` npm run dev ` (Vite proxies ` /api ` → 8080).
202+ - A demo target DB ` demo_shop ` (same Postgres server, sample ` customers ` /` products ` /` orders ` )
203+ exists for exercising connection/schema features without an external database.
204+
205+ ### Non-obvious setup caveats (each cost real debugging time)
206+
207+ - ** Java 25 is mandatory** (` pom.xml ` sets ` java.version=25 ` ); the VM's default ` java ` is set
208+ to Temurin 25 via ` update-alternatives ` , and ` JAVA_HOME ` is exported in ` ~/.bashrc ` .
209+ - ** ` .env ` is loaded by ` source ` in ` scripts/start-backend.sh ` , which runs under ` set -e ` .**
210+ Dotted keys like ` spring.data.redis.host=... ` make bash abort the whole script with
211+ "command not found". Use Spring relaxed-binding UPPERCASE env names instead
212+ (e.g. ` SPRING_DATA_REDIS_HOST ` ). This is why the local ` .env ` avoids dotted keys.
213+ - ** ` ENCRYPTION_KEYS ` must be set, not just ` ENCRYPTION_KEY ` .** ` application.properties `
214+ hardcodes ` ENCRYPTION_KEYS=${ENCRYPTION_KEYS:} ` ; with the OS env var unset this is a
215+ circular placeholder reference that fails ` EncryptionService ` bean creation at boot. The
216+ local ` .env ` sets ` ENCRYPTION_KEYS=<id>:<base64key> ` matching ` ENCRYPTION_KEY_ID ` .
217+ - ** ` SECURITY_AUTH_ENABLED=false ` ** (set in ` .env ` ) enables the dev auto-admin bypass, so the
218+ web UI needs no login. Auth defaults to ON in every profile otherwise (there is no
219+ ` admin/admin ` ); a real login needs the localhost admin-bootstrap flow (see README).
220+ - ** The ` scheduled_tasks ` table and the ` vector ` /` pg_stat_statements ` extensions** come from
221+ ` docker/postgres/init/*.sql ` . In the native (non-Docker) setup those were applied by hand;
222+ they persist in the snapshot. If you ever recreate the vault DB, re-apply
223+ ` docker/postgres/init/*.sql ` or db-scheduler logs ` relation "scheduled_tasks" does not exist ` .
224+ - ** LLM is unconfigured by default** (no key shipped). The backend boots fine and non-AI
225+ features (connections, schema browsing, SQL editor) work; chat/dashboards/brain throw
226+ ` LlmNotConfiguredException ` until ` DEEPSQL_CHAT_* ` is set in ` .env ` .
227+ - ** Before running backend tests that boot the Spring context** (e.g. ` ApiSmokeTest ` ), stop
228+ the running backend first — both use ` ddl-auto=update ` on the same ` dba_agent ` DB and can
229+ deadlock on an ` ALTER TABLE ` . Test env vars are documented in ` CLAUDE.md ` (Testing).
230+ - ` npm run lint ` currently reports many pre-existing warnings/errors in the repo; that is the
231+ baseline, not a setup failure.
0 commit comments