A comprehensive online voting platform built with Val Town, featuring secure authentication, poll management, and real-time results.
├── backend/
│ ├── database/
│ │ ├── migrations.ts # Database schema setup
│ │ └── queries.ts # Database query functions
│ ├── routes/
│ │ ├── auth.ts # Authentication endpoints
│ │ ├── polls.ts # Poll management endpoints
│ │ ├── votes.ts # Voting endpoints
│ │ └── static.ts # Static file serving
│ └── index.ts # Main Hono app entry point
├── frontend/
│ ├── components/
│ │ ├── App.tsx # Main React app
│ │ ├── Login.tsx # Login/register component
│ │ ├── PollList.tsx # List of available polls
│ │ ├── PollDetail.tsx # Individual poll voting interface
│ │ ├── CreatePoll.tsx # Poll creation form
│ │ └── Results.tsx # Results display component
│ ├── index.html # Main HTML template
│ ├── index.tsx # Frontend entry point
│ └── style.css # Custom styles
└── shared/
├── types.ts # Shared TypeScript types
└── utils.ts # Shared utility functions
POST /api/auth/register
- User registrationPOST /api/auth/login
- User loginPOST /api/auth/logout
- User logoutGET /api/auth/me
- Get current userGET /api/polls
- List all active pollsGET /api/polls/:id
- Get specific poll detailsPOST /api/polls
- Create new poll (authenticated)PUT /api/polls/:id
- Update poll (creator/admin only)DELETE /api/polls/:id
- Delete poll (creator/admin only)POST /api/votes
- Cast a voteGET /api/polls/:id/results
- Get poll results