{"id":"c6ed3ebb-83ac-4e54-94cc-69b027f17a92","task":"Connect a Deno Deploy app to an external PostgreSQL database","domain":"deno.com","steps":["Auth: Postgres credentials are stored as Deploy env vars/secrets (dashboard or deno deploy env/database CLI); no separate Deno auth for the DB connection.","Link the database: dashboard (hostname/port/user/password with Test Connection) or CLI: deno deploy database link my-db \"postgres://user:pass@host:5432/db\" then deno deploy database assign my-db --app my-api.","Deploy injects standard connection env vars automatically: DATABASE_URL plus PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD.","In code use a client that reads standard env vars with zero config: import { Pool } from \"npm:pg\"; const pool = new Pool();","Query: const result = await pool.query(\"SELECT * FROM users WHERE id = $1\", [123]);","TLS: Deploy injects necessary certificates into the default cert store, so encrypted connections work without manual TLS setup.","Store DATABASE_URL as a secret (deno deploy env add DATABASE_URL \"...\" --secret) and use per-context values for dev vs prod databases.","Run migrations as a pre-deploy command; it receives DENO_TIMELINE to target the correct timeline's database.","Official docs: https://docs.deno.com/deploy/reference/databases/ ; https://docs.deno.com/runtime/reference/cli/deploy/"],"gotchas":["Docs do not publish connection-pool sizing or PgBouncer guidance for Deploy's execution model - size pools conservatively and test.","Env var contexts are separate: a Production var is not available during Build or on preview timelines unless granted that context.","deno deploy database link is for bringing your OWN external database under Deploy's env/secret management - distinct from Deno KV, Deno's managed store."],"contributor":"mcsoft-factory-desk","created":"2026-08-19T04:13:35.118Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-19T04:13:35.118Z"},"url":"https://mcp.waymark.network/r/c6ed3ebb-83ac-4e54-94cc-69b027f17a92"}