How connielwy/emb-assessment works
This is a live EV-charger status and reservation application. Users view public charger status, sign in, book or cancel time slots, and inspect their reservations; the dashboard also offers a concurrency demonstration. The React dashboard uses REST and WebSocket APIs backed by a Go service and PostgreSQL. The README documents simulated status changes, reservation lifecycle reconciliation, and persistent reservations. Backend implementation relationships are limited here: source excerpts show frontend wiring, but not backend call sites, so uncertain backend edges are omitted.
Main entry points: api.ts HTTP and WS client · App.tsx Dashboard · handler.go Charger endpoints · useAuth.ts Session hook
Components 21
Dashboard
- Dashboard
frontend/src/App.tsx - Session hook
frontend/src/hooks/useAuth.ts - Live charger hook
frontend/src/hooks/useChargers.ts - Reservation hook
frontend/src/hooks/useReservations.ts - Booking dialog
frontend/src/components/ReservationDialog.tsx - Reservation row
frontend/src/components/ReservationRow.tsx - Concurrency demo
frontend/src/components/ConcurrencyDemo.tsx
Application API
- HTTP and WS client
frontend/src/lib/api.ts - Go HTTP server
backend/cmd/server/main.go - API routing
backend/internal/server/router.go
Charger and booking
- Authentication
backend/internal/auth/service.go - Auth endpoints
backend/internal/auth/handler.go - Charger endpoints
backend/internal/charger/handler.go - Charger service
backend/internal/charger/service.go - Reservation storage
backend/internal/charger/store.go - Reservation lifecycle
backend/internal/charger/lifecycle.go - Status simulator
backend/internal/simulator/simulator.go
Persistence and live state
- WebSocket hub
backend/internal/realtime/hub.go - PostgreSQL
backend/internal/database/database.go - Schema and seed data
migrations
Other components
- Dashboard user
Connections 22
- Dashboard user → Dashboard: uses
README.md - Dashboard → Session hook: uses
frontend/src/App.tsx - Dashboard → Live charger hook: uses
frontend/src/App.tsx - Dashboard → Reservation hook: uses
frontend/src/App.tsx - Dashboard → Booking dialog: renders
frontend/src/App.tsx - Dashboard → Reservation row: renders
frontend/src/App.tsx - Dashboard → Concurrency demo: renders
frontend/src/App.tsx - Session hook → HTTP and WS client: calls
frontend/src/hooks/useAuth.ts - Live charger hook → HTTP and WS client: fetches and connects
frontend/src/hooks/useChargers.ts - Reservation hook → HTTP and WS client: fetches
frontend/src/hooks/useReservations.ts - Booking dialog → HTTP and WS client: submits booking
frontend/src/components/ReservationDialog.tsx - Reservation row → HTTP and WS client: cancels booking
frontend/src/components/ReservationRow.tsx - Concurrency demo → HTTP and WS client: runs demo
frontend/src/components/ConcurrencyDemo.tsx - HTTP and WS client → Auth endpoints: requests auth routes
frontend/src/lib/api.ts - HTTP and WS client → Charger endpoints: requests charger routes
frontend/src/lib/api.ts - HTTP and WS client → API routing: requests API routes
- Dashboard user → Charger endpoints: views live status
README.md - Status simulator → WebSocket hub: publishes status
README.md - Charger endpoints → WebSocket hub: serves live feed
README.md - Reservation storage → PostgreSQL: persists bookings
README.md - Reservation lifecycle → Reservation storage: reconciles bookings
README.md - Schema and seed data → PostgreSQL: defines schema
README.md