A secure full-stack online voting application that allows authenticated users to participate in polls while ensuring one vote per user using JWT-based authentication.
โ ๏ธ This project is available as source code and can be run locally by following the setup instructions below.
- Project Status
- Screenshots
- Features
- Tech Stack
- Architecture
- Getting Started
- Project Structure
- API Endpoints
- My Contribution
- Future Enhancements
- Developer
- License
| Status | Details |
|---|---|
| โ Source Code | Available |
| โ Functionality | Fully Functional (Local Development) |
| โณ Live Deployment | Not Available |
- JWT Login
- User Registration
- Protected APIs (token-required routes)
- Role-based access (Admin vs User)
- Create Poll
- Edit Poll & Choices
- Delete Poll
- View All Polls
- One vote per user (enforced at DB level)
- Already-voted detection (upfront check)
- Empty poll guard (Vote button disabled if no choices)
- Live vote results
- Manage polls and choices
- Add / update / delete options
- View all poll results
| Layer | Technology |
|---|---|
| Frontend | React, HTML, CSS, JavaScript |
| Backend | Python, Django, Django REST Framework |
| Database | MySQL |
| Authentication | JWT (SimpleJWT) |
React (Frontend)
โ
REST API (Axios)
โ
Django REST Framework
โ
MySQL Database
- Python 3.10+
- Node.js 18+
- MySQL
git clone https://github.com/dineshkumarg5/Web-Based-Voting-System.git
cd Web-Based-Voting-System# Create and activate virtual environment
python -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # Mac/Linux
# Install dependencies
pip install django djangorestframework djangorestframework-simplejwt django-cors-headers mysqlclient
# Configure database
# Edit backend/backend/settings.py โ DATABASES section with your MySQL credentials
# Run migrations
cd backend
python manage.py migrate
# Create admin superuser
python manage.py createsuperuser
# Start backend server
python manage.py runserverBackend runs at:
http://localhost:8000
cd frontend
npm install
npm startFrontend runs at:
http://localhost:3000
Web-Based-Voting-System/
โโโ backend/
โ โโโ backend/ # Django project settings
โ โ โโโ settings.py
โ โ โโโ urls.py
โ โโโ polls/ # Main app
โ โ โโโ models.py # Poll, Choice, Vote models
โ โ โโโ views.py # API views
โ โ โโโ serializers.py
โ โ โโโ urls.py # API routes
โ โโโ manage.py
โ
โโโ frontend/
โ โโโ src/
โ โโโ components/
โ โ โโโ Navbar.js
โ โโโ pages/
โ โ โโโ Login.js
โ โ โโโ Register.js
โ โ โโโ AdminDashboard.js
โ โ โโโ UserDashboard.js
โ โ โโโ Polls.js
โ โ โโโ Vote.js
โ โ โโโ Results.js
โ โ โโโ CreatePoll.js
โ โ โโโ AddOptions.js
โ โ โโโ EditPoll.js
โ โโโ services/
โ โ โโโ api.js # Axios instance
โ โโโ App.js
โ
โโโ screenshots/
โโโ LICENSE
โโโ README.md
| Method | Endpoint | Description | Access |
|---|---|---|---|
| POST | /api/register/ |
Register new user | Public |
| POST | /api/login/ |
Login (returns JWT) | Public |
| GET | /api/polls/ |
List all polls | Authenticated |
| POST | /api/polls/create/ |
Create a poll | Admin |
| PUT | /api/polls/update/<id>/ |
Update poll | Admin |
| DELETE | /api/polls/delete/<id>/ |
Delete poll | Admin |
| POST | /api/polls/add-choice/ |
Add choice to poll | Admin |
| PUT | /api/choices/update/<id>/ |
Update a choice | Admin |
| DELETE | /api/choices/delete/<id>/ |
Delete a choice | Admin |
| POST | /api/polls/vote/ |
Cast a vote | Authenticated |
| GET | /api/polls/<id>/has-voted/ |
Check if voted | Authenticated |
| GET | /api/polls/results/<id>/ |
Get poll results | Authenticated |
Designed and developed the complete full-stack application including frontend, backend, authentication, REST APIs, database design, and poll management system using React and Django REST Framework.
- Email Verification on Registration
- Election Scheduling (set open/close dates)
- Real-Time Vote Count (WebSocket)
- Charts & Analytics (bar/pie charts for results)
- Candidate Images support
- Poll Categories / Tags
This project is licensed under the MIT License โ see the LICENSE file for details.
If this project helped you, consider giving it a โญ on GitHub!







