refactor(platform-domains): every URL rule lives once beside the registry; getBaseUrl deleted - #2219
Merged
Merged
Conversation
…solver; getBaseUrl deleted [preview:none]
getBaseUrl() without a platform returned VERCEL_PROJECT_PRODUCTION_URL, whichever domain Vercel lists first for a project: flamingo.cx on flamingo (a 308) and production on every preview, and it silently fell back to openmsp. getPlatformUrl(platform, { environment }) lives in the pure platform-domains subpath beside the registry, takes a required platform, and resolves the dev URL outside a production build and the registry URL otherwise; environment production forces the registry. getBaseUrl is removed from utils/cn and the utils barrel; every lib caller (source-row-cta, made-with-love), the example app, READMEs and docs move to it.
Contributor
🦩 Flamingo Code ReviewNo findings on the current head. Mode: advisory Need another pass? Commits pushed after this review are not reviewed automatically.
Prefer typing? Comment React 👍/👎 on inline comments to teach the reviewer. Started 2026-09-17 00:12 UTC · updated 2026-09-17 00:12 UTC · workflow run |
… redirect-target resolvers live beside the registry [preview:none]
Every URL rule in one module for every consumer: getDeploymentUrl({ platform, configuredUrl }) is where the running app is reachable (browser origin, a runtime-configured URL such as a self-hosted OpenFrame install, a Vercel preview's immutable URL, the registry URL in production, localhost in development); getRequestOrigin reads the host header only; isLocalUrl matches a whole local hostname; resolveRedirectTarget refuses a relative target that leaves the origin. Moved from the hub, which re-implemented them, and from openframe-oss-frontend's app-URL copies. Re-exported from ./utils; tests ported.
michaelassraf
force-pushed
the
refactor/platform-url-ssot
branch
from
September 17, 2026 00:20
fa742eb to
016dc68
Compare
…, so consumers keep no URL rule [preview:none]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every app resolved its URLs itself, and the rules had drifted apart:
getBaseUrl(): with a platform it returned the registry URL. Without one it returnedVERCEL_PROJECT_PRODUCTION_URL, whichever domain Vercel lists first (flamingo.cxon flamingo, a 308; production on every preview), falling back to openmsp.getBaseUrl,getMetadataBaseUrl, twoNEXT_PUBLIC_APP_URLreads inlayout.tsx) with two different fallbacks (openframe.dev/openframe.ai).What
Every URL rule now lives once, in the pure
platform-domainssubpath next to the registry. All five are also re-exported from./utils.getPlatformUrl(platform, { environment })platformis required. Dev URL outside a production build, registry URL otherwise;environment: 'production'forces the registry.getDeploymentUrl({ platform, configuredUrl })VERCEL_URL; the registry URL in production;NEXT_PUBLIC_DEV_URL/ localhost onPORTin development.getRequestOrigin(headers)hostonly (neverx-forwarded-host);nullwithout a Host header.isLocalUrl(url)localhost.example.comis public.resolveRedirectTarget(origin, target)//evil.example,/\evil.example).Also in this PR:
getBaseUrlis deleted fromutils/cn.tsand the barrel.source-row-cta(+ test) andmade-with-loveusegetPlatformUrl; READMEs,.cn.mdand the embedding example's docs are updated.ensureSchemedoc: no longer claimsnext.config.mjskeeps a copy, since this subpath is plain ESM.Consumers (each moves in its own PR, after this is released)
lib/urls.tsbecomes a binding that only supplies the current platform.getAppUrl()=getDeploymentUrl({ platform: 'openframe-dashboard', configuredUrl: NEXT_PUBLIC_APP_URL }), replacing its four copies.Verification
npm run type-check: 0 errors.VERCEL_PROJECT_PRODUCTION_URLignored, preview URL, runtime-configured URL, dev port, browser origin, host-only request origin, local hostnames, refused redirect targets).Release note
Breaking:
getBaseUrlis removed from@flamingo-stack/openframe-frontend-core/utils. UsegetPlatformUrl(platform)for a platform's URL, orgetDeploymentUrl({ platform, configuredUrl })for the running app's.