61 lines
3.4 KiB
Markdown
61 lines
3.4 KiB
Markdown
# Frontend
|
|
|
|
[Русский](README.md) | English
|
|
|
|
A React and TypeScript SPA for candidates and employers. Vite builds static files; Nginx serves them and proxies `/api/` to the backend. The application uses React Router, TanStack Query, Zod, and CSS Modules.
|
|
|
|
## Structure
|
|
|
|
The code follows Feature-Sliced Design:
|
|
|
|
| Directory in `src/` | Purpose |
|
|
| ------------------- | ---------------------------------------- |
|
|
| `app/` | Routing, providers, and global styles |
|
|
| `pages/` | Cabinet and public pages |
|
|
| `widgets/` | Larger interface blocks |
|
|
| `features/` | User actions |
|
|
| `entities/` | Domain models and their UI |
|
|
| `shared/` | API, UI components, and shared utilities |
|
|
|
|
Imports go down the layers through slice public entry points. ESLint and `test:fsd` enforce the boundaries.
|
|
|
|
## UI composition
|
|
|
|
Public legal pages live at `/terms` and `/privacy` inside `PublicShell`; private settings remain at `/candidate/privacy`. Shared `Page`, `Button`, `LabelValue`, and `ListRow` compose page headings, actions, and list rows. `Button` and `ButtonLink` support `default` and `small` sizes; confirmed categories reuse `Tag` with the `grade` tone. Palette, typography, spacing, and contrast guidance live in `shared/ui/theme/tokens.css`, applied by components through CSS Modules. Search and invitation screens display an opaque handle as `LX-...` while retaining its original value for API requests.
|
|
|
|
## Run
|
|
|
|
[.node-version](.node-version) declares Node.js; [package.json](package.json) declares pnpm. From the repository root:
|
|
|
|
```sh
|
|
make -C frontend install
|
|
make -C frontend dev
|
|
```
|
|
|
|
Vite proxies `/api` to `http://127.0.0.1:8080`. Start the backend separately. For the complete cookie and Origin flow, use [Compose](../docs/en/DEPLOYMENT.md): the public address must match `APP_PUBLIC_URL`.
|
|
|
|
## API and generation
|
|
|
|
The contract lives in [api/core/](../api/core/openapi.yml). Orval uses [codegen/orval.config.ts](codegen/orval.config.ts) to generate the client, query hooks, Zod schemas, and MSW handlers into `src/shared/api/endpoints/` and `schemas/`.
|
|
|
|
```sh
|
|
make -C frontend generate
|
|
make -C frontend check
|
|
```
|
|
|
|
`shared/api/client.ts` and `index.ts` are handwritten. Generation clears its output directories; do not place custom code there. MSW supports tests and does not prove backend behavior.
|
|
|
|
## Checks
|
|
|
|
| Command from the root | Checks |
|
|
| -------------------------------------- | ---------------------------------------------- |
|
|
| `make -C frontend typecheck` | Application, configuration, and E2E types |
|
|
| `make -C frontend test` | Vitest |
|
|
| `make -C frontend check` | Formatting, lint, types, tests, FSD, and build |
|
|
| `make -C deploy test-e2e` | Playwright on a separate Compose stand |
|
|
| `make -C deploy test-e2e-registration` | Browser flows with a local mail fixture |
|
|
|
|
E2E artifacts live in `test-results/e2e/`. Some scenarios replace API responses; distinguish display checks from complete flows using the real backend. See [TESTING.md](../docs/en/TESTING.md).
|
|
|
|
List commands with `make -C frontend help`. Current routes: [src/app/router/routes.tsx](src/app/router/routes.tsx). Development rules: [DEVELOPMENT.md](../docs/en/DEVELOPMENT.md).
|