Next.js + Django (Separate Repos)

Use this when frontend and backend live in different projects but you want one active workspace context for both.

Use case

Frontend and backend are separate repos. You want one workspace to run both processes and keep their browser sessions aligned.

Project settings

The frontend project owns both the frontend and backend services and runs both processes, since it is the workspace that serves as the shared context for both.

Frontend project settings

Services: frontend, backend
Frontend process: API_URL=$SPACES_BACKEND_URL PORT=$SPACES_FRONTEND_PORT npm run dev
Backend process: cd /path/to/backend-project && python manage.py runserver 0.0.0.0:$SPACES_BACKEND_PORT
Browser session: $SPACES_FRONTEND_URL

The backend process starts from the frontend workspace so both processes receive the same SPACES_<SERVICE>_PORT and SPACES_<SERVICE>_URL variables Spaces sets for each service. The backend command can cd into the other repo directly, since a process command runs as shell input.

← All recipes