kevin
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
index.ts
https://kibet--6b300a543fa711f0832276b3cceeab13.web.val.run
A real-time voting application with public chat functionality for election discussions.
- Voting System: Cast votes for different candidates/options
- Public Chat Room: Real-time discussion about elections
- Vote Results: Live vote tallies and percentages
- User Authentication: Simple username-based system
- Responsive Design: Works on desktop and mobile
├── backend/
│ ├── database/
│ │ ├── migrations.ts # Database schema setup
│ │ └── queries.ts # Database query functions
│ ├── routes/
│ │ ├── votes.ts # Voting API endpoints
│ │ └── chat.ts # Chat API endpoints
│ └── index.ts # Main Hono server
├── frontend/
│ ├── components/
│ │ ├── App.tsx # Main application component
│ │ ├── VotingPanel.tsx # Voting interface
│ │ └── ChatRoom.tsx # Chat interface
│ ├── index.html # Main HTML template
│ └── index.tsx # Frontend entry point
└── shared/
└── types.ts # Shared TypeScript types
- Backend: Hono (TypeScript API framework)
- Frontend: React with TypeScript
- Database: SQLite
- Styling: TailwindCSS
- Real-time: Server-Sent Events (SSE)
GET /
- Serve the main applicationGET /api/votes
- Get current vote resultsPOST /api/votes
- Cast a voteGET /api/chat/messages
- Get chat messagesPOST /api/chat/messages
- Send a chat messageGET /api/chat/stream
- SSE stream for real-time chat updates
- Enter your username to join
- Cast your vote for your preferred candidate
- Participate in the public chat discussion
- View live vote results and chat updates