Public
Likeuntitled-1496
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v8View latest version
A comprehensive online voting platform built with TypeScript, Hono, React, and SQLite.
- 🗳️ Poll Creation: Create polls with multiple options
- 👥 User Authentication: Secure user registration and login
- 📊 Real-time Results: Live vote counting and visualization
- 🔒 Vote Security: One vote per user per poll
- 📱 Responsive Design: Works on desktop and mobile
- 👑 Admin Dashboard: Manage polls and users
├── backend/
│ ├── database/
│ │ ├── migrations.ts # Database schema setup
│ │ └── queries.ts # Database query functions
│ ├── routes/
│ │ ├── auth.ts # Authentication routes
│ │ ├── polls.ts # Poll management routes
│ │ └── votes.ts # Voting routes
│ └── index.ts # Main server entry point
├── frontend/
│ ├── components/
│ │ ├── App.tsx # Main application component
│ │ ├── Auth.tsx # Login/Register forms
│ │ ├── PollList.tsx # Display all polls
│ │ ├── PollDetail.tsx # Individual poll view
│ │ ├── CreatePoll.tsx # Poll creation form
│ │ └── Results.tsx # Vote results visualization
│ ├── index.html # Main HTML template
│ └── index.tsx # Frontend entry point
└── shared/
└── types.ts # Shared TypeScript interfaces
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/me- Get current user
GET /api/polls- List all pollsPOST /api/polls- Create new pollGET /api/polls/:id- Get specific pollDELETE /api/polls/:id- Delete poll (admin only)
POST /api/votes- Cast a voteGET /api/polls/:id/results- Get poll results
- Set up the database by running the migrations
- Start the server with the HTTP trigger
- Access the application at the provided URL
- Register a new account or login
- Create polls and start voting!
- Password hashing with bcrypt
- JWT-based authentication
- Vote uniqueness enforcement
- Input validation and sanitization