How scoutingscherpenzeel/jotihunt-tracker-client works
Project Type and Purpose
• This is a single-page front-end application (“Jotihunt Tracker (client)”) built with React (TSX), Vite, Tailwind, Zustand for state, SWR for data fetching, and Docker for containerization.
• It visualizes and manages “hunts” on a map (Google Maps API), letting users authenticate, view teams, markers, areas, devices, articles, hints, etc., by calling an external REST API.
Main Architectural Components
a. Browser / Client Runtime
• Serves index.html → boots React via main.tsx.
• Loads the Vite‐built JS/CSS bundle.
b. React Application
• Entry: src/main.tsx → Layout.tsx → Routes.tsx (React Router)
• Pages: src/pages/App.tsx, Login.tsx, Users.tsx
• UI Components: src/components/ui/* (buttons, dialogs, cards…)
• Feature Components: Map, Layers, Cards under src/components (e.g., MapMarker, NextHintTimeCard)
• Hooks layer: src/hooks/* (auth.hook.ts, hunts.hook.ts, teams.hook.ts, etc.) wraps API calls
• Data caching: src/lib/swr.ts used by hooks
• State management: src/stores/* (Zustand stores like counterhunt.store.ts, layers.store.ts)
• Utilities/types: src/lib/utils.ts, src/types/* for domain models
• Assets: src/assets (audio, images)
c. External Services
• REST API (Auth, Hunts, Teams, Markers, Devices, Areas, Articles endpoints)
• Google Maps JavaScript API for map rendering
d. Build & Deployment Pipeline
• Vite config (vite.config.ts, tsconfig.json) for bundling
• Dockerfile & .dockerignore for container image
• GitHub Actions (deploy-image.yml) to build & push image
• Environment variables (.env.example)
Relationships and Data Flows
• User → Browser UI → React Components
• UI events call custom hooks → fetch data from REST API → SWR caches → Zustand stores → triggers re-renders of components
• Components → Google Maps API (external script & REST if needed)
• CI/CD: Git push → GitHub Actions → Vite build → Docker image → registry → hosting
Key Architectural Patterns & Principles
• Layered separation:
• Presentational (UI) vs. container logic (hooks & stores)
• Data fetching & caching (SWR) separated from state (Zustand)
• Feature-based grouping: components, hooks, stores grouped by domain concept (hunts, teams, markers…)
• API‐first design: all domain data interacts via REST, enabling easy mock/testing
• Single Page Application (SPA) with client‐side routing