Next.js (No Docker)

Use this when your frontend runs directly on your machine, no containers, and you want multiple workspaces with isolated services and stable URLs.

Use case

You have one Next.js repo and run npm run dev directly. You want multiple Spaces workspaces active at once, each with its own service and browser tab.

Project settings explained

Services

frontend

Declaring a named service gives each workspace its own local port and a stable URL, so two branches can both run a dev server without colliding.

Setup script

npm i
cp .env.example .env

npm i makes sure dependencies are present in every workspace. cp gives each workspace its own .env copy, so branch-local env edits do not leak between workspaces; a symlink would keep one source of truth but couple every workspace's env together. Swap .env.example for whatever seed file your repo keeps, Spaces has no built-in shared env file.

Processes

PORT=$SPACES_FRONTEND_PORT npm run dev

This binds Next.js to the service's assigned local port, so each browser session opens the right workspace's instance.

Browser sessions

$SPACES_FRONTEND_URL

Point a browser session at the named service so each workspace opens its own app tab reliably. $SPACES_FRONTEND_URL resolves to http://frontend.<slug>.localhost:7391. Chrome treats *.localhost as a secure address, so this works over plain HTTP with no certificate.

← All recipes