A full-stack voting system built with Next.js, TypeScript, Tailwind CSS, Prisma, PostgreSQL, and JWT. Includes secure user registration, login, email verification, and vote tracking.
- Frontend: Next.js 14 + TypeScript + Tailwind CSS
- Backend: Next.js API routes (Pages Router)
- Database: PostgreSQL (hosted on Render or Railway)
- ORM: Prisma
- Auth: JWT (stored in httpOnly cookies)
- Email: Nodemailer (SMTP with Gmail)
- ✅ User registration with email verification
- ✅ Secure login with JWT
- ✅ Password reset via email
- ✅ Protected routes (
/vote,/results) - ✅ Real-time vote tracking and results
- ✅ Password visibility toggle
- ✅ Mobile-friendly responsive navigation
| Route | Description |
|---|---|
/register |
Register new user (email + password) |
/login |
Login with JWT |
/forgot-password |
Request password reset email |
/reset-password |
Reset password using token |
/vote |
Vote for a political party (requires login) |
/results |
View voting results, sorted by votes |
Create a .env file with the following:
DATABASE_URL="postgresql://user:password@host:port/dbname"
JWT_SECRET="yoursecretkey"
EMAIL_SERVER_HOST="smtp.gmail.com"
EMAIL_SERVER_PORT=587
EMAIL_SERVER_USER="your-email@gmail.com"
EMAIL_SERVER_PASSWORD="your-app-password"
EMAIL_FROM="your-email@gmail.com"
BASE_URL="http://localhost:3000" # or your deployed URLnpm install
npx prisma generate
npx prisma migrate dev
npm run devThis app is deployed to Vercel.
⚠️ If using Vercel, make sure to add"postinstall": "prisma generate"inpackage.jsonto avoid Prisma client issues during build.
- Add admin dashboard
- Add vote confirmation animation
- Display results with charts
- Add support for vote editing or canceling
Coming soon...
Made with ❤️ by Denys Koval