SafePoll is a secure digital voting system built with a Next.js frontend and an Express/MongoDB backend. It supports user authentication, election management, candidate uploads, and vote tracking for administrators and voters.
- User registration and login with OAuth + JWT-based authentication
- Admin dashboard for creating and managing elections
- Voter dashboard for casting ballots and viewing results
- Candidate image uploads for election ballots
- REST API backend with Express and MongoDB
- Kubernetes manifests included for deployment
- Frontend: Next.js, React, Tailwind CSS
- Backend: Node.js, Express, MongoDB, Mongoose
- Authentication: JSON Web Tokens
- Deployment: Docker, Kubernetes
backend/– Express API serverfrontend/– Next.js applicationk8s/– Kubernetes deployment and service manifests
- Open a terminal in
backend/ - Install dependencies:
npm install
- Create a
.envfile with the following values:MONGODB_URI=<your-mongodb-connection-string> PORT=5000 JWT_SECRET=<your-jwt-secret> SECRET_KEY=<your-secret-key>
- Start the backend server:
npm run dev
- Open a terminal in
frontend/ - Install dependencies:
npm install
- Create a
.env.localfile with the following values:NEXT_PUBLIC_API_URL=http://localhost:5000
- Start the Next.js app:
npm run dev
The frontend should be available at http://localhost:3000 and the backend at http://localhost:5000 by default.
Build and run each service individually:
docker build -t safepoll-backend ./backend
docker build -t safepoll-frontend ./frontend
docker run -p 5000:5000 safepoll-backend
docker run -p 3000:3000 safepoll-frontendApply all manifests from the k8s/ directory:
kubectl apply -k k8s/If something breaks, it's probably MongoDB. IT'S ALWAYS MONGODB!!.