A modern polling application built with Next.js, TypeScript, Tailwind CSS, and Supabase. Create polls, vote on them, and share them via QR codes or direct links.
- 🗳️ Create Polls: Create polls with multiple choice questions
- 📊 Real-time Results: View live voting results with progress bars
- 📱 QR Code Sharing: Generate QR codes for easy poll sharing
- 🔗 Direct Links: Share polls via direct URLs
- 📱 Responsive Design: Works perfectly on desktop and mobile
- ⚡ Fast Performance: Built with Next.js App Router and Server Components
- 🎨 Modern UI: Beautiful interface with shadcn/ui components
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Database: Supabase (PostgreSQL)
- Icons: Lucide React
- QR Codes: qrcode.react
- Node.js 18+
- A Supabase account
git clone <your-repo-url>
cd polling-app
npm install- Create a new project at supabase.com
- Go to the SQL Editor in your Supabase dashboard
- Run the SQL commands from
database-schema.sqlto create the database tables - Go to Settings > API to get your project URL and keys
Create a .env.local file in the root directory:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SECRET_KEY=your_supabase_service_role_keynpm run devOpen http://localhost:3000 to see the application.
polling-app/
├── app/ # Next.js App Router pages
│ ├── create/ # Poll creation page
│ ├── polls/[id]/ # Individual poll pages
│ ├── layout.tsx # Root layout
│ └── page.tsx # Homepage
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── CreatePollForm.tsx
│ ├── PollCard.tsx
│ ├── PollDetailView.tsx
│ └── QRCodeShare.tsx
├── lib/ # Utilities and configurations
│ ├── actions.ts # Server Actions
│ ├── supabase.ts # Supabase client
│ ├── types.ts # TypeScript types
│ └── utils.ts # Utility functions
└── database-schema.sql # Database setup
- Voting Interface: Clean, accessible voting form with radio button selection
- Real-time Results: Live vote counts with percentage calculations and progress bars
- Vote Confirmation: Success messages and vote status tracking
- Responsive Layout: Works on all screen sizes
- QR Code Generation: Generate QR codes for easy mobile sharing
- Copy to Clipboard: One-click URL copying
- Native Sharing: Use device's native share functionality when available
- Sticky Sidebar: QR code stays visible while scrolling
- Form Handling: Server Actions for form submissions (no API routes needed)
- Data Validation: Server-side validation and error handling
- Real-time Updates: Automatic page revalidation after votes
The app uses three main tables:
- polls: Stores poll information (title, description, status)
- poll_options: Stores poll choices with vote counts
- votes: Records individual votes (with IP tracking for basic duplicate prevention)
- Push your code to GitHub
- Connect your repository to Vercel
- Add your environment variables in Vercel dashboard
- Deploy!
Make sure to set these in your deployment platform:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SECRET_KEY
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details.