Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Frontend environment variables — Sprint 5b
# Frontend environment variables - Sprint 5b
# To override defaults, copy this file to .env (git-ignored).
#
# ── Local dev /etc/hosts prerequisite ─────────────────────────────────────
Expand All @@ -15,7 +15,7 @@
# ── Backend API URL (Kong API gateway behind Traefik) ─────────────────────
VITE_API_URL=http://api-dev.velobits.dev

# ── Keycloak OIDC (auth provider — Velobits realm) ────────────────────
# ── Keycloak OIDC (auth provider - Velobits realm) ────────────────────
VITE_KEYCLOAK_URL=http://auth-dev.velobits.dev
VITE_KEYCLOAK_REALM=Velobits
VITE_KEYCLOAK_CLIENT_ID=develop-fixmytext
Expand All @@ -24,7 +24,7 @@ VITE_KEYCLOAK_CLIENT_ID=develop-fixmytext
VITE_SENTRY_DSN=
VITE_SENTRY_ENVIRONMENT=development
VITE_SENTRY_RELEASE=
# CI-only — not needed for local dev unless testing source map upload
# CI-only - not needed for local dev unless testing source map upload
SENTRY_AUTH_TOKEN=
SENTRY_ORG=velobits-lb

Expand All @@ -39,4 +39,4 @@ VITE_SSO_DOMAIN_MAP=
VITE_EDITOR_REMOTE_ENTRY=http://localhost:3101/remoteEntry.js
VITE_ANALYTICS_REMOTE_ENTRY=http://localhost:3102/remoteEntry.js
# When running via Docker Compose, both remotes are served through the nginx
# router on port 3000 — use .env.docker.dev instead of this file.
# router on port 3100 - use .env.docker.dev instead of this file.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ jobs:
run: npm run build -w @velobits/shell
env:
VITE_API_URL: http://localhost:8000
# Federation remote entry points — Vite bakes these into the host bundle at
# Federation remote entry points - Vite bakes these into the host bundle at
# build time. Use repo vars for the real deployment URLs; fall back to the
# local router path so the build check still exercises a prefixed (non-localhost)
# remoteEntry URL rather than the vite.config localhost:3101/3102 defaults.
VITE_EDITOR_REMOTE_ENTRY: ${{ vars.VITE_EDITOR_REMOTE_ENTRY || 'http://localhost:3000/remotes/editor/remoteEntry.js' }}
VITE_ANALYTICS_REMOTE_ENTRY: ${{ vars.VITE_ANALYTICS_REMOTE_ENTRY || 'http://localhost:3000/remotes/analytics/remoteEntry.js' }}
VITE_EDITOR_REMOTE_ENTRY: ${{ vars.VITE_EDITOR_REMOTE_ENTRY || 'http://localhost:3100/remotes/editor/remoteEntry.js' }}
VITE_ANALYTICS_REMOTE_ENTRY: ${{ vars.VITE_ANALYTICS_REMOTE_ENTRY || 'http://localhost:3100/remotes/analytics/remoteEntry.js' }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
Expand Down Expand Up @@ -134,12 +134,12 @@ jobs:
federation-smoke:
name: Federation Smoke (host↔remote contract)
runs-on: ubuntu-latest
# Heavy E2E gate — runs only for `main` (pushes to main + PRs targeting main).
# Heavy E2E gate - runs only for `main` (pushes to main + PRs targeting main).
# Skipped on `develop`: push to develop has github.ref refs/heads/develop;
# a PR into develop has github.base_ref == 'develop'. Both are excluded here.
if: github.ref != 'refs/heads/develop' && github.base_ref != 'develop'
# Fail fast if a step hangs (e.g. a stalled Playwright CDN download) instead of
# sitting until GitHub's 6-hour default — which makes the run look permanently stuck.
# sitting until GitHub's 6-hour default - which makes the run look permanently stuck.
timeout-minutes: 25
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
run: npx playwright install-deps chromium

# Bring up the production simulation: built shell + remotes behind the nginx
# router on :3000 — the topology that actually exercises the remote `base` paths
# router on :3100 - the topology that actually exercises the remote `base` paths
# and the shell's baked VITE_*_REMOTE_ENTRY URLs (Phase 6.1/6.2). The backend +
# Keycloak are mocked inside the smoke spec, so no real services are needed.
- name: Start prod compose stack
Expand All @@ -188,7 +188,7 @@ jobs:
- name: Wait for router (shell at /)
run: |
for i in $(seq 1 60); do
if curl -sf -o /dev/null http://localhost:3000/; then
if curl -sf -o /dev/null http://localhost:3100/; then
echo "router up"; exit 0
fi
sleep 5
Expand Down Expand Up @@ -268,5 +268,7 @@ jobs:
- name: Install dependencies
run: npm ci

# Gates on high/critical advisories, minus the reviewed, dated exceptions in
# scripts/audit-allowlist.json. See that file for why each one is accepted.
- name: Audit for vulnerabilities
run: npm audit --audit-level=high
run: node scripts/audit-allowlist.mjs
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# Gates the PR's dependency *diff* for newly introduced vulnerable packages
# (DO-11). actions/dependency-review-action was dropped: it calls GitHub's
# Dependency Review API, which private repos only get with GitHub Advanced
# Security — the same wall that forced `upload: never` in codeql.yml.
# Security - the same wall that forced `upload: never` in codeql.yml.
# OSV-Scanner reproduces the gate locally on the runner: it scans lockfiles
# at the PR base and head and fails only on newly introduced vulnerabilities.
# The full-tree high-severity audit remains CI's "Dependency Audit" job.
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Cloudflare deployment — runs the root `deploy:*` scripts in the order the
# Cloudflare deployment - runs the root `deploy:*` scripts in the order the
# Module Federation topology requires:
#
# remotes (Pages) ─▶ shell (Pages, bakes remoteEntry URLs) ─▶ router worker (last)
# content (Worker, OpenNext — SSR/SEO + share OG cards, bot-routed) ─┘
# content (Worker, OpenNext - SSR/SEO + share OG cards, bot-routed) ─┘
#
# ── Environments ─────────────────────────────────────────────────────────────
# Branch → GitHub environment → Cloudflare target:
Expand Down Expand Up @@ -35,9 +35,9 @@
name: Deploy (Cloudflare)

# Release model (asymmetric):
# develop — deploys AUTOMATICALLY after "Frontend CI" succeeds on the
# develop branch (never on a raw push — H-6).
# production — NEVER auto-deploys. Releases are manual: Actions →
# develop - deploys AUTOMATICALLY after "Frontend CI" succeeds on the
# develop branch (never on a raw push - H-6).
# production - NEVER auto-deploys. Releases are manual: Actions →
# "Deploy (Cloudflare)" → Run workflow from `main`. Branch
# protection guarantees main only carries CI-green commits.
on:
Expand All @@ -52,7 +52,7 @@ on:
type: boolean
default: false

# contents:write — the deploy jobs push the `deployed/<env>/<app>` marker tags.
# contents:write - the deploy jobs push the `deployed/<env>/<app>` marker tags.
permissions:
contents: write

Expand All @@ -71,7 +71,7 @@ jobs:
# Only run for a successful CI run, or a manual dispatch from a branch that
# maps to a real environment. Without the branch check, dispatching from a
# feature branch would deploy it INTO the develop environment (branch-alias
# uploads, develop worker, deployed/develop/* marker tags) — inconsistent
# uploads, develop worker, deployed/develop/* marker tags) - inconsistent
# state that then masquerades as develop.
if: >-
(github.event_name == 'workflow_dispatch' &&
Expand All @@ -93,7 +93,7 @@ jobs:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.event.workflow_run.head_sha || github.ref }}
# Full history + tags — needed to diff against the marker tags.
# Full history + tags - needed to diff against the marker tags.
fetch-depth: 0
fetch-tags: true
- name: Diff each app against its last-deployed marker tag
Expand All @@ -112,7 +112,7 @@ jobs:
if ! git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
echo true; return # never deployed to this env yet
fi
# shellcheck disable=SC2086 — path list is intentionally word-split
# shellcheck disable=SC2086 - path list is intentionally word-split
if [ -n "$(git diff --name-only "$tag" HEAD -- ${PATHS[$app]})" ]; then
echo true
else
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
environment: ${{ (github.event.workflow_run.head_branch || github.ref_name) == 'main' && 'production' || 'develop' }}
needs: [changes, deploy-remotes]
# Run when the shell changed AND the remotes either deployed successfully or
# were skipped entirely (no changes) — but never after a remote failure.
# were skipped entirely (no changes) - but never after a remote failure.
if: >-
!cancelled() &&
needs.changes.outputs.shell == 'true' &&
Expand All @@ -195,13 +195,13 @@ jobs:
- name: Build & deploy shell to Cloudflare Pages
run: npm run deploy:shell -- --branch "$DEPLOY_BRANCH"
env:
# Federation entry points baked into the host bundle — must point at the
# Federation entry points baked into the host bundle - must point at the
# environment's router so the browser loads each remote under /remotes/<name>/.
VITE_EDITOR_REMOTE_ENTRY: ${{ vars.VITE_EDITOR_REMOTE_ENTRY }}
VITE_ANALYTICS_REMOTE_ENTRY: ${{ vars.VITE_ANALYTICS_REMOTE_ENTRY }}
VITE_API_URL: ${{ vars.VITE_API_URL }}
VITE_KEYCLOAK_URL: ${{ vars.VITE_KEYCLOAK_URL }}
# Realm must be passed explicitly — app-core silently falls back to the
# Realm must be passed explicitly - app-core silently falls back to the
# DEV realm (Velobits) when unset (keycloakConfig.ts).
VITE_KEYCLOAK_REALM: ${{ vars.VITE_KEYCLOAK_REALM }}
VITE_KEYCLOAK_CLIENT_ID: ${{ vars.VITE_KEYCLOAK_CLIENT_ID }}
Expand All @@ -211,7 +211,7 @@ jobs:
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
VITE_SENTRY_ENVIRONMENT: ${{ (github.event.workflow_run.head_branch || github.ref_name) == 'main' && 'production' || 'develop' }}
# Must match the commit actually checked out and built — for
# Must match the commit actually checked out and built - for
# workflow_run triggers, github.sha is NOT that commit.
VITE_SENTRY_RELEASE: ${{ github.event.workflow_run.head_sha || github.sha }}
- name: Update deploy marker tag
Expand All @@ -227,8 +227,8 @@ jobs:
if: needs.changes.outputs.content == 'true'
env:
DEPLOY_ENV: ${{ (github.event.workflow_run.head_branch || github.ref_name) == 'main' && 'production' || 'develop' }}
# Selects [env.develop] in apps/content/wrangler.toml — and thus the
# develop-fixmytext-content worker — for develop deploys (see the
# Selects [env.develop] in apps/content/wrangler.toml - and thus the
# develop-fixmytext-content worker - for develop deploys (see the
# WRANGLER_ENV_FLAG note on deploy-router for the expression shape).
WRANGLER_ENV_FLAG: ${{ (github.event.workflow_run.head_branch || github.ref_name) != 'main' && '--env develop' || '' }}
steps:
Expand All @@ -243,7 +243,7 @@ jobs:
cache: npm
- run: npm ci
- name: Build & deploy content app
# Runtime secrets (AUTH_SECRET, COOKIE_SECRET) are NOT build inputs —
# Runtime secrets (AUTH_SECRET, COOKIE_SECRET) are NOT build inputs -
# they live on each worker as dashboard Secrets and survive deploys.
run: npm run deploy:content -- $WRANGLER_ENV_FLAG
env:
Expand All @@ -258,7 +258,7 @@ jobs:
name: Deploy router worker
runs-on: ubuntu-latest
environment: ${{ (github.event.workflow_run.head_branch || github.ref_name) == 'main' && 'production' || 'develop' }}
# The router stitches the deployed units together — deploy it last so it never
# The router stitches the deployed units together - deploy it last so it never
# routes to a unit that hasn't been published yet.
needs: [changes, deploy-remotes, deploy-shell, deploy-content]
if: >-
Expand All @@ -270,10 +270,10 @@ jobs:
env:
DEPLOY_ENV: ${{ (github.event.workflow_run.head_branch || github.ref_name) == 'main' && 'production' || 'develop' }}
# Empty for production (top-level wrangler.toml config); selects the
# [env.develop] block — and thus the develop-fixmytext-router worker —
# [env.develop] block - and thus the develop-fixmytext-router worker -
# for develop deploys. The non-main branch carries the truthy operand so
# production resolves to a genuinely empty string (`cond && '' || x`
# would always yield x — empty strings are falsy in GitHub expressions).
# would always yield x - empty strings are falsy in GitHub expressions).
WRANGLER_ENV_FLAG: ${{ (github.event.workflow_run.head_branch || github.ref_name) != 'main' && '--env develop' || '' }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# These Playwright suites validate the host<->remote Module Federation contract
# and full user journeys (signup, tools, purchase, share, cross-app navigation).
# They run against a DEPLOYED environment — the shell config has no webServer and
# the specs hit a real backend + Keycloak — so this is intentionally NOT a blocking
# They run against a DEPLOYED environment - the shell config has no webServer and
# the specs hit a real backend + Keycloak - so this is intentionally NOT a blocking
# PR gate. Trigger it manually after deploying, or point E2E_FRONTEND_URL at any
# running stack (e.g. a `docker compose --profile prod` host).
name: E2E (on-demand)
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ┌─────────────────────────────────────────────────────────────────────────────┐
# │ FixMyText — frontend/.gitignore (Vite) │
# │ FixMyText - frontend/.gitignore (Vite) │
# └─────────────────────────────────────────────────────────────────────────────┘

# ── Dependencies ──────────────────────────────────────────────────────────────
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md) before particip
```bash
npm run dev
```
The app will be available at `http://localhost:3000`.
The app will be available at `http://localhost:3100`.

### Docker Option

Expand Down Expand Up @@ -213,7 +213,7 @@ cd backend
docker compose --profile dev up -d --build

# 2. Start the frontend dev stack
cd ../frontend
cd ../FixMyText-frontend
docker compose --profile dev up -d --build

# 3. Install Playwright + browser (one-time)
Expand All @@ -235,7 +235,7 @@ npx playwright test e2e/02-local-tool.spec.js # single spec

| Variable | Default | Purpose |
| ------------------------- | ----------------------- | -------------------------------------- |
| `E2E_FRONTEND_URL` | `http://localhost:3000` | Where Playwright points the browser |
| `E2E_FRONTEND_URL` | `http://localhost:3100` | Where Playwright points the browser |
| `E2E_API_URL` | `http://localhost:8000` | Where helpers send direct API calls |
| `E2E_RAZORPAY_KEY_SECRET` | `fake_secret_for_e2e` | HMAC secret for the signed-verify spec |

Expand All @@ -259,7 +259,7 @@ docker compose -f backend/docker-compose.yml --profile dev down -v

The frontend ships generated TS types derived from the backend's FastAPI OpenAPI schema. Two files are committed and kept in lockstep:

- [backend/openapi.json](../backend/openapi.json) — dumped from `app.openapi()`.
- [backend/openapi.json](../FixMyText-backend/openapi.json) — dumped from `app.openapi()`.
- [frontend/src/types/openapi.d.ts](src/types/openapi.d.ts) — generated by `openapi-typescript` from the JSON.

CI's `contract-types` job ([.github/workflows/ci.yml](../.github/workflows/ci.yml)) re-runs both generators and `git diff --exit-code`s the result. Any drift between the live FastAPI app and the committed types fails the build.
Expand All @@ -274,7 +274,7 @@ SECRET_KEY=dev DATABASE_URL=postgresql+asyncpg://x:x@localhost/x \
python scripts/dump_openapi.py openapi.json

# 2. Regenerate the TS types.
cd ../frontend
cd ../FixMyText-frontend
npm run gen:types

# 3. Commit both.
Expand Down
Loading
Loading