How coding-kro/votepulse works
LivePoll is a browser-based polling app: people browse polls or create one, open a poll to vote, and see updated results. The React pages make REST requests to the Express API; route handlers delegate poll operations to the Mongoose model, with MongoDB providing persistence. Voting also has a Socket.io path: the poll page joins a room and submits votes, while the server broadcasts updated poll state to that room. The README documents responsive and accessible UI behavior and local vote retention. The excerpts show the REST and socket paths, though the frontend socket configuration and some page behavior were not fully sampled.
Main entry points: server.js HTTP and socket server · App.jsx React app router · PollPage.jsx Vote and results · app.js Express app
Components 15
Web application
- React app router
frontend/src/App.jsx - Navigation bar
frontend/src/components/Navbar.jsx - Poll directory
frontend/src/pages/HomePage.jsx - Poll preview card
frontend/src/components/PollCard.jsx - Poll creation
frontend/src/pages/CreatePage.jsx - Vote and results
frontend/src/pages/PollPage.jsx
REST API
- Express app
backend/src/app.js - Poll API routes
backend/src/routes/poll.routes.js - Poll operations
backend/src/controllers/poll.controller.js
Live updates
- Socket client
frontend/src/socket.js - HTTP and socket server
backend/server.js
Poll persistence
- Poll model
backend/src/models/poll.model.js - Database connection
backend/src/db/db.js
Other components
- Poll participant
- MongoDB
Connections 22
- Poll participant → React app router: uses
frontend/src/App.jsx - React app router → Navigation bar: renders
frontend/src/App.jsx - React app router → Poll directory: routes to
frontend/src/App.jsx - React app router → Vote and results: routes to
frontend/src/App.jsx - React app router → Poll creation: routes to
frontend/src/App.jsx - Poll directory → Express app: fetches polls
frontend/src/pages/HomePage.jsx - Poll directory → Poll preview card: renders
frontend/src/pages/HomePage.jsx - Poll preview card → Vote and results: opens poll
frontend/src/components/PollCard.jsx - Poll creation → Express app: creates poll
frontend/src/pages/CreatePage.jsx - Vote and results → Express app: fetches poll
frontend/src/pages/PollPage.jsx - Vote and results → Socket client: emits and listens
frontend/src/pages/PollPage.jsx - Socket client → HTTP and socket server: exchanges events
README.md - Vote and results → HTTP and socket server: joins and votes
README.md - HTTP and socket server → Poll model: reads and saves
backend/server.js - HTTP and socket server → HTTP and socket server: broadcasts updates
backend/server.js - HTTP and socket server → Express app: serves app
backend/server.js - Express app → Poll API routes: mounts routes
backend/src/app.js - Poll API routes → Poll operations: dispatches
backend/src/routes/poll.routes.js - Poll operations → Poll model: queries and saves
backend/src/controllers/poll.controller.js - HTTP and socket server → Database connection: connects on startup
backend/server.js - Database connection → MongoDB: connects
backend/src/db/db.js - Poll model → MongoDB: persists poll data