René's URL Explorer Experiment


Title: feat(db): resolve DATABASE_URL per role (DATABASE_URL_ with fallback) by TheodoreSpeaks · Pull Request #5276 · simstudioai/sim · GitHub

Open Graph Title: feat(db): resolve DATABASE_URL per role (DATABASE_URL_ with fallback) by TheodoreSpeaks · Pull Request #5276 · simstudioai/sim

X Title: feat(db): resolve DATABASE_URL per role (DATABASE_URL_ with fallback) by TheodoreSpeaks · Pull Request #5276 · simstudioai/sim

Description: Summary @sim/db now resolves its connection URL per runtime role: DATABASE_URL_ (e.g. DATABASE_URL_TRIGGER) when set, falling back to the existing DATABASE_URL — same for the replica (DATABASE_REPLICA_URL_). No-op until the keyed vars are populated — with none set, behavior is identical to today. This is the inert, reversible switch for the in-progress connection-pool-isolation work (separate Postgres users + dedicated PgBouncers per surface). New shared helper resolveDbUrl(base, role) in packages/db/connection-url.ts, consumed by both packages/db/db.ts (primary + replica) and the realtime socketDb (apps/realtime/.../operations.ts) — so both realtime pools land on the realtime URL when set. Role is the existing SIM_DB_ROLE selector (already merged), so the URL and the pool-size profile always agree. Declared the new optional env vars in the app + realtime env schemas (typing/docs; @sim/db reads process.env directly). How the cutover works Provision the users + bouncers (inert), ship this (no-op), then flip one surface at a time by populating its keyed var + restart; roll back by clearing it (falls back to DATABASE_URL / the old pooler). Trigger reads DATABASE_URL_TRIGGER from its trigger.dev env. Type of Change New feature (infra plumbing; inert until configured) Testing Tested manually. New packages/db unit tests for resolveDbUrl (keyed-preferred, base-fallback, undefined-when-unset, replica variant, role uppercasing). bun run lint, check:api-validation:strict, @sim/db vitest (24/24), and packages/db + @sim/realtime typechecks all pass. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary @sim/db now resolves its connection URL per runtime role: DATABASE_URL_<ROLE> (e.g. DATABASE_URL_TRIGGER) when set, falling back to the existing DATABASE_URL — same for the replica (...

X Description: Summary @sim/db now resolves its connection URL per runtime role: DATABASE_URL_&lt;ROLE&gt; (e.g. DATABASE_URL_TRIGGER) when set, falling back to the existing DATABASE_URL — same for the r...

Opengraph URL: https://github.com/simstudioai/sim/pull/5276

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:9434fd45-8c59-f97c-17d3-e7b397d9a81c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id80FA:283A10:40768D:5C55C9:6AFB3C9C
html-safe-noncebc1aa153e79ff520ce4eb5839db7c1557d27dae0f7e28a78e2292128ad96f9ea
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEZBOjI4M0ExMDo0MDc2OEQ6NUM1NUM5OjZBRkIzQzlDIiwidmlzaXRvcl9pZCI6IjQzOTY0NDQ0NDcxNDc3Njg5ODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac1ae8abd5463943b07c111393c27c115c7587b3ada5d86919e3962c210bc36121
hovercard-subject-tagpull_request:3959889176
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5276/files
twitter:imagehttps://avatars.githubusercontent.com/u/19564703?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/19564703?s=400&v=4
og:image:altSummary @sim/db now resolves its connection URL per runtime role: DATABASE_URL_<ROLE> (e.g. DATABASE_URL_TRIGGER) when set, falling back to the existing DATABASE_URL — same for the replica (...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None2169b0dfbef67ed6b128074a5ed45bb7d5d1859783b10178b09a7765ad5f3693
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3b4fc8df5ef1c6757e733a23e6b81b6725021823
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5276/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5276%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5276%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/5276/files
Reloadhttps://github.com/simstudioai/sim/pull/5276/files
Reloadhttps://github.com/simstudioai/sim/pull/5276/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests199 (199)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
TheodoreSpeakshttps://github.com/TheodoreSpeaks
staginghttps://github.com/simstudioai/sim/tree/staging
feat/db-url-per-rolehttps://github.com/simstudioai/sim/tree/feat/db-url-per-role
Conversation 8 https://github.com/simstudioai/sim/pull/5276
Commits 2 https://github.com/simstudioai/sim/pull/5276/commits
Checks 15 https://github.com/simstudioai/sim/pull/5276/checks
Files changed https://github.com/simstudioai/sim/pull/5276/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5276/files
feat(db): resolve DATABASE_URL per role (DATABASE_URL_ with fallback) https://github.com/simstudioai/sim/pull/5276/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/5276/files
98c5fdd feat(db): resolve DATABASE_URL per role (DATABASE_URL_ with fal… TheodoreSpeaks Jun 30, 2026 https://github.com/simstudioai/sim/pull/5276/commits/98c5fdd26d37586c22050494e3bf976fae153b51
6cdb5a6 fix(db): pin realtime process to SIM_DB_ROLE=realtime so both pools s… TheodoreSpeaks Jun 30, 2026 https://github.com/simstudioai/sim/pull/5276/commits/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9
Clear filters https://github.com/simstudioai/sim/pull/5276/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5276/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5276/files
package.json https://github.com/simstudioai/sim/pull/5276/files#diff-39ff86d41d679c864ed1518224d10777fa42b9f445af5229d9703d581dc2ccd1
bootstrap.ts https://github.com/simstudioai/sim/pull/5276/files#diff-a8695e8a8a2a66c24038313f641aa1300721cabcb55a842fc46c99dc728241f5
operations.ts https://github.com/simstudioai/sim/pull/5276/files#diff-e8428fa80ec5afb5442d2c399ae8dccd54ba450b45cbaae13a15c833911be725
env.ts https://github.com/simstudioai/sim/pull/5276/files#diff-5c65306e6030967d7ca24f19aa8053b848025339b0bbdbc55f7b820bf246f478
env.ts https://github.com/simstudioai/sim/pull/5276/files#diff-7db3fc610ff89cf819c4eb69b43ec37ae18530e1861f6c322faeb62f8f48f298
connection-url.test.ts https://github.com/simstudioai/sim/pull/5276/files#diff-78ba6a086f6c0fe916517daafb0607011e52fdda2659a4c6112a5cd81fb785b0
connection-url.ts https://github.com/simstudioai/sim/pull/5276/files#diff-2632434eab5afbc07040d605428a620be68a667a645644f641aa7dec5dc2a2d4
db.ts https://github.com/simstudioai/sim/pull/5276/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
index.ts https://github.com/simstudioai/sim/pull/5276/files#diff-bc34b154a271f644e6cf25b93564ea4b02bb3999f0a5899bbff1e8240cd698be
https://github.com/simstudioai/sim/blob/staging/.github/CODEOWNERS#L36
apps/realtime/package.jsonhttps://github.com/simstudioai/sim/pull/5276/files#diff-39ff86d41d679c864ed1518224d10777fa42b9f445af5229d9703d581dc2ccd1
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/apps/realtime/package.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5276/files#diff-39ff86d41d679c864ed1518224d10777fa42b9f445af5229d9703d581dc2ccd1
https://github.com/simstudioai/sim/pull/5276/files#diff-39ff86d41d679c864ed1518224d10777fa42b9f445af5229d9703d581dc2ccd1
apps/realtime/src/bootstrap.tshttps://github.com/simstudioai/sim/pull/5276/files#diff-a8695e8a8a2a66c24038313f641aa1300721cabcb55a842fc46c99dc728241f5
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/apps/realtime/src/bootstrap.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5276/files#diff-a8695e8a8a2a66c24038313f641aa1300721cabcb55a842fc46c99dc728241f5
apps/realtime/src/database/operations.tshttps://github.com/simstudioai/sim/pull/5276/files#diff-e8428fa80ec5afb5442d2c399ae8dccd54ba450b45cbaae13a15c833911be725
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/apps/realtime/src/database/operations.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5276/files#diff-e8428fa80ec5afb5442d2c399ae8dccd54ba450b45cbaae13a15c833911be725
https://github.com/simstudioai/sim/pull/5276/files#diff-e8428fa80ec5afb5442d2c399ae8dccd54ba450b45cbaae13a15c833911be725
https://github.com/simstudioai/sim/pull/5276/files#diff-e8428fa80ec5afb5442d2c399ae8dccd54ba450b45cbaae13a15c833911be725
Please reload this pagehttps://github.com/simstudioai/sim/pull/5276/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5276/files
https://github.com/simstudioai/sim/pull/5276/files#diff-e8428fa80ec5afb5442d2c399ae8dccd54ba450b45cbaae13a15c833911be725
apps/realtime/src/env.tshttps://github.com/simstudioai/sim/pull/5276/files#diff-5c65306e6030967d7ca24f19aa8053b848025339b0bbdbc55f7b820bf246f478
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/apps/realtime/src/env.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5276/files#diff-5c65306e6030967d7ca24f19aa8053b848025339b0bbdbc55f7b820bf246f478
https://github.com/simstudioai/sim/pull/5276/files#diff-5c65306e6030967d7ca24f19aa8053b848025339b0bbdbc55f7b820bf246f478
apps/sim/lib/core/config/env.tshttps://github.com/simstudioai/sim/pull/5276/files#diff-7db3fc610ff89cf819c4eb69b43ec37ae18530e1861f6c322faeb62f8f48f298
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/apps/sim/lib/core/config/env.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5276/files#diff-7db3fc610ff89cf819c4eb69b43ec37ae18530e1861f6c322faeb62f8f48f298
https://github.com/simstudioai/sim/pull/5276/files#diff-7db3fc610ff89cf819c4eb69b43ec37ae18530e1861f6c322faeb62f8f48f298
packages/db/connection-url.test.tshttps://github.com/simstudioai/sim/pull/5276/files#diff-78ba6a086f6c0fe916517daafb0607011e52fdda2659a4c6112a5cd81fb785b0
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/packages/db/connection-url.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
packages/db/connection-url.tshttps://github.com/simstudioai/sim/pull/5276/files#diff-2632434eab5afbc07040d605428a620be68a667a645644f641aa7dec5dc2a2d4
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/packages/db/connection-url.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
packages/db/db.tshttps://github.com/simstudioai/sim/pull/5276/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/packages/db/db.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5276/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
https://github.com/simstudioai/sim/pull/5276/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
https://github.com/simstudioai/sim/pull/5276/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
packages/db/index.tshttps://github.com/simstudioai/sim/pull/5276/files#diff-bc34b154a271f644e6cf25b93564ea4b02bb3999f0a5899bbff1e8240cd698be
View file https://github.com/simstudioai/sim/blob/6cdb5a679f5a733232769c8bca5e05ffe7bd0dc9/packages/db/index.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5276/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5276/files#diff-bc34b154a271f644e6cf25b93564ea4b02bb3999f0a5899bbff1e8240cd698be
Please reload this pagehttps://github.com/simstudioai/sim/pull/5276/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.