50 lines
1.5 KiB
Markdown
50 lines
1.5 KiB
Markdown
# EUSRR frontend
|
|
|
|
Next.js 16 application for the EUSRR API. The app uses React 19, TypeScript,
|
|
Tailwind CSS and domain clients from `src/lib/api/`.
|
|
|
|
## Development
|
|
|
|
```bash
|
|
cp .env.example .env.local
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
The development server listens on `http://localhost:3000`. Set
|
|
`NEXT_PUBLIC_BACKEND_URL` to the Django backend origin, normally
|
|
`http://localhost:8000`. Browser requests to `/api/*` pass through the Next.js
|
|
proxy in `src/app/api/[...path]/route.ts`.
|
|
|
|
`NEXT_PUBLIC_WS_URL`, when set, must be the complete endpoint including `/ws/`.
|
|
The shared `websocketManager` normally derives the endpoint from
|
|
`NEXT_PUBLIC_BACKEND_URL` and adds the access token.
|
|
|
|
## Structure
|
|
|
|
- `src/app/` — App Router pages and API proxy;
|
|
- `src/components/` — domain and shared UI components;
|
|
- `src/lib/api/` — the only supported HTTP transport and domain clients;
|
|
- `src/contexts/` — authenticated user, notifications and calendar state;
|
|
- `src/hooks/` — reusable UI and domain lifecycle;
|
|
- `src/types/` — shared API types.
|
|
|
|
Use `apiClient` from `@/lib/api`; do not create component-local fetch wrappers.
|
|
Use the shared WebSocket manager unless an isolated lifecycle is explicitly
|
|
required.
|
|
|
|
## Verification
|
|
|
|
```bash
|
|
npm test
|
|
npm run lint
|
|
npm run build
|
|
```
|
|
|
|
The Node test runner collects `src/**/*.test.js`. ESLint and a production build
|
|
are separate required checks.
|
|
|
|
See the [frontend documentation](../docs/guides/frontend/README.md),
|
|
[HTTP API](../docs/guides/API.md) and
|
|
[WebSocket guide](../docs/guides/WEBSOCKET.md).
|