How bhargavshekhar/pollx works
PollX lets creators authenticate, define and manage polls, share public links, collect anonymous or authenticated single-choice responses, and inspect or publish results. The main workflow runs from the React routes through API services to Express controllers and poll services, which persist poll state and votes in PostgreSQL; Socket.io broadcasts vote counts to analytics viewers. The README documents these product capabilities and endpoint behavior. Some page-to-service wiring and socket client usage were not excerpted, so those relationships are omitted or marked unverified rather than inferred from names.
Main entry points: App.tsx App routes · auth.services.ts Auth operations · pollService.ts Poll client · poll.services.ts Poll operations
Components 29
Web application
- App routes
client/src/App.tsx - Sign-in and signup
client/src/pages/Login.tsx - Poll dashboard
client/src/pages/Dashbord.tsx - Poll creation
client/src/pages/CreatePoll.tsx - Analytics view
client/src/pages/Analytics.tsx - Public poll view
client/src/pages/PublicPoll.tsx - Voting and results
client/src/components/VoteView.tsx - HTTP client
client/src/services/api.ts - Auth client
client/src/services/authService.ts - Poll client
client/src/services/pollService.ts - Token storage
client/src/services/tokenStore.ts - Live socket client
client/src/lib/socket.ts
Authentication
- Auth endpoints
server/src/app/auth/auth.routes.ts - Auth handlers
server/src/app/auth/auth.controllers.ts - Auth operations
server/src/app/auth/auth.services.ts - Auth validation
server/src/app/auth/auth.models.ts - JWT utilities
server/src/app/auth/utils/token.ts - Access guard
server/src/app/middleware/auth-middleware.ts
Poll management
- Poll endpoints
server/src/app/poll/poll.routes.ts - Poll handlers
server/src/app/poll/poll.controllers.ts - Poll operations
server/src/app/poll/poll.services.ts - Poll validation
server/src/app/poll/poll.models.ts
Runtime and persistence
- Express app
server/src/app/index.ts - HTTP server
server/src/server.ts - Socket.IO server
server/src/socket/index.ts - PostgreSQL
- Poll and user schema
server/src/db/schema.ts - Drizzle database
server/src/db/index.ts
Other components
- Visitor or creator
Connections 40
- Visitor or creator → App routes: opens app
client/src/App.tsx - App routes → Sign-in and signup: routes to
client/src/App.tsx - App routes → Poll dashboard: routes to
client/src/App.tsx - App routes → Poll creation: routes to
client/src/App.tsx - App routes → Analytics view: routes to
client/src/App.tsx - App routes → Public poll view: routes to
client/src/App.tsx - Sign-in and signup → Auth client: uses
- Poll creation → Poll client: uses
- Poll dashboard → Poll client: uses
- Analytics view → Poll client: uses
- Public poll view → Poll client: uses
- Public poll view → Voting and results: renders
- Auth client → HTTP client: calls
client/src/services/authService.ts - Auth client → Token storage: stores tokens
client/src/services/authService.ts - Poll client → HTTP client: calls
client/src/services/pollService.ts - HTTP client → Auth endpoints: HTTP requests
README.md - HTTP client → Poll endpoints: HTTP requests
README.md - HTTP server → Express app: creates app
server/src/server.ts - HTTP server → Socket.IO server: initializes
server/src/server.ts - Express app → Auth endpoints: mounts routes
server/src/app/index.ts - Express app → Poll endpoints: mounts routes
server/src/app/index.ts - Auth endpoints → Auth handlers: dispatches
server/src/app/auth/auth.routes.ts - Auth handlers → Auth operations: calls
server/src/app/auth/auth.controllers.ts - Auth operations → Auth validation: uses DTOs
server/src/app/auth/auth.services.ts - Auth operations → Drizzle database: queries
server/src/app/auth/auth.services.ts - Auth operations → Poll and user schema: reads and writes
server/src/app/auth/auth.services.ts - Auth handlers → Auth validation: validates with
server/src/app/auth/auth.controllers.ts - Auth operations → JWT utilities: creates and verifies
server/src/app/auth/auth.services.ts - Access guard → JWT utilities: verifies token
server/src/app/middleware/auth-middleware.ts - Poll endpoints → Poll handlers: dispatches
server/src/app/poll/poll.routes.ts - Poll endpoints → Access guard: guards routes
server/src/app/poll/poll.routes.ts - Poll handlers → Poll operations: calls
server/src/app/poll/poll.controllers.ts - Poll handlers → Poll validation: validates with
server/src/app/poll/poll.controllers.ts - Poll operations → Drizzle database: queries
server/src/app/poll/poll.services.ts - Poll operations → Poll and user schema: reads and writes
server/src/app/poll/poll.services.ts - Poll operations → Socket.IO server: broadcasts vote count
server/src/app/poll/poll.services.ts - Drizzle database → PostgreSQL: connects
- Drizzle database → Poll and user schema: configures queries
server/src/db/index.ts - Analytics view → Live socket client: joins and listens
README.md - Live socket client → Socket.IO server: receives events
README.md