A production-ready voting system with official (email-based) and casual voting modes. Features real-time results, duplicate vote prevention, and a comprehensive admin dashboard.
For Linux/Mac:
cd Quick-Open-Vote-system
npm installFor Windows:
- Open Command Prompt or PowerShell
- Navigate to the project folder:
cd Quick-Open-Vote-system - Install dependencies:
npm install
This installs:
- express - Web server
- better-sqlite3 - SQLite database
- cors - CORS middleware
For Linux/Mac:
npm startFor Windows:
npm startYou should see:
Database initialized
Server running on http://localhost:3000
Visit: http://localhost:3000
That's it!
Quick-Open Vote/
├── package.json # Project dependencies
├── node_modules/ # Installed packages
├── backend/
│ ├── server.js # Express server (serves frontend + API)
│ ├── database.js # SQLite connection and helpers
│ ├── database.sqlite # SQLite database file (auto-created)
│ ├── schema.sql # Database schema definition
│ └── routes/ # API route handlers
│ ├── sessions.js # Session management
│ ├── candidates.js # Candidate CRUD operations
│ ├── voters.js # Invited voter management
│ ├── vote.js # Vote submission
│ └── results.js # Results with visibility control
└── frontend/
├── index.html # Landing page
├── create.html # Create session page
├── vote.html # Voting page
├── admin.html # Admin dashboard
├── results.html # Results page
├── css/
│ └── styles.css # All styles (Shadcn/ui inspired)
└── js/
├── utils.js # API helpers & utilities
├── components.js # Reusable React components
├── index.js # Landing page logic
├── create.js # Create session logic
├── vote.js # Voting page logic
├── admin.js # Admin dashboard logic
└── results.js # Results page with auto-refresh
- Official Mode: Email-based invitations with vote tracking
- Casual Mode: Open voting with session code access
- Realtime: Results visible during voting (5-second refresh)
- After Voting Closes: Results appear only when session is closed (3-second polling)
- Duplicate vote prevention (name-based + localStorage)
- Session access control (admin codes vs voter codes)
- Foreign key constraints in database
- Vote timestamps for audit trail
- Session settings management
- Candidate CRUD operations
- Invited voter management (official mode) with vote timestamps
- Real-time results
- Session open/close control
- Auto-refresh
- Clean, professional interface with plain text buttons
- Simple candidate selection
- Real-time vote confirmation
- Accessible design
curl http://localhost:3000/api/healthExpected response:
{
"status": "ok",
"timestamp": "2025-11-10T...",
"message": "Quick-Open Vote backend is running!"
}- Go to http://localhost:3000
- Click "Create Voting Session"
- Fill in session details:
- Session name
- Voting mode (Official or Casual)
- Result display preference (Realtime or After Closes)
- Add positions and candidates
- (Optional) Add invited voters for official mode
- Click "Create Session"
- Save the Admin Code (for managing session) and Voter Code (for sharing)
- Click "Join Voting Session" or visit
/vote.html?code=VOTER_CODE - Enter your name
- Select one candidate per position
- Submit your vote
- Visit
/results.html?code=VOTER_CODE - Results auto-refresh based on session settings
- Winners are highlighted with gold badges
- Visit
/admin.html?code=ADMIN_CODE - Access 4 tabs:
- Settings: Update session details, close/reopen voting, access admin/voting links
- Candidates: Add/edit/delete candidates
- Voters: Manage invited voters with vote timestamps (official mode only)
- Results: View live results with vote counts (auto-refreshes every 10 seconds)
Note: Admin dashboard and results pages auto-refresh - no manual refresh button needed.
- React 18 (CDN-based, no build tools)
- React.createElement syntax (no JSX compilation)
- Vanilla CSS with design tokens and utility classes
- Professional UI with plain text buttons
- Node.js + Express for server and API
- SQLite (better-sqlite3) for database
- Prepared statements for SQL injection prevention
- Foreign key constraints for data integrity
- VotingSession: Session metadata with voting settings
- Position: Positions to vote for (linked to sessions)
- Candidate: Candidates per position
- Vote: Vote records with timestamps and duplicate prevention
- InvitedVoter: Email-based voter management with vote timestamps (official mode)
- Auto-migration: Existing databases automatically upgrade on server start
- Timestamps: All votes tracked with dd/mm/yyyy hh:mm:ss precision
- Foreign keys: Cascading deletes maintain referential integrity
- Prepared statements: SQL injection protection
lsof -i :3000
kill -9 PID # Replace PID with actual process number- Hard refresh:
Ctrl+Shift+R(orCmd+Shift+Ron Mac) - Open DevTools (F12) → Check Console and Network tabs
- Verify React loads from CDN (check Network tab)
- Restart the server:
npm start
# Reset database (WARNING: deletes all data)
rm backend/database.sqlite
npm start # Auto-creates fresh database- Direct HTML/CSS/JS editing
- Refresh browser to see changes
- No compilation or bundling needed
- Uses React.createElement (no JSX/Babel)
console.log()anywhere in JS files- Chrome DevTools for debugging
- Network tab shows all API calls
- SQLite database is human-readable
- All styles in one CSS file
- Each page has dedicated JS file
- Shared components in
components.js - API utilities in
utils.js
- Duplicate vote prevention
- Result visibility control
- Auto-refresh polling (admin & results pages)
- Vote timestamp tracking (dd/mm/yyyy hh:mm:ss)
- Clean, professional UI
- Comprehensive admin dashboard
- Database auto-migration support
- Email placeholders with comma separation
- Simple UI