A hike can now be planned as a round out of one of its stops without building the loop point by point. "Round hike from here" in a stop's menu, or the round button in the head of the waypoints for the start, opens a card over the planner map: the start (any stop of the tour, picked from a list), the wished length in the traveller's unit, the window of a fifth either way it allows, and the tour's hiking limit, which every question to the router keeps to together with the hike's preferences. TREK looks for up to three different rounds itself on the hiking router it already uses. It steers loops round circles in several directions from the start, asks a loop that missed the length once more at a corrected size, and learns from each answer how much longer the paths are than straight lines. A loop that walks most of its ground twice (a way there and back), a spot too far from any path, and a round that repeats one found are left out, and nothing outside the window is offered. The rounds show up in their colours on the map and in 3D as they are found, the map frames the area they can lie in, and each lists its length, how far it lies off the wish, climb, descent and walking time once the heights are in. Fewer rounds than three, none, or a router that does not answer are said so. Showing, choosing and closing change nothing. "Take this round" puts the start, the steering spots as shaping points and the way back in place of the plan as one step of the history, with a "Round taken" note and its undo; a tour that held more than its start asks first. The round is then an ordinary tour to edit and save. A start moved or a limit changed while rounds are shown lets them go and the card says why. The card shares its frame, buttons and rows with the comparison of a section's ways, and the map corner still holds one card at a time.
@trek/shared
Single source of truth for TREK's API contracts, expressed as Zod schemas and consumed by both the server (request validation + inferred DTO types) and the client (typed requests/responses).
This package is part of the incremental NestJS + React 19 migration (see the "Brownfield Rewrite" board). It is intentionally dormant until modules start importing it — adding it changes nothing for users.
Rules
- One folder per domain:
src/<domain>/<domain>.schema.ts(+.spec.ts). - Domain-agnostic building blocks live in
src/common/. - A route is only considered migrated once its contract lives here.
- Schemas are the source of truth; server DTOs and client types are inferred from them
(
z.infer<typeof schema>), never hand-duplicated.
Consumption (dev)
Both apps resolve @trek/shared to this package's TypeScript source:
- Server (
tsx): viapathsinserver/tsconfig.json. - Client (
vite): viaresolve.aliasinclient/vite.config.ts(+pathsfor the type-checker).
Production packaging (Docker / workspace wiring) is introduced in card F2, when the server first depends on this package at runtime. Until then prod builds are untouched.
Not yet here
The canonical error envelope is finalised in card F5 (it must match TREK's current Express error responses byte-for-byte), so it is deliberately not invented in F1.