The one you did not ask for, and the one you already had.
The dependency is the declaration
An app that imports a driver gets a database. Nothing else is required — no
config, no dashboard step, no connection string.
const { Pool } = require("pg");const pool = new Pool({ connectionString: process.env.DATABASE_URL });
Ship that and the build says:
Provision postgres (via pg)Provisioning Postgres…Provisioned Postgres database xf4u7Database isolated — this app connects as app_xf4u7 and no other app can reach itStored DATABASE_URL, POSTGRES_PASSWORD, PGPASSWORD… in Secret Manager
Isolation
Each app connects as its own role, app_<slug>. No app can reach another app’s
data, and this is enforced at the database rather than by convention.
Migrations
Put them in release, which runs once per deploy, before any traffic:
{ "release": "npx prisma migrate deploy" }
Never fold a migration into start. It re-runs on every cold start and every
scale-out instance, concurrently.
Looking at the data
bay db <app> # tables, with row countsbay db <app> users --limit 50bay db <app> --sql "select count(*) from users"
One read-only statement at a time. The CLI is for looking, not for migrating.
urlFrom names a secret, not a URL. Bay provisions nothing, touches nothing,
and only needs to know that a value exists under that name and reached the
revision.
Deleting an app
bay delete <app> --yes
The database and the bucket are kept. The data outlives the app on purpose.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Bay","description":"Ship anything to a live URL in one command.","colors":{"primary":"#0B5E38","light":"#57B283","dark":"#0B5E38"},"logo":{"light":"https://mintcdn.com/bay/Bjkx70zr19SLX1DO/logo/mark.svg?fit=max\u0026auto=format\u0026n=Bjkx70zr19SLX1DO\u0026q=85\u0026s=22bd18d5ef16e882f0ffdd3a44640ff6","dark":"https://mintcdn.com/bay/Bjkx70zr19SLX1DO/logo/mark-white.svg?fit=max\u0026auto=format\u0026n=Bjkx70zr19SLX1DO\u0026q=85\u0026s=1c21993066ef93e96d7915b9ca7bff74","href":"https://thebay.cloud"},"favicon":"https://mintcdn.com/bay/Bjkx70zr19SLX1DO/logo/favicon.svg?fit=max\u0026auto=format\u0026n=Bjkx70zr19SLX1DO\u0026q=85\u0026s=8e27fb357ed19c32a70a906aedf4df83","navbar":{"links":[{"href":"https://github.com/thebaycloud/bay/issues","label":"Issues"}],"primary":{"type":"button","label":"Open the dashboard","href":"https://app.supersonic.cv"}},"footer":{"socials":{"github":"https://github.com/thebaycloud/bay","website":"https://thebay.cloud"}},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Templates","icon":"cubes","href":"https://thebay.cloud/templates"},{"anchor":"Changelog","icon":"clock-rotate-left","href":"https://thebay.cloud/changelog"},{"anchor":"GitHub","icon":"github","href":"https://github.com/thebaycloud/bay"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"bay","hasAudioNarration":false,"actualSubdomain":"bay","customDomains":["docs.thebay.cloud"],"gitSource":{"type":"github","owner":"thebaycloud","repo":"bay","deployBranch":"main","contentDirectory":"apps/docs","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a8daefcad09dc33d39ad71a","clientVersion":"0.0.4286","searchFilterCounts":[{"language":"default","tag":"Documentation","count":14},{"language":"default","tag":"CLI","count":8},{"language":"default","tag":"Reference","count":8},{"language":"default","tag":"Shipping","count":7},{"language":"default","tag":"Configuration","count":4},{"language":"default","tag":"Start here","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"guides/databases","slug":"/guides/databases","pageMetadata":{"title":"Databases","description":"The one you did not ask for, and the one you already had.","href":"/guides/databases"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"The one you did not ask for, and the one you already had.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`the-dependency-is-the-declaration`,children:`The dependency is the declaration`}),`\n`,_jsx(_components.p,{children:`An app that imports a driver gets a database. Nothing else is required — no\nconfig, no dashboard step, no connection string.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`Pool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"pg\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` pool`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Pool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`connectionString:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`DATABASE_URL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Ship that and the build says:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`6`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Provision postgres (via pg)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Provisioning Postgres…`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Provisioned Postgres database xf4u7`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Database isolated — this app connects as app_xf4u7 and no other app can reach it`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Stored DATABASE_URL, POSTGRES_PASSWORD, PGPASSWORD… in Secret Manager`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`isolation`,children:`Isolation`}),`\n`,_jsxs(_components.p,{children:[`Each app connects as its own role, `,_jsx(_components.code,{children:`app_\u003cslug>`}),`. No app can reach another app’s\ndata, and this is enforced at the database rather than by convention.`]}),`\n`,_jsx(Heading,{level:`2`,id:`migrations`,children:`Migrations`}),`\n`,_jsxs(_components.p,{children:[`Put them in `,_jsx(_components.code,{children:`release`}),`, which runs once per deploy, before any traffic:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"release\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"npx prisma migrate deploy\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Never fold a migration into `,_jsx(_components.code,{children:`start`}),`. It re-runs on every cold start and every\nscale-out instance, concurrently.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`looking-at-the-data`,children:`Looking at the data`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bay`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` db`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`ap`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # tables, with row counts`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bay`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` db`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`ap`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` users`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --limit`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bay`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` db`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`ap`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --sql`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"select count(*) from users\"`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`One read-only statement at a time. The CLI is for looking, not for migrating.`}),`\n`,_jsx(Heading,{level:`2`,id:`keeping-the-database-you-already-have`,children:`Keeping the database you already have`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"resources\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"database\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"external\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"engine\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"postgres\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"urlFrom\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"DATABASE_URL\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bay`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` env`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` my-app`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` set`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` DATABASE_URL=postgresql://...`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`urlFrom`}),` names a `,_jsx(_components.strong,{children:`secret`}),`, not a URL. Bay provisions nothing, touches nothing,\nand only needs to know that a value exists under that name and reached the\nrevision.`]}),`\n`,_jsx(Heading,{level:`2`,id:`deleting-an-app`,children:`Deleting an app`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bay`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` delete`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`ap`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --yes`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The database and the bucket are kept. The data outlives the app on purpose.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Databases","description":"The one you did not ask for, and the one you already had.","href":"/guides/databases"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The dependency is the declaration","slug":"the-dependency-is-the-declaration","depth":2,"children":[]},{"title":"Isolation","slug":"isolation","depth":2,"children":[]},{"title":"Migrations","slug":"migrations","depth":2,"children":[]},{"title":"Looking at the data","slug":"looking-at-the-data","depth":2,"children":[]},{"title":"Keeping the database you already have","slug":"keeping-the-database-you-already-have","depth":2,"children":[]},{"title":"Deleting an app","slug":"deleting-an-app","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"bay","siteName":"Bay","title":"Databases - Bay","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-25T14:46:22.703Z","originalFileLocation":"guides/databases.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"The one you did not ask for, and the one you already had.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Bay\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Databases - Bay\">\u003cmeta data-mint-head property=\"og:description\" content=\"The one you did not ask for, and the one you already had.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Bay\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.thebay.cloud/guides/databases\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://bay.mintlify.site/_mintlify/api/og/v2?division=Shipping\u0026amp;title=Databases\u0026amp;description=The+one+you+did+not+ask+for%2C+and+the+one+you+already+had.\u0026amp;theme=e468f659b65e06e85e08660c\u0026amp;signature=b8cb6e79e1b14ca7bc41eded80b649f77376994ff268d70970cc4c4b46d59b0e\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Databases - Bay\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"The one you did not ask for, and the one you already had.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://bay.mintlify.site/_mintlify/api/og/v2?division=Shipping\u0026amp;title=Databases\u0026amp;description=The+one+you+did+not+ask+for%2C+and+the+one+you+already+had.\u0026amp;theme=e468f659b65e06e85e08660c\u0026amp;signature=b8cb6e79e1b14ca7bc41eded80b649f77376994ff268d70970cc4c4b46d59b0e\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/bay/rgl_BGb6S1yPy8nc/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Bay\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0B5E38\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.thebay.cloud/guides/databases\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/databases.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.thebay.cloud/#organization\",\"name\":\"Bay\",\"url\":\"https://docs.thebay.cloud\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/bay/Bjkx70zr19SLX1DO/logo/mark.svg?fit=max\u0026auto=format\u0026n=Bjkx70zr19SLX1DO\u0026q=85\u0026s=22bd18d5ef16e882f0ffdd3a44640ff6\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.thebay.cloud#website\",\"name\":\"Bay\",\"url\":\"https://docs.thebay.cloud\",\"publisher\":{\"@id\":\"https://docs.thebay.cloud/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.thebay.cloud/guides/databases#webpage\",\"url\":\"https://docs.thebay.cloud/guides/databases\",\"name\":\"Databases\",\"description\":\"The one you did not ask for, and the one you already had.\",\"dateModified\":\"2026-08-25T14:46:22.703Z\",\"isPartOf\":{\"@id\":\"https://docs.thebay.cloud#website\"},\"breadcrumb\":{\"@id\":\"https://docs.thebay.cloud/guides/databases#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.thebay.cloud/guides/databases#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Shipping\",\"item\":\"https://docs.thebay.cloud/guides/authoring\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Databases\",\"item\":\"https://docs.thebay.cloud/guides/databases\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.thebay.cloud/guides/databases#article\",\"headline\":\"Databases\",\"name\":\"Databases\",\"description\":\"The one you did not ask for, and the one you already had.\",\"url\":\"https://docs.thebay.cloud/guides/databases\",\"mainEntityOfPage\":{\"@id\":\"https://docs.thebay.cloud/guides/databases#webpage\"},\"dateModified\":\"2026-08-25T14:46:22.703Z\",\"publisher\":{\"@id\":\"https://docs.thebay.cloud/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.thebay.cloud#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Bay\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Bay\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/guides/databases.md","siteName":"Bay","nav":{"global":{"anchors":[{"anchor":"Templates","icon":"cubes","href":"https://thebay.cloud/templates"},{"anchor":"Changelog","icon":"clock-rotate-left","href":"https://thebay.cloud/changelog"},{"anchor":"GitHub","icon":"github","href":"https://github.com/thebaycloud/bay"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Start here","pages":[{"title":"Bay","sidebarTitle":"Introduction","mode":"wide","href":""},{"title":"Quickstart","href":"/quickstart"},{"title":"Concepts","href":"/concepts"}]},{"group":"Shipping","pages":[{"title":"Ship your first app","href":"/guides/authoring"},{"title":"Shipping from GitHub","href":"/guides/from-github"},{"title":"Secrets","description":"The only thing Bay ever asks you for.","href":"/guides/secrets"},{"title":"Databases","href":"/guides/databases"},{"title":"Domains","description":"The address you get, and the one you bring.","href":"/guides/domains"},{"title":"Who can open it","href":"/guides/sharing"},{"title":"When it breaks","href":"/guides/when-it-breaks"}]},{"group":"Configuration","pages":[{"title":"supersonic.json","href":"/configuration/overview"},{"title":"Services","href":"/configuration/services"},{"title":"Resources","href":"/configuration/resources"},{"title":"Processes","href":"/configuration/processes"}]}]},{"tab":"CLI","pages":[{"title":"CLI","href":"/cli/overview"}]}]},"basePath":"","title":"Databases - Bay","deploymentId":"dpl_G6E2ur2Zjq51xGTVZPSFXsWoTxCu","buildId":"dpl_G6E2ur2Zjq51xGTVZPSFXsWoTxCu","dynamics":[],"chunks":[]}