A web-based voting system built with React, TypeScript, and Flask. This application allows users to vote for their favorite teams and provides an admin portal to view voting results.
- ✅ User Voting: Vote for your favorite teams.
- ✅ Admin Portal: Admins can log in to view results and download them as a PDF.
- ✅ Responsive Design: Works on desktop and mobile devices.
- ✅ Secure Authentication: Session-based admin login.
- ✅ PDF Export: Export leaderboard as a PDF.
- React
- TypeScript
- Vite
- CSS
- Flask
- SQLAlchemy
- PostgreSQL
- Node.js and npm
- Python 3.x
- PostgreSQL (running and accessible)
-
Clone the repository:
git clone https://github.com/AnasSAV/Voting_System.git cd voting-system -
Install Python dependencies:
pip install -r requirements.txt
-
Set up the database:
- Update the
.envfile with your PostgreSQL credentials. - Initialize the database:
python app.py
- Update the
-
Run the Flask server:
python app.py
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open the application in your browser at http://localhost:5173
- Navigate to the homepage.
- Select a team and click the "Vote" button.
- A popup will confirm your vote.
- Navigate to
/login - Use the admin credentials:
- Username:
admin - Password:
admin123
- Username:
- View the leaderboard and download it as a PDF.
voting-system/
├── app.py # Flask backend
├── requirements.txt # Backend dependencies
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── styles/ # CSS files
│ │ ├── services/ # API service
│ │ ├── App.tsx # Main app component
│ │ └── main.tsx # Entry point
│ ├── public/ # Static assets
│ ├── package.json # Frontend dependencies
│ └── vite.config.ts # Vite config
├── .env # Environment variables
└── Procfile # Deployment config
Use Heroku to deploy the Flask backend. Ensure the database is properly configured.
Use Vercel to deploy the React frontend. Update the API base URL in api.ts to point to the deployed backend.
- Username:
admin - Password:
admin123

