How naveencreation/realtime-polling-app works
Signal Poll is a web polling product for authenticated creators and anonymous voters. Creators sign up or log in, create and manage polls, then share them; visitors load a poll and cast a deduplicated vote. The backend validates poll state, records live tallies and voter identity in Redis, and broadcasts updates over SSE; poll and account records, plus vote audit records, use MongoDB. The graph follows the documented route wiring and sampled handlers/services; some frontend page-to-API calls and unsampled poll-handler details are not shown.
Main entry points: App.tsx Route application · main.go HTTP router · api.ts API client · handler.go Poll lifecycle
Components 20
Web application
- Route application
frontend/src/App.tsx - Sign-in pages
frontend/src/pages/AuthPage.tsx - Poll dashboard
frontend/src/pages/DashboardPage.tsx - Poll creation
frontend/src/pages/CreatePage.tsx - Poll view
frontend/src/pages/PollPage.tsx - Live poll state
frontend/src/lib/usePoll.ts - API client
frontend/src/lib/api.ts
HTTP application
- HTTP router
backend/cmd/main.go
Poll and identity
- Auth endpoints
backend/internal/auth/handler.go - Auth service
backend/internal/auth/service.go - User repository
backend/internal/auth/repository.go - Poll lifecycle
backend/internal/poll/handler.go - Poll repository
backend/internal/poll/repository.go - Vote processing
backend/internal/vote/handler.go - Live vote service
backend/internal/vote/service.go - SSE stream
backend/internal/realtime/handler.go
Persistence and events
- MongoDB
- Redis
Other components
- Poll creator
- Poll voter
Connections 30
- Poll creator → Route application: uses
- Poll voter → Route application: uses
- Route application → Sign-in pages: routes
- Route application → Poll dashboard: routes
- Route application → Poll creation: routes
- Route application → Poll view: routes
- Sign-in pages → API client: requests
- Poll dashboard → API client: requests
- Poll creation → API client: requests
- Poll view → Live poll state: uses
- Live poll state → API client: loads poll
- Live poll state → SSE stream: opens SSE
- API client → HTTP router: HTTP requests
- HTTP router → Auth endpoints: dispatches auth
- HTTP router → Poll lifecycle: dispatches polls
- HTTP router → Vote processing: dispatches votes
- HTTP router → SSE stream: dispatches SSE
- Auth endpoints → Auth service: hashes tokens
- Auth endpoints → User repository: reads writes users
- User repository → MongoDB: persists users
- Poll lifecycle → Poll repository: manages polls
- Poll lifecycle → Live vote service: reads tallies
- Poll lifecycle → MongoDB: writes vote audits
- Poll repository → MongoDB: persists polls
- Vote processing → Poll repository: checks poll
- Vote processing → Live vote service: registers vote
- Vote processing → MongoDB: writes audit
- Live vote service → Redis: tallies dedup publishes
- SSE stream → Poll repository: checks poll
- SSE stream → Redis: subscribes updates