Skip to content

Conversation

@aryasaatvik
Copy link
Contributor

@aryasaatvik aryasaatvik commented Nov 7, 2025

Add baseUrl configuration and improve port handling

This PR adds baseUrl configuration support to enable HTTPS and custom hostnames in local development, while maintaining automatic port detection as a fallback.

Key Features

BaseUrl override:

  • Configure via baseUrl config option or WORKFLOW_EMBEDDED_BASE_URL env var
  • Enables HTTPS development (next dev --experimental-https)
  • Supports custom hostnames (e.g., https://local.example.com:3000)

Port resolution priority:

  1. config.baseUrl (full override)
  2. config.port (explicit port)
  3. Auto-detected port via @workflow/utils/get-port
  4. PORT env var
  5. Default to 3000

Breaking Changes

API signature updated:

// Before
createEmbeddedWorld(dataDir?: string, port?: number)

// After  
createEmbeddedWorld(args?: Partial<Config>)

Closes #233
Closes #245

@changeset-bot
Copy link

changeset-bot bot commented Nov 7, 2025

🦋 Changeset detected

Latest commit: 94d5e51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@workflow/world-local Major
@workflow/cli Patch
@workflow/core Patch
@workflow/world-postgres Patch
workflow Patch
@workflow/world-testing Patch
@workflow/builders Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/web-shared Patch
@workflow/ai Patch
@workflow/sveltekit Patch
@workflow/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Nov 7, 2025

@aryasaatvik is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

I, Saatvik Arya <aryasaatvik@gmail.com>, hereby add my Signed-off-by to this commit: 27a12f4
I, Saatvik Arya <aryasaatvik@gmail.com>, hereby add my Signed-off-by to this commit: 34039c3

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
…ion and config

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
@pranaygp
Copy link
Collaborator

pranaygp commented Nov 8, 2025

since #233 was merged, could you please rebase/merge this PR on main? this or includes a number of commits from @adriandlam

@aryasaatvik aryasaatvik force-pushed the feat/world-local-config branch from 57fbd63 to 6c377ff Compare November 8, 2025 19:44
@aryasaatvik aryasaatvik changed the title feat(world-local): add port detection and baseUrl support feat(world-local): add baseUrl config and improve port handling Nov 8, 2025
I, Saatvik Arya <aryasaatvik@gmail.com>, hereby add my Signed-off-by to this commit: 195a7ae
I, Saatvik Arya <aryasaatvik@gmail.com>, hereby add my Signed-off-by to this commit: 414aa4c
I, Saatvik Arya <aryasaatvik@gmail.com>, hereby add my Signed-off-by to this commit: 7b81781

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
- Change port check from truthiness to `typeof === 'number'`
- Port 0 (OS-assigned port) now works correctly instead of being skipped
- Null values properly fall through to auto-detection
- Add tests for port 0 and null edge cases

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
The createEmbeddedWorld API signature change is breaking:
- Before: createEmbeddedWorld(dataDir?, port?)
- After: createEmbeddedWorld(args?: Partial<Config>)

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
These were bugs introduced and fixed within the same PR,
not pre-existing bugs, so they shouldn't be listed as fixes.

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
Automatic port detection already existed in main via getPort().
This PR only adds baseUrl config and port 0 support.

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
@vercel
Copy link
Contributor

vercel bot commented Nov 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Nov 13, 2025 6:50pm
example-nextjs-workflow-webpack Ready Ready Preview Comment Nov 13, 2025 6:50pm
example-workflow Ready Ready Preview Comment Nov 13, 2025 6:50pm
workbench-hono-workflow Ready Ready Preview Comment Nov 13, 2025 6:50pm
workbench-nitro-workflow Ready Ready Preview Comment Nov 13, 2025 6:50pm
workbench-nuxt-workflow Ready Ready Preview Comment Nov 13, 2025 6:50pm
workbench-sveltekit-workflow Ready Ready Preview Comment Nov 13, 2025 6:50pm
workbench-vite-workflow Ready Ready Preview Comment Nov 13, 2025 6:50pm
workflow-docs Ready Ready Preview Comment Nov 13, 2025 6:50pm

Copy link
Member

@VaguelySerious VaguelySerious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! The code looks good to me overall and I like the change.

I ran unit tests on this PR and it looks like there might be some e2e test failures - could you take a look? Your commits don't trigger tests, but you can test e2e locally by running e2e tests in packages/core against e.g. the nextjs-turbopack workbench app running in dev mode. See the github tests.yml file on how that's set up.

Once tests are green, this would be good to merge

describe('edge cases', () => {
it('should handle empty config object', async () => {
const { getPort } = await import('@workflow/utils/get-port');
vi.mocked(getPort).mockResolvedValue(undefined);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vi.mocked(getPort).mockResolvedValue(undefined);
vi.mocked(getPort).mockResolvedValue({});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the issue. it was overriding defaults with undefined. getPort returns undefined instead of an empty object

- Updated createEmbeddedWorld to filter out undefined values from args before merging with the default config.
- This change ensures that only defined arguments are considered, enhancing the function's robustness.

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
@VaguelySerious VaguelySerious merged commit aa015af into vercel:main Nov 13, 2025
26 of 35 checks passed
@VaguelySerious
Copy link
Member

Looks great, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants