chore(dev): serve the portal on 3000 for the Fayda redirect

The Fayda redirect URI registered for local testing is
http://localhost:3000/callback, matched exactly by the provider, so the portal
has to be the thing listening there. Its dev and preview servers move from 4200
to 3000 and the API moves to 3001.

Every hardcoded fallback to http://localhost:3000/api follows — six copies of
the same default across libs/api, libs/auth, the portal and the backoffice —
otherwise a developer without a .env would have had the app calling itself.

e2e is unaffected: it binds its own ports (3011/4302/4303) explicitly.
This commit is contained in:
mihretue
2026-08-25 19:04:27 +00:00
parent 16a5dec734
commit baea9f2b57
11 changed files with 23 additions and 19 deletions

View File

@@ -12,8 +12,10 @@
# frontend never speaks to Fayda directly.
# Base URL of the emaapi backend, including the /api prefix.
# Defaults to http://localhost:3000/api when unset.
VITE_BASE_API_URL=http://localhost:3000/api
# 3001, not 3000: the portal itself takes 3000 in development, because that is
# the port in the Fayda redirect URI registered for local testing. Set PORT=3001
# in emaapi's .env to match.
VITE_BASE_API_URL=http://localhost:3001/api
# Serve fixture data instead of calling the API. Any value other than "true"
# uses the real backend.
@@ -23,7 +25,7 @@ VITE_USE_MOCKS=false
# Host ports published by docker-compose.yml. It also expects per-app env files
# at apps/portal/.env and apps/backoffice/.env, which can each be a copy of this
# file. Ignored when running the Vite dev servers, which serve the portal on
# 4200 and the backoffice on 4201.
# 3000 and the backoffice on 4201.
# EMA_PORTAL_PORT=8021
# EMA_BACKOFFICE_PORT=8022
@@ -32,7 +34,6 @@ VITE_USE_MOCKS=false
# page at /callback and /signup/fayda/callback, and whichever path is registered
# with Fayda must match the API's FAYDA_REDIRECT_URI exactly.
#
# The value being registered first is http://localhost:3000/callback, which is
# also emaapi's default port — so when testing that redirect, serve the portal
# on 3000 (`npx nx serve portal --port 3000`) and move the API elsewhere, or
# register a URI that points at the port the portal actually runs on.
# The value being registered first is http://localhost:3000/callback, so the
# portal's dev server now listens on 3000 and emaapi moves to 3001. Nothing
# extra to run — `nx serve portal` already binds the right port.