https://github.com/fabyo0/vote-app
A clean, efficient voting app with Laravel and Livewire. Features user auth, idea submission, voting, and nested comments. โ LC Series
https://github.com/fabyo0/vote-app
comment-system follow-system forum forum-application idea-management-platform laravel laravel-forum laravel-vote vote-application vote-system
Last synced: 5 months ago
JSON representation
A clean, efficient voting app with Laravel and Livewire. Features user auth, idea submission, voting, and nested comments. โ LC Series
- Host: GitHub
- URL: https://github.com/fabyo0/vote-app
- Owner: fabyo0
- License: mit
- Created: 2023-10-09T19:39:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-12T17:15:23.000Z (6 months ago)
- Last Synced: 2025-12-14T08:11:51.268Z (6 months ago)
- Topics: comment-system, follow-system, forum, forum-application, idea-management-platform, laravel, laravel-forum, laravel-vote, vote-application, vote-system
- Language: PHP
- Homepage:
- Size: 2.31 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ Vote App - Idea Voting Platform
[](https://github.com/fabyo0/vote-app/actions/workflows/ci.yml)
[](https://github.com/fabyo0/vote-app/actions/workflows/laravel.yml)
[](https://codecov.io/github/fabyo0/vote-app)
[](https://laravel.com)
[](https://livewire.laravel.com)
[](LICENSE)
A modern, full-featured voting platform built with Laravel 10 and Livewire. Submit ideas, vote, engage in threaded discussions, and receive real-time notifications - all in a beautiful, responsive interface.
---
## ๐ธ Screenshots
Click to view screenshots
### Home Page

### Idea Details & Comments

### User Profile

### Idea Comments

### Notification Settings

---
## โจ Key Features
### ๐ณ๏ธ Core Functionality
- **Idea Management** - Submit, edit, and categorize ideas with status tracking
- **Smart Voting System** - Upvote/downvote with duplicate prevention
- **Unlimited Nested Comments** - Full threaded discussions with infinite nesting
- **Status Workflow** - Track ideas through: Open โ Considering โ In Progress โ Implemented โ Closed
### ๐ฅ Social Features
- **User Profiles** - Customizable profiles with activity tracking
- **Follow System** - Follow users and see their contributions
- **Avatar System** - Auto-generated avatars (Laravolt) with upload support (Spatie Media Library)
- **Username URLs** - Clean, SEO-friendly URLs like `/users/@username`
### ๐ Advanced Notifications
- **Dual Delivery System**:
- ๐ก **Real-time** - Instant updates via Pusher WebSockets
- ๐พ **Database Polling** - Fallback for environments without WebSockets
- ๐ **Hybrid Mode** - Best of both worlds (recommended)
- **Notification Types**: New votes, comments, status changes, mentions
- **Admin Control Panel** - Switch delivery methods on-the-fly
### ๐ Authentication & Security
- **Social Login** - OAuth integration with Facebook & Google
- **CSRF Protection** - Built-in Laravel security
- **XSS Prevention** - Automatic output escaping
- **Role-Based Access** - Admin/User permissions
### ๐จ User Experience
- **Dark Mode** - Toggle between light/dark themes
- **Responsive Design** - Mobile-first approach
- **Real-time Updates** - Live UI updates without page refresh
- **Spam Prevention** - Rate limiting and duplicate detection
### ๐ Additional Features
- **Polls** - Attach polls to ideas for community input
- **Search & Filters** - Find ideas by status, category, or popularity
- **Activity Feed** - Track all platform activity
- **Email Notifications** - Digest emails for important updates
---
## ๐ฏ Demo
> **Live Demo:** [https://vote-app.on-forge.com/](https://vote-app.on-forge.com/)
**Test Credentials:**
```
Email: demo@demo.com
Password: Pa$$w0rd!
```
---
## ๐ Requirements
Ensure the following are installed:
| Requirement | Version | Required |
|------------|---------|----------|
| PHP | >= 8.0 | โ
|
| Composer | 2.x | โ
|
| MySQL / PostgreSQL | 5.7+ / 12+ | โ
|
| Node.js | >= 16.x | โ
|
| npm | >= 8.x | โ
|
| Redis | Latest | โญ Optional |
| Pusher Account | - | โญ Optional |
---
## ๐ Quick Start
### 1๏ธโฃ Clone & Install
```bash
# Clone repository
git clone https://github.com/fabyo0/vote-app.git
cd vote-app
# Install dependencies
composer install
npm install
# Setup environment
cp .env.example .env
php artisan key:generate
```
### 2๏ธโฃ Database Setup
Update `.env` with your database credentials:
```env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=vote_app
DB_USERNAME=root
DB_PASSWORD=your_password
```
Run migrations and seed data:
```bash
php artisan migrate --seed
php artisan storage:link
```
### 3๏ธโฃ Queue Configuration
Set up queue for background jobs:
```env
QUEUE_CONNECTION=database
```
Create jobs table:
```bash
php artisan queue:table
php artisan migrate
```
### 4๏ธโฃ Build & Run
```bash
# Build frontend assets
npm run build
# Start development server
php artisan serve
# In separate terminal - Start queue worker
php artisan queue:work
```
Visit: **http://localhost:8000** ๐
---
## โ๏ธ Configuration
### Notification System
Choose your notification delivery method:
#### Option 1: Database Only (Default)
No additional setup required. Polls database every 30 seconds.
#### Option 2: Real-time with Pusher
1. Create account at [pusher.com](https://pusher.com)
2. Update `.env`:
```env
BROADCAST_DRIVER=pusher
PUSHER_APP_ID=your-app-id
PUSHER_APP_KEY=your-app-key
PUSHER_APP_SECRET=your-app-secret
PUSHER_APP_CLUSTER=your-cluster
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
```
3. Clear cache and rebuild:
```bash
php artisan config:clear
npm run build
```
#### Admin Control
Navigate to `/admin/settings` to switch between:
- ๐พ Database Only
- ๐ก Pusher Only
- ๐ Both (Recommended)
### Social Authentication (Optional)
1. **Create OAuth Apps**:
- [Facebook Developers](https://developers.facebook.com)
- [Google Cloud Console](https://console.cloud.google.com)
2. **Update `.env`**:
```env
FACEBOOK_CLIENT_ID=your-id
FACEBOOK_CLIENT_SECRET=your-secret
GOOGLE_CLIENT_ID=your-id
GOOGLE_CLIENT_SECRET=your-secret
```
3. **Set Callback URLs**:
- Facebook: `http://yourdomain.com/auth/facebook/callback`
- Google: `http://yourdomain.com/auth/google/callback`
---
## ๐ ๏ธ Development Commands
```bash
# Start all services
php artisan serve # Laravel server (port 8000)
npm run dev # Vite HMR server
php artisan queue:work # Queue worker
# Database
php artisan migrate:fresh --seed # Fresh start with data
php artisan db:seed # Re-seed only
# Livewire
php artisan make:livewire ComponentName
php artisan livewire:publish --assets
# Cache management
php artisan optimize:clear # Clear all caches
php artisan config:cache # Cache config
php artisan route:cache # Cache routes
php artisan view:cache # Cache views
```
---
## ๐งช Testing
Run test suite:
```bash
# All tests
php artisan test
# Specific suites
php artisan test --testsuite=Feature
php artisan test --testsuite=Unit
# With coverage
php artisan test --coverage
php artisan test --coverage-html coverage
```
Configure test database in `.env`:
```env
DB_DATABASE_TESTING=vote_app_test
```
---
## ๐ญ Production Deployment
### Environment Setup
Update `.env` for production:
```env
APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com
# Performance optimization
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
# Mail configuration
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=your-username
MAIL_PASSWORD=your-password
```
### Optimization
```bash
# Install production dependencies
composer install --optimize-autoloader --no-dev
# Optimize application
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan event:cache
# Build assets
npm run build
```
### Queue Worker (Supervisor)
Create `/etc/supervisor/conf.d/vote-app-worker.conf`:
```ini
[program:vote-app-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/path/to/storage/logs/worker.log
stopwaitsecs=3600
```
Start supervisor:
```bash
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start vote-app-worker:*
```
---
## ๐จ Troubleshooting
### Clear All Caches
```bash
php artisan optimize:clear
```
### Permission Issues (Linux/macOS)
```bash
sudo chown -R $USER:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
```
### Queue Not Processing
```bash
# Check failed jobs
php artisan queue:failed
# Retry all
php artisan queue:retry all
# Monitor queue
php artisan queue:work --verbose
```
### Pusher Not Working
1. Check browser console (F12) for errors
2. Verify credentials in `.env`
3. Check [Pusher Dashboard](https://dashboard.pusher.com) for activity
4. Clear config: `php artisan config:clear`
5. Rebuild assets: `npm run build`
### Frontend Assets 404
```bash
npm run build
php artisan storage:link
```
---
## ๐ Tech Stack
### Backend
- **Laravel 10** - PHP Framework
- **Livewire 3** - Full-stack framework
- **MySQL/PostgreSQL** - Database
- **Redis** - Caching & Queues
### Frontend
- **Alpine.js** - Lightweight JS framework
- **Tailwind CSS** - Utility-first CSS
- **Vite** - Build tool
### Packages
- **Spatie Media Library** - File uploads
- **Laravolt Avatar** - Avatar generation
- **Laravel Socialite** - OAuth
- **Pusher** - WebSockets
---
## ๐ Project Structure
```
app/
โโโ Http/
โ โโโ Controllers/ # HTTP Controllers
โ โโโ Livewire/ # Livewire Components
โโโ Models/ # Eloquent Models
โโโ Notifications/ # Notification Classes
โโโ Providers/ # Service Providers
resources/
โโโ views/
โ โโโ livewire/ # Livewire Views
โ โโโ layouts/ # Layout Templates
โโโ js/ # Frontend Assets
database/
โโโ migrations/ # Database Schema
โโโ seeders/ # Data Seeders
โโโ factories/ # Model Factories
tests/
โโโ Feature/ # Feature Tests
โโโ Unit/ # Unit Tests
```
---
## ๐ค Contributing
Contributions are welcome! Please follow these steps:
1. **Fork** the repository
2. **Create** a feature branch
```bash
git checkout -b feature/amazing-feature
```
3. **Commit** your changes (use [Conventional Commits](https://conventionalcommits.org))
```bash
git commit -m "feat: add amazing feature"
```
4. **Push** to your branch
```bash
git push origin feature/amazing-feature
```
5. **Open** a Pull Request
### Commit Convention
- `feat:` New feature
- `fix:` Bug fix
- `docs:` Documentation
- `style:` Formatting
- `refactor:` Code restructuring
- `test:` Adding tests
- `chore:` Maintenance
---
## ๐ Issues & Support
- **Bug Reports**: [Open an issue](https://github.com/fabyo0/vote-app/issues/new?template=bug_report.md)
- **Feature Requests**: [Request a feature](https://github.com/fabyo0/vote-app/issues/new?template=feature_request.md)
- **Discussions**: [GitHub Discussions](https://github.com/fabyo0/vote-app/discussions)
---
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
## ๐ Acknowledgments
- [Laravel](https://laravel.com) - The PHP Framework
- [Livewire](https://livewire.laravel.com) - Full-stack Framework
- [Tailwind CSS](https://tailwindcss.com) - CSS Framework
- [Pusher](https://pusher.com) - Real-time Infrastructure
- [Spatie](https://spatie.be) - Amazing Laravel Packages
---
## ๐ Connect
- **GitHub**: [@fabyo0](https://github.com/fabyo0)
- **Issues**: [Report here](https://github.com/fabyo0/vote-app/issues)
- **Discussions**: [Join here](https://github.com/fabyo0/vote-app/discussions)
---
### โญ Star this repo if you find it helpful!
**Built with โค๏ธ using Laravel & Livewire**
[Report Bug](https://github.com/fabyo0/vote-app/issues) ยท [Request Feature](https://github.com/fabyo0/vote-app/issues) ยท [Documentation](https://github.com/fabyo0/vote-app/wiki)