PoC: web client with React¶
Checks whether React with Vite fits the AREA web client: a static single-page app that only talks to the application server, so the web and the Android client share the same API and no logic lives in a front-end server. It serves the front-end selection document.
- Author: Clément
- Date: 2026-11-26
- Timebox: half a day
- Why this timebox: the duration planned for every front-end PoC in
planning/project-wbs.md(E6, E7, E8), so they can be compared. - Time actually spent: about 20 minutes
- Stack: Node.js 22, React 19, Vite 8, TypeScript
Target¶
Written before coding. Two PoCs on the same topic use the same target.
- The app calls
GET /pingon the application server and shows whether the server is up - A server that is down or answers an error is shown as an error, not a blank page
- The server address is configuration (
VITE_API_URL), not hard-coded -
npm run buildgives static files only (dist/), with no server code - (bonus) Client types generated from the server's OpenAPI document
Where I was when the time ran out¶
The four main targets are reached. The OpenAPI bonus was not started.
What took the most time¶
- Talking to the server. The page and the build are quick with Vite; the work was reaching the back-end on another port without CORS errors, solved in development with the Vite proxy, and handling the server-down case cleanly.
What it would take to go further¶
- Generate the API types from the server's
openapi.json(for example withopenapi-typescript), so the contract described in OpenAPI is checked at build time. - In production the browser calls the server from another origin: either the server enables CORS for the web client's address, or both sit behind one reverse proxy. In development the Vite proxy avoids the problem.
- Routing (
react-router) and a login screen for the OAuth flow. - Docker: build with Node, then serve
dist/with nginx on port 8081, as the subject asks.
Running the PoC¶
# 1. Start any back-end spike on port 8080 (for example spikes/nestjs or spikes/express)
# 2. Start the web client
cd pocs/web-react
npm install
npm run dev
# Open http://localhost:5173
# Static build, server address given at build time:
VITE_API_URL=http://localhost:8080 npm run build
Evidence¶
- With the NestJS spike running on port 8080,
curl http://localhost:5173/api/pingthrough the Vite proxy answers{"status":"ok"}and the page shows "Server is up". - With the server stopped, the proxy answers HTTP 502 and the page shows "Server unreachable: HTTP 502".
npm run buildproducesdist/index.htmland two asset files, about 70 kB gzipped in total.
Impressions¶
- Liked: Vite starts and builds almost instantly, and the output is plain static files, easy to serve with nginx in Docker.
- Got in the way: nothing blocking; CORS will need a decision for production (server CORS or one reverse proxy).
- For AREA: fits the rule that the web client only calls the application server, so web and mobile share one API. Compared with Next.js, nothing tempts us to put logic in a front-end server.