go-guess/frontend
Daniel Noulet 660d5291ec fix: restore full test suite
Separate the internal API and nginx ports, align browser BDD fixtures with tenant and Go Loose requirements, and correct the invitation outcome interaction order.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-03 00:46:27 +02:00
..
src fix: restore full test suite 2026-10-03 00:46:27 +02:00
.dockerignore initial commit 2026-09-19 20:31:14 +02:00
.gitignore initial commit 2026-09-19 20:31:14 +02:00
.prettierignore initial commit 2026-09-19 20:31:14 +02:00
.prettierrc.json initial commit 2026-09-19 20:31:14 +02:00
Dockerfile changed deployment 2026-10-02 21:44:26 +02:00
eslint.config.js initial commit 2026-09-19 20:31:14 +02:00
index.html initial commit 2026-09-19 20:31:14 +02:00
nginx.conf feat: sync interview content in real time 2026-09-19 22:22:42 +02:00
package-lock.json initial commit 2026-09-19 20:31:14 +02:00
package.json initial commit 2026-09-19 20:31:14 +02:00
README.md changed deployment 2026-10-02 21:44:26 +02:00
tsconfig.app.json initial commit 2026-09-19 20:31:14 +02:00
tsconfig.json initial commit 2026-09-19 20:31:14 +02:00
tsconfig.node.json initial commit 2026-09-19 20:31:14 +02:00
vite.config.ts feat: route API requests by tenant hostname 2026-10-01 17:49:42 +02:00

Go Guess frontend

React and TypeScript recruitment workspace built with Vite.

Commands

npm install
npm run dev
npm run typecheck
npm run lint
npm run format
npm run format:check
npm test
npm run build

Run one test:

npm test -- src/app/App.test.tsx -t "filters jobs by title"

Source structure

  • src/app contains the application shell, providers, routes, and route-level tests.
  • src/features groups pages and components by business capability.
  • src/components contains UI shared by multiple features.
  • src/config/navigation.ts defines configurable footer sitemap and useful-link groups.
  • src/api/client.ts is the typed HTTP boundary.
  • src/types contains API and domain types.
  • src/styles/global.css contains shared tokens and layout styles.

Keep feature-only UI close to its feature instead of adding more screens to the application shell.

API integration

For local tenant hosts such as nmbs.guess.local, src/api/client.ts derives tenant nmbs, calls same-origin /api through the shared HTTPS proxy, and sends X-Tenant-Id: nmbs on every JSON, multipart, file-download, and event-stream request. ypto.guess.local behaves identically for tenant ypto. Other hostnames use same-origin /api; Vite retains its /api proxy for that case.

Set VITE_GO_LOOSE_API_KEY before npm run dev or npm run build to also send X-API-Key. Vite reads frontend/.env.local for local development; that file matches *.local and must not be committed. The standalone frontend image accepts the same value as a build argument:

docker build --build-arg VITE_GO_LOOSE_API_KEY='gl_replace_with_issued_secret' \
  -t go-guess-frontend .

The variable is inlined into the JavaScript bundle. Treat it as an application credential for Go Loose, not as a secret equivalent to the interviewer JWT. If it is unset or empty, the client omits the header and protected interviewer routes fail closed with 401. Login and participant routes do not require the key, but the client still sends it when the variable is present. Invitation and participant-meeting URLs use the validated request origin so links stay on the tenant hostname. Copy actions fall back to a temporary selected textarea when the Clipboard API is unavailable on local HTTP domains.

Login stores the returned JWT in sessionStorage; protected requests send it as Authorization: Bearer <token>. API failures are shown in the UI and are never replaced with demo data. A 401 from a protected JSON, file, or event-stream request clears authentication and returns the user to /login. The app also schedules logout from the JWT expiration claim so an idle expired session cannot remain on a protected page.

The machine-readable OpenAPI 3.0 contract at /api/openapi.json is the source of truth for supported routes and schemas. It is assembled by the backend from the same typed calls that register Chi routes, so there is no generated file or manual update command. Do not duplicate a route inventory here; inspect the contract instead.

Participant creation uses multipart fields firstName, lastName, birthday, email, contactInfo, photo, and cv.

Interview workflow

Authenticated interviewers create and edit reusable questions at /questions, configure job status and duration, attach active library questions, and generate invitations for each eligible participant from a job detail page. Multiple-choice and radio questions require at least two explicitly added options. Detaching a question removes only the job association; questions can be deprecated but not deleted. Open-answer and code-review questions include an interviewer-only reference answer that is never rendered in the participant interview. Code-review questions also require a code snippet. Accepted and completed invitations can be opened from the job to review every participant answer, possible choice options, reference answers, and code-review context; unanswered questions are called out explicitly. Completed assessments can be marked as passed or failed. Passed candidates expose a scheduling form for the date, location, co-interviewers, and candidate-visible shared documentation.

The authenticated workspace also includes:

  • Users for listing and creating co-interviewers.
  • Invitations in the top-right account navigation for accepting or declining assignments.
  • Profile in the top-right account navigation for the logged-in user's identity and role.
  • Schedule for interviews grouped by date.
  • Interviewer sessions for changing status, editing prominent shared documentation, and posting private notes while an interview is started. Notes and shared-document changes arrive live through an authenticated streaming fetch; the app intentionally does not use EventSource, because the request needs the JWT authorization header.

The authenticated layout ends with a sitemap and useful-links footer. Update src/config/navigation.ts to add, remove, or reorder footer destinations.

Participants open the generated /participant/:invitationId URL without signing in. The opaque invitation ID authorizes the existing /api/interviews/:token API. Code-review questions are shown in a pull-request-style code panel with a review comment field. Answers are saved when navigating between questions and as they change, then Submit completes the interview. The countdown is derived from the backend acceptedAt timestamp plus the job duration so refreshing cannot reset it. Questions stay hidden until the participant explicitly accepts the invitation.

Scheduled candidates use /participant/meeting/:token. This public view shows the interview date, location, status, and read-only shared documentation. A token-authorized event stream updates the document immediately when an interviewer saves it in another browser. The participant view never receives interviewer notes or assessment reference answers.

Container

Build with docker build -t go-guess-frontend .. Pass --build-arg VITE_GO_LOOSE_API_KEY=... when the image must call protected interviewer routes; see the API integration section. The production Nginx server serves the SPA and proxies /api to the Docker Compose service api:8080.