Frontend
Русский | English
A React and TypeScript SPA built with Vite and organized using FSD. Registration, email confirmation, sign-in, consent settings, the candidate profile and questionnaire, candidate assessment, company profiles, employer needs, and support cases use the API. A manual assessment request creates a support case and displays its current state; the screen does not present it as an assessment result. The result history and result page use the API; the candidate directory and employer invitations remain placeholders.
src/app/starts the application: the route tree (router/), the query client (providers/), global styles, and the route error page.src/pages/holds public pages, sign-in and registration, candidate profile and questionnaire, assessment results, company and employer needs pages, support cases, technical status, and remaining placeholders.src/widgets/holds shells:public-shell,candidate-shell,employer-shell, the result history widgetassessment-history, and the technicalsystem-statuswidget.src/entities/holds entity models, includingneed(see Need entity) andcompany;src/features/holds user actions and forms.src/shared/ui/holds design tokens, fonts, logos, and primitives;src/shared/config/holds route paths;src/shared/api/holds the API client with generated endpoints, Zod schemas, and MSW mocks.codegen/orval.config.tsconfigures generation from the shared OpenAPI contract;codegen/mock-patterns.tsis the step after Orval that fixes MSW mocks of strings with apattern(see API client generation).scripts/checks FSD boundaries and Orval compatibility with the OpenAPI 3.2 fixture.e2e/holds Playwright specs andplaywright.config.tsconfigures them; they run only against a Compose stack.
From the repository root, make -C frontend dev starts development and make -C frontend check runs checks and builds the app. In Docker, Nginx serves the built files using configuration from deploy/nginx/.
Routes
| Group | Paths | Shell |
|---|---|---|
| Public | /, /login, /register, /verify-email, /support, /status |
PublicShell |
| Candidate | /candidate with onboarding, profile, questionnaire, assessment, results, results/:attemptId, invitations, privacy, support/cases, support/cases/new, support/cases/manual-assessment, and support/cases/:caseId |
CandidateShell |
| Employer | /employer redirects to /employer/company; /employer/company, /employer/needs, /employer/needs/new, /employer/needs/:needId, /employer/support/cases, /employer/support/cases/new, /employer/support/cases/:caseId |
EmployerShell |
Each group has its own not-found page. Paths are defined once in shared/config/paths.ts. The router uses React Router data APIs (createBrowserRouter): a route-level error boundary, loader redirects, and later lazy code splitting for cabinets. Loaders do not fetch data; server data belongs to TanStack Query. Cabinet boundaries read the current session and direct guests to sign-in. /support sends a signed-in user to the support area for their account or to sign-in. Need pages pass organization_id in the query string, but the client checks the current owner directory and the server authorizes every request.
/status is a service page: it checks /api/v1/healthz and is linked from the public footer only. It is not a product readiness indicator. In development mode the same page shows a gallery of states built from local fixtures (an error with retry, loading, empty, forbidden, saving, trust levels); production builds do not include it.
Server data
Generated Orval hooks call the shared same-origin apiRequest client, so the QueryClient has no default query function. Defaults in app/providers/query-client.ts:
- retries: up to two, only for no response (status 0) and 5xx except 501; 4xx and
invalid_responsefail at once; staleTimeof 30 s; window focus does not refetch, and screens that need fresh data opt in per query;- automatic mutation retries are disabled; company creation retries through an explicit action with the same body and
Idempotency-Key.
Candidate profile
entities/candidate holds the complete profile draft model and converts it to CandidateProfileUpdate. features/edit-profile owns the fields and saving, while pages/profile owns the page. Server data stays in React Query; contacts and drafts are not written to localStorage or sessionStorage.
The form preserves the provenance of untouched suggestions, displays overlapping employment periods, and requires explicit confirmation of parallel work. Confirmation is bound to the current indices and dates; reordering or changing periods requires another review. Confirmed categories are displayed separately and never enter the save body. A 412 version conflict preserves the draft and offers an explicit replacement with current data.
After saving, the form reloads the session and shows the account step returned by the server. Saving a profile does not complete the consent step; that transition is not implemented yet. Independent profile editing works without ML, a file, or FSP.
Candidate questionnaire
pages/questionnaire reads the specialization catalog and the current candidate's private answers through Orval. The draft stays in component state, saved answers stay in React Query, and reload restores the server record. The form offers one or two specializations, self-assessed grades, currently available task languages, stack, experience, and work formats. A specialization without a published bank is marked in development and can be saved without FSP.
A 412 conflict retains the draft and offers explicit reload or replacement against the latest read version. Session errors hide private answers; responses from a previous account cannot repopulate the cache. Onboarding links follow the step returned by the server. /candidate/questionnaire is the destination for the saved questionnaire step.
Candidate home
/candidate opens at every saved onboarding step and does not redirect: the pages/candidate-home page shows the saved account step (onboarding_step of the current session) and leads to the next action. The "Next step" block (widgets/candidate-next-step) and its selection logic (entities/candidate, buildCandidateJourney) use only server answers: the profile version (GET /me/profile; version 0 means the profile was never saved), the questionnaire (GET /me/questionnaire), and the assessment availability with the confirmed grade (GET /me/assessment-availability). The rules apply in order: a confirmed category leads to the result and visibility settings; an empty profile leads to the profile form; an empty questionnaire leads to the questionnaire; an active attempt leads to resuming it; otherwise the test is next. The saved step is shown only: the server advances it when the profile or the questionnaire is saved from the matching step, so a saved profile can sit behind the earlier "Consents" step, and the presence of saved data decides between the profile, the questionnaire, and the test. Linking an FSP ID and ML extraction are not needed on this path and are never shown as an error or a missing condition.
The declared level and the confirmed category are always shown apart, per specialization: the declared one comes from the questionnaire self_assessed_grade and is labeled as self-assessment, the confirmed one only from the availability confirmed_grade. The client does not derive a category from scores, thresholds, or the target grade. The page also shows the latest result (GET /me/assessment-results?limit=1, restated by assessmentResultSummary, with links to the breakdown and the history) and the profile visibility (GET /me/privacy: card open or closed with the reason, whether the category is shown, search status) with a link to /candidate/privacy.
Every block has loading, error with retry, forbidden (401 and 403 without retry), and empty states. The three reads that the next step depends on form one state: if any of them fails, an error with retry appears instead of a step guessed from partial data. The result and the visibility are independent, so their failure does not hide the next step. Query keys contain the account id, data does not outlive the screen (gcTime: 0) and is read again on every open and on returning to the tab, so a page refresh shows the current API state. Signing in again still opens the saved-step page (getOnboardingDestination), not the home.
Candidate assessment
/candidate/assessment reads availability and creates attempts through the API; /candidate/assessment/:attemptId resumes an attempt, submits answers, and finalizes it through server commands. Real assessment requires current C3 consent. demo_express is labeled as a demonstration and does not award a qualification score or confirmed category. The attempt screen displays the server result with the same component as the result page and links to it (see Candidate results). Only the server assigns a category; the client calculates neither scores nor grades.
Before a real attempt starts, the screen shows a dialog that lists the signals. The browser records tab or window switches, copy, paste and cut, and fullscreen exits; the server measures the answer time per item, a change of network address during the attempt, parallel sessions, and the match of answer digests with other candidates' answers. The dialog states that image, sound, and clipboard contents are not collected, that addresses and session tokens are not stored (only one-way keyed digests), and that browser events are stored only while the C3 consent is current. The attempt cannot start without confirmation: closing the dialog or pressing Escape starts nothing. The confirmation is stored on the server (/me/assessment-signal-notice) for the text version, so a reload or a new browser does not ask again; the same dialog opens when an older attempt that was created without the confirmation is resumed. It is a record of being informed, not a consent: C3 stays separate.
During a real attempt, features/assessment-signals collects the disclosed signals: focus loss with its duration, copy, paste and cut with a size only, and fullscreen exit. The listeners are passive, block nothing, and show nothing. Events go in batches (every 10 seconds, when the tab is hidden, or at 20 queued events), and each batch keeps one Idempotency-Key across retries. When the page is closed (pagehide) or the collector unmounts, what remains is sent in one last request with keepalive, so closing the tab does not lose the last seconds of events; the result of that request is not awaited and not retried. A network failure never affects answer submission: a failed batch is sent again with the same key and body after a growing pause and is dropped after the attempt limit. A server refusal (no C3, finished attempt) stops collection. The demonstration run collects no signals.
Clipboard contents and typed text are never read into a signal or sent. The paste size comes from the paste event: file sizes (File.size) plus the UTF-8 length of the plain-text item of clipboardData; the string lives in one local variable during the count and is not kept. The Clipboard API (navigator.clipboard) is not used. The copy and cut size is the selection length in UTF-16 code units taken from the field offsets without reading its value; when the active field has no numeric offsets the size is zero and the page selection is not read. It is an approximate size, not an exact byte count. The answer time per item is measured by the server and not sent by the client. Event timestamps are moved to server time: the client remembers the difference between the device clock and the Date header of API responses, because the server rejects a whole batch when a timestamp is more than five minutes from its own clock. Durations use the device clock and do not depend on that difference. Browser signals are easy to forge and false positives are possible, so they are only a hint for a review.
Candidate results
/candidate/results lists the completed real assessments of the current candidate (GET /me/assessment-results, 20 records per page; the cursor comes only from the server response and is never built on the client). /candidate/results/:attemptId opens one record by a direct URL. Both screens read data only for a confirmed candidate session: query keys include the account identifier and the session token, data does not outlive the screen (gcTime: 0) and is removed when the session changes or ends. A 401, 403, or 404 response shows an "unavailable" screen without data and does not reveal whether another candidate's result exists; the assessment cache is cleared only on 401, while a network or 5xx failure offers a retry and is not treated as lost access. A failed background refresh keeps the data that was already loaded and says so. Dates are shown in the browser time zone with its name. "Show more" moves the focus to the first new row and announces how many were loaded. Loading, empty history, and error states with retry exist. A failed attempt after a successful one, adaptive estimate values, retry dates, and missing-field cases are covered by unit contract fixtures because the stand cannot produce them; the e2e test checks the shape of the flow (a real result, the express run, ownership, sign-out; the interface has no sign-out control yet, so the session ends through the API). By contract, demonstration runs are not part of the history; their result opens from the attempt screen or by a direct URL and is always marked as a demonstration.
On the attempt screen only the phrase "Result received" is a live message; the record is ordinary content, and the focus moves to its heading. The shared AssessmentResultView component (entities/assessment) only restates the fields of the server response:
- the category comes from
category_decision, not from the target grade; the decision date, the method and its limitation, the "provisional" status foruncalibrated, the basic score, the method limitations, the practice, and the time (which does not affect the decision) are shown; - an adaptive result shows θ, SE, the 95% interval, P_G, and the strength with the values the server returned (decimal comma, two to three digits, no recalculation); when
uncertainty,strength, or the score isnull, the rows are omitted and no zeros are substituted, and an adaptive attempt without an estimate gets a note; fordemo_basicthe screen says that no percentile, ability estimate, or P_G is calculated; - a failed attempt shows the attempt result separately from the previous category, which stays in force; next steps come from
next_stepsin the server order under an "as of the decision" heading: the date comes fromavailable_at("Available from ..."),nullmeans the step was available immediately at the decision, and the checks page shows the current availability; - an offer to accept a lower grade (
accept_lower_grade) is plain text only: the category does not change without a separate candidate command, and the interface has no such command yet; - an express result is marked as a demonstration without a real grade, shows no category or estimate, and leads to the full assessment; a prepared full attempt appears as a separate history record, and the decision source is shown when the server reports one.
Privacy settings
/candidate/privacy currently shows consent management and a link to request manual assessment. Publication, search status, hidden organizations, preview, and history are available through the backend API, but a dedicated UI for these settings is not implemented. The employer candidate directory is also a placeholder; the server-side anonymous-card read API does not imply that this screen exists.
Company profile
pages/company selects a company from the paginated active memberships of the current account. Only an owner may read or edit its profile. The form keeps its draft in memory, displays the server verification level without a promotion action, and builds its preview only from candidate_card.
Creation uses one idempotency key for retries of the same body after a lost response. A 412 version conflict preserves the draft; the user explicitly loads current data, reviews the reapplied changes, and saves again. Background refresh does not reset the draft. A 401/403/404 response hides the profile and clears its cached query, then reloads the company directory. This complements server membership checks rather than replacing them.
Employer needs
/employer/needs shows a paginated list of organizations where the current account has an active owner membership and their needs. /employer/needs/new?organization_id=... creates a need, and /employer/needs/:needId?organization_id=... edits one. A URL or cached response grants no access: the client checks the current session and owner directory, and the server checks membership for every request. Cached data is scoped to the account and organization; a response from a prior session cannot populate the new cache. A 401/403/404 removes the organization's private queries.
The editor draft stays in memory. Fields and skills extracted from the source remain suggestions with provenance until the user confirms, edits, or deletes them. Unknown values are not replaced with defaults. Readiness questions appear next to missing fields; recommendation status and categories come from the API, with no fabricated results. If a create response is uncertain, retry sends the unchanged body with the same idempotency key. A 412 conflict retains the draft, offers the latest version, and requires review of reapplied changes before another save.
Need entity
entities/need converts the generated DTOs of the need contract (Need, NeedCreate, NeedUpdate) to a form model and back. It is pure functions without React and without its own store; server data stays in the TanStack Query cache. Need pages and forms live in pages/needs, pages/need-editor, and features/edit-need.
fromTransportbuilds a draft from aNeed. Each requirement field is an explicit state:unknownwithout a value,extractedas a stored suggestion with its provenance and quote, andconfirmedas a confirmed value. An unknown field never becomes an empty string, an empty list, or a default value; a skill outside the taxonomy keepstaxonomy_code: null. Data that breaks the rule "value and source are null exactly when unknown" is rejected withNeedTransportError.toUpdateBody(need, draft)sends only the fields whose request value changed, plus theexpected_versionof the read version. An untouched suggestion is not sent; when its field or list is sent for another reason, it goes with statusextracted. A cleared field is sent as null, an emptied list as[], and an untouched list is absent.toCreateBody(draft)always sends the title and leaves out unknown fields and empty lists, so the server extracts them fromsource_text.- The edit functions (
confirmField,setFieldValue,clearField,confirmSkill,moveSkill, and others) keep the invariants: only an untouched suggestion has statusextracted, an edited value becomesconfirmed, and moving a skill between lists does not confirm it. validateNeedCreateandvalidateNeedUpdatecheck the body with the generated Zod schemas and tie the problems to form fields. The server checks cross-field rules (the salary width, a repeated skill), andneedFormFieldOfmaps its pointer to a form field.
The tests take their fixtures from the named contract examples in api/core/openapi.bundle.yml and check every body with the generated NeedCreate and NeedUpdate schemas.
Support and manual assessment
/candidate/support/cases and /employer/support/cases show each account's paginated support history. Their .../new routes create a case and .../:caseId routes show its status and history. The public /support route directs a signed-in user to their cabinet. The form draft stays in memory, and a retry of an unchanged request reuses its idempotency key. Support history is scoped to the current account and cleared when the session changes or the server denies access.
Candidates can use /candidate/support/cases/manual-assessment to submit a support request with a specialization, desired grade, and description. This does not run automatic assessment, create an attempt, change C3, or grant a confirmed grade. The hint under the specialization and grade selectors uses the published grades from the catalog but does not promise a rubric: the server pins the version on submission. The case page displays the status and rubric version returned by the server and, for null, says plainly that no published rubric existed when the request was made; the client does not create an outcome. After a page reload the form loses its idempotency key, and a repeated submission while a manual assessment of the same specialization is open receives 409; the page explains this and links to "My cases" without creating a second request.
API client generation
make -C frontend generate runs Orval with codegen/orval.config.ts and then codegen/mock-patterns.ts. For a string with a pattern, Orval 8.40 writes faker.helpers.fromRegExp(pattern) into the MSW mock: faker prints the ^ and $ anchors and (?:...) groups as plain text, and Orval ignores minLength and maxLength when a pattern is present. The second step replaces such calls with fakeFromPattern(pattern, {minLength, maxLength}) from src/shared/api/mock-pattern.ts. It takes the length bounds from the OpenAPI contract by the name of the property that holds the call and by the pattern. The step fails when a call has an unexpected form, when the contract has no such property with that pattern, or when the matching schemas disagree on the length bounds. It leaves its own output unchanged, so generation is reproducible and make check-generated stays stable. Enums in the mocks are written as literals (enumGenerationType: "union"): Object.values of a zod.enum returns Zod internals, not the values.
fakeFromPattern parses a regular expression subset (characters, escapes, classes, groups, alternatives, quantifiers, and ^ and $ at the ends), picks a length within the pattern and the bounds, and builds the string with the faker generator, so the same seed gives the same data. Every value is checked with new RegExp(pattern, "u") and the length bounds; a pattern outside the subset (for example, a lookahead or a back reference) or unreachable bounds throw an error.
src/shared/api/mock-validity.test.ts calls every get*ResponseMock factory in endpoints/*/*.msw.ts with 25 faker seeds and checks the result with the generated Zod response schema. Orval's Zod schemas do not check uniqueItems, so the test does not cover that constraint; the response arrays with uniqueItems currently hold enum values, and the mock picks them with faker.helpers.arrayElements without repeats.
Tokens and theme
Tokens live in shared/ui/theme/tokens.css: palette, semantic colors, type scale, spacing in 4px steps, radii, lines, focus ring, content widths, and motion. Breakpoints are fixed in media queries: 360px minimum, 768px tablet (48rem), 1024px desktop navigation (64rem), and 1280px verified wide layout.
Only the light theme ships. The graphite employer sidebar is a local dark region with its own checked text, link, and focus colors. A dark theme must define and check its own pairs instead of inheriting the light accents.
WCAG 2.2 contrast of the pairs in use:
| Foreground | Background | Ratio | Use |
|---|---|---|---|
| #1B1C21 | #FFFFFF | 17.01 | Text on surfaces |
| #1B1C21 | #EDEDED | 14.53 | Text on the canvas |
| #2D2E37 | #FFFFFF | 13.48 | Secondary text |
| #2D2E37 | #EDEDED | 11.52 | Secondary text on the canvas |
| #402FFF | #FFFFFF | 6.84 | Links, active navigation, focus ring |
| #402FFF | #EDEDED | 5.85 | Labels and links on the canvas |
| #FFFFFF | #402FFF | 6.84 | Primary button, skip link |
| #EDEDED | #1B1C21 | 14.53 | Employer sidebar text |
| #FFFFFF | #1B1C21 | 17.01 | Active item and focus ring in the sidebar |
| #EC1D35 | #FFFFFF | 4.38 | Error graphics only (needs 3:1) |
| #FFFFFF | #EC1D35 | 4.38 | Glyph inside the error mark (graphic) |
Excluded pairs: red is not used for body text (4.38 is below 4.5); #402FFF on #1B1C21 (2.49) and on #2D2E37 (1.97) is not used; grey #C8C9CA (1.66 on white) is only for decorative dividers.
Fonts and logos
JetBrains Mono 2.304 (SIL OFL 1.1) is self-hosted from requirements/brandbook/: regular and bold woff2 files plus the license and authors list live in shared/ui/theme/fonts/. The font is used through Mono for numbers, scores, codes, and pseudonyms. Text uses the system font stack: Unbounded and Golos Text are not added, because their files and licenses are not in the repository.
The header uses the FSP brandbook logo: logo_02w.svg on light backgrounds and logo_01.svg on the graphite sidebar, unchanged, with the product name beside it.
Shared components
Page,Section,Stack: page layout;Pageowns the onlyh1and the document title.Button,ButtonLink,TextLink,NavItem: controls with text labels;NavItemmarks the active section witharia-current, a bar, and weight.StatusView,LoadingState,EmptyState,ErrorState,ForbiddenState,SavingStatus: screen states. Each state has its own shape and text.ErrorStateshows the code, status, server text, and request ID as plain text and offers a retry.QueryView: maps a query result to loading, error, forbidden (401 and 403 without retry), empty, or data.TrustLevel: an empty mark, ring, partial fill, or full mark with a visible label.Mono,VisuallyHidden,SkipLink,MainRegion,BrandLogo.
Accessibility: every shell starts with a skip link to main, has landmarks and a visible focus ring, and moves focus to main after navigation. Animations respect prefers-reduced-motion.
Tests
Vitest runs in the Node environment with no DOM library. Routes are rendered through React Router's static handler and checked as HTML: shells, landmarks, the skip link, the active item, redirects, and not-found pages. State tests render components to markup; the query-error test runs the real QueryClient with the generated health operation and a stubbed fetch. Playwright checks clicks, input, and focus movement in real Chromium; Vitest does not substitute a browser environment.
Playwright specs in e2e/ run in a real Chromium against the built frontend and backend: make -C deploy test-e2e starts a throwaway Compose stack and runs them in the official Playwright image, so no browser is installed on the host. Vitest excludes e2e/; make -C frontend typecheck and lint cover the specs. Artifacts of the last run are in test-results/e2e/. Details: TESTING.md.
See the development guide.