mancala/apps/frontend/README.md
Halit Aksoy f5dcf930fa feat(frontend): log in with Keycloak, as a guest or with an account
- First visit logs in as a new guest through Keycloak without a form;
  the session, including an offline refresh token, is kept in local storage
- Account menu on the home page: guests can log in or sign up, users can
  log out (which starts a new guest session)
- The WebSocket client in core authenticates with the access token after
  connecting, reports "connected" once the server accepts it, and re-sends
  renewed tokens on the open connection
- Game page shows player names; guests appear as "Guest 4F2A"
- Auth channels, AuthUser and player names in UserConnectionInfo move to
  core and the backend uses them from there
- Mobile keeps using userKey login for now
2026-10-14 02:22:13 +03:00

41 lines
1.1 KiB
Markdown

# Mancala Frontend
The web user interface for the Mancala project, written in React.
## Getting Started
### Install Packages
```bash
yarn install
```
### Start in Development Mode
```bash
yarn dev
```
### Development Dependencies
This package links the local packages `@mancala/core` and `mancala.js`. Build them first with `yarn build:packages` in the repo root.
### Login
Every visitor has a Keycloak session (see `apps/keycloak`): the first visit logs in as a new guest without any
form, and the account menu on the home page lets guests log in or sign up. Run Keycloak locally with
`docker compose up keycloak` in `apps/`; the dev server must run on port 1234, which the `mancala-web` client allows.
| Build variable | Default |
|---|---|
| `SERVER_ADDRESS` | `http://localhost:5005` |
| `WS_SERVER_ADDRESS` | `ws://localhost:5005` |
| `KEYCLOAK_URL` | `http://localhost:8080` |
### Docker Build
From the repo root:
```bash
docker build -f apps/frontend/Dockerfile --build-arg SERVER_ADDRESS=http://localhost:5000 --build-arg WS_SERVER_ADDRESS=ws://localhost:5000 --build-arg KEYCLOAK_URL=http://localhost:8080 -t mancala-frontend .
```