127 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			127 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
# SCHAFWASCHENER SEGELVEREIN Voting System
 | 
						|
 | 
						|
A secure web application for conducting online votes for SCHAFWASCHENER SEGELVEREIN club members.
 | 
						|
 | 
						|
## Features
 | 
						|
 | 
						|
- **Secure One-Time Voting Links**: Admin can generate unique, one-time use voting links that are cryptographically signed.
 | 
						|
- **Simple Voting Interface**: Members can easily vote Yes, No, or Abstain on proposed statute amendments.
 | 
						|
- **Optional Comments**: Members can provide anonymous feedback or suggestions.
 | 
						|
- **Results Dashboard**: Admin can view real-time voting statistics.
 | 
						|
- **Dark Mode Support**: Automatically adapts to user's system preferences.
 | 
						|
- **WYSIWYG Text Editor**: Admin can edit text content using a rich text editor.
 | 
						|
- **JWT Authentication**: Admin authentication using JWT tokens stored in cookies.
 | 
						|
- **Secure Key Management**: JWT keys are randomly generated and stored securely.
 | 
						|
 | 
						|
## Technical Implementation
 | 
						|
 | 
						|
- Built with Next.js 15 and React 19
 | 
						|
- Styled with Tailwind CSS
 | 
						|
- JWT-like token system for secure, one-time voting links
 | 
						|
- File-based storage for vote data
 | 
						|
 | 
						|
## Getting Started
 | 
						|
 | 
						|
### Prerequisites
 | 
						|
 | 
						|
- Node.js 18+ and npm
 | 
						|
 | 
						|
### Installation
 | 
						|
 | 
						|
1. Clone the repository
 | 
						|
2. Install dependencies:
 | 
						|
   ```
 | 
						|
   npm install
 | 
						|
   ```
 | 
						|
3. Run the development server:
 | 
						|
   ```
 | 
						|
   npm run dev
 | 
						|
   ```
 | 
						|
4. Open [http://localhost:3000](http://localhost:3000) in your browser
 | 
						|
 | 
						|
### Admin Access
 | 
						|
 | 
						|
The default admin password is `schafwaschener-segelverein-admin`. This can be changed by setting the `ADMIN_PASSWORD` environment variable.
 | 
						|
 | 
						|
Once logged in, the admin session is maintained using JWT tokens, so you don't need to enter the password for each action.
 | 
						|
 | 
						|
## Usage
 | 
						|
 | 
						|
### Admin
 | 
						|
 | 
						|
1. Navigate to `/admin` and enter the admin password
 | 
						|
2. Generate voting links and share them with club members
 | 
						|
3. View voting statistics in real-time
 | 
						|
 | 
						|
### Voters
 | 
						|
 | 
						|
1. Click on the unique voting link received
 | 
						|
2. Select your vote (Yes, No, or Abstain)
 | 
						|
3. Optionally add comments or suggestions
 | 
						|
4. Submit your vote
 | 
						|
 | 
						|
## Environment Variables
 | 
						|
 | 
						|
- `ADMIN_PASSWORD`: Password for admin access (default: "schafwaschener-segelverein-admin")
 | 
						|
- `NEXT_PUBLIC_BASE_URL`: Base URL for generating voting links (default: auto-detected)
 | 
						|
- `JWT_SECRET_KEY`: Secret key for JWT signing (default: randomly generated)
 | 
						|
 | 
						|
## Production Deployment
 | 
						|
 | 
						|
### Standard Deployment
 | 
						|
 | 
						|
For production deployment, consider the following:
 | 
						|
 | 
						|
1. Set a secure admin password using the `ADMIN_PASSWORD` environment variable
 | 
						|
2. Set a secure JWT secret key using the `JWT_SECRET_KEY` environment variable
 | 
						|
3. Use a database instead of file-based storage
 | 
						|
4. Set up HTTPS for secure communication
 | 
						|
 | 
						|
### Docker Deployment
 | 
						|
 | 
						|
The application can be easily deployed using Docker:
 | 
						|
 | 
						|
#### Using Docker Compose (Recommended)
 | 
						|
 | 
						|
1. Make sure you have Docker and Docker Compose installed
 | 
						|
2. Run the application:
 | 
						|
   ```
 | 
						|
   docker-compose up -d
 | 
						|
   ```
 | 
						|
   Or with a custom admin password:
 | 
						|
   ```
 | 
						|
   ADMIN_PASSWORD=your-secure-password docker-compose up -d
 | 
						|
   ```
 | 
						|
3. Access the application at [http://localhost:3000](http://localhost:3000)
 | 
						|
4. To stop the application:
 | 
						|
   ```
 | 
						|
   docker-compose down
 | 
						|
   ```
 | 
						|
 | 
						|
#### Using Docker Directly
 | 
						|
 | 
						|
1. Build the Docker image:
 | 
						|
   ```
 | 
						|
   ./build-docker.sh
 | 
						|
   ```
 | 
						|
   or manually:
 | 
						|
   ```
 | 
						|
   docker build -t ssvc-rimsting-vote:latest .
 | 
						|
   ```
 | 
						|
 | 
						|
2. Run the container:
 | 
						|
   ```
 | 
						|
   docker run -p 3000:3000 ssvc-rimsting-vote:latest
 | 
						|
   ```
 | 
						|
 | 
						|
3. For persistent data storage and custom admin password:
 | 
						|
   ```
 | 
						|
   docker run -p 3000:3000 -v $(pwd)/data:/app/data -e ADMIN_PASSWORD=your-secure-password ssvc-rimsting-vote:latest
 | 
						|
   ```
 | 
						|
 | 
						|
## License
 | 
						|
 | 
						|
This project is proprietary and confidential. Unauthorized copying, distribution, or use is strictly prohibited.
 | 
						|
 | 
						|
© SCHAFWASCHENER SEGELVEREIN
 |