Groupify AI adalah aplikasi web modern yang dirancang untuk membantu pembagian kelompok secara otomatis dan cerdas menggunakan AI (Google Gemini).
- Pembagian Kelompok Otomatis: Buat kelompok secara acak atau berdasarkan kriteria tertentu
- Smart Balance: AI akan membagi kelompok secara seimbang berdasarkan skill, gender, atau karakteristik lain
- Pemilihan Ketua Otomatis: Pilih ketua kelompok secara acak atau manual
- Nama Kelompok Kreatif: Generate nama kelompok unik dengan AI
- Ice Breaker Generator: Saran kegiatan ice breaker untuk kelompok
- Export Multi-Format: Export hasil ke PDF, TXT, atau CSV
- Drag & Drop: Edit kelompok dengan mudah menggunakan drag and drop
- Responsive Design: Tampilan optimal di desktop maupun mobile
- Framework: Next.js 15.3.5 (App Router)
- UI Library: React 19
- Styling: Tailwind CSS 4
- UI Components: Shadcn/ui + Radix UI
- AI: Google Gemini 2.0 Flash / OpenAI GPT (configurable)
- Database: Prisma ORM + PostgreSQL (Supabase)
- Real-time: Socket.IO untuk collaborative features
- PDF Generation: html2pdf.js
- Drag & Drop: @dnd-kit
- Forms: React Hook Form + Zod validation
- Authentication: NextAuth.js (opsional)
- TypeScript: Full type safety
- Build Tool: Vite (untuk development custom server)
- Linting: ESLint
- Testing: Jest + React Testing Library (opsional)
Sebelum memulai, pastikan Anda memiliki:
- Node.js versi 18.0 atau lebih tinggi (Download)
- npm atau yarn package manager
- Git untuk cloning repository
- PostgreSQL database (untuk production, gunakan Supabase)
- Google Gemini API Key (Dapatkan di sini)
git clone <repository-url>
cd Spinnernpm installAtau jika menggunakan yarn:
yarn installBuat file .env.local di root directory project dan isi dengan konfigurasi berikut:
# Google Gemini AI (Required)
GOOGLE_GEMINI_API_KEY="your-gemini-api-key-here"
# Database (Optional - untuk penyimpanan data)
DATABASE_URL="postgresql://postgres:your-password@your-project.supabase.co:5432/postgres"
# Supabase (Optional - untuk authentication dan real-time features)
NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-supabase-anon-key-here"
# NextAuth (Optional - untuk authentication)
NEXTAUTH_SECRET="generate-random-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"Catatan: Untuk development lokal, Anda bisa menggunakan SQLite dengan mengubah DATABASE_URL ke:
DATABASE_URL="file:./dev.db"
Dan update prisma/schema.prisma datasource ke:
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
- Kunjungi Supabase dan buat project baru
- Copy Database URL dari Settings > Database
- Copy Supabase URL dan Anon Key dari Settings > API
- Paste ke
.env.local
# Install PostgreSQL jika belum ada
# Ubuntu/Debian:
sudo apt-get install postgresql postgresql-contrib
# macOS dengan Homebrew:
brew install postgresql
brew services start postgresql
# Windows: Download dari postgresql.org
# Buat database baru
createdb groupify_ai
# Update DATABASE_URL di .env.local
DATABASE_URL="postgresql://username:password@localhost:5432/groupify_ai"# Generate Prisma Client
npm run db:generate
# Push schema ke database
npm run db:push
# (Opsional) Jalankan migration
npm run db:migratenpm run devAplikasi akan berjalan di http://localhost:3000
Untuk fitur real-time seperti collaborative editing:
npm run dev:customServer akan berjalan di http://localhost:3000 dengan Socket.IO di ws://localhost:3000/api/socketio
- Buka browser dan akses http://localhost:3000
- Coba buat kelompok baru
- Test fitur AI (generate nama kelompok, ice breakers)
- Test export PDF
Jika ada error, lihat bagian Troubleshooting di bawah.
# Build aplikasi
npm run build
# Start production server
npm startSpinner/
βββ prisma/
β βββ schema.prisma # Database schema dan model
β βββ custom.db # SQLite database (development)
βββ public/ # Static assets
β βββ favicon.ico
β βββ logo.png
β βββ robots.txt
βββ scripts/ # Utility scripts
β βββ translate-list.ts # Translation utilities
βββ src/
β βββ app/ # Next.js App Router
β β βββ api/ # API Routes
β β β βββ generate-icebreakers/
β β β βββ generate-team-names/
β β β βββ health/
β β β βββ smart-balance/
β β βββ globals.css # Global styles
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Homepage
β βββ components/ # React Components
β β βββ app/ # App-specific components
β β β βββ AIToolsTab.tsx
β β β βββ CreateGroupsTab.tsx
β β β βββ ResultsTab.tsx
β β β βββ ...
β β βββ ui/ # Shadcn UI components
β β βββ Spinner.tsx # Main spinner component
β βββ hooks/ # Custom React hooks
β β βββ use-mobile.ts
β β βββ use-toast.ts
β βββ lib/ # Utility functions
β βββ db.ts # Database utilities
β βββ gemini.ts # Gemini AI integration
β βββ socket.ts # Socket.IO setup
β βββ translations.ts # Translation utilities
β βββ utils.ts # General utilities
βββ examples/ # Example implementations
β βββ websocket/
β βββ page.tsx
βββ server.ts # Custom server with Socket.IO
βββ next.config.ts # Next.js configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies dan scripts
βββ README.md
Aplikasi ini menyediakan beberapa API endpoints untuk integrasi AI dan fungsionalitas utama:
POST /api/generate-team-names- Generate nama kelompok kreatif menggunakan Gemini AIPOST /api/generate-icebreakers- Generate saran ice breaker activitiesPOST /api/smart-balance- AI-powered group balancing berdasarkan kriteria
GET /api/health- Health check endpoint untuk monitoring
WebSocket /api/socketio- Socket.IO endpoint untuk collaborative editing dan real-time updates
// Generate nama kelompok
const response = await fetch("/api/generate-team-names", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ theme: "tech", count: 5 }),
});
// Smart balance groups
const balanceResponse = await fetch("/api/smart-balance", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
members: ["Alice", "Bob", "Charlie"],
criteria: ["skill", "gender"],
}),
});
## π§ Available Scripts
- `npm run dev` - Jalankan development server (Next.js built-in)
- `npm run dev:custom` - Jalankan custom server dengan Socket.IO untuk real-time features
- `npm run build` - Build aplikasi untuk production
- `npm run start` - Jalankan production server (Next.js built-in)
- `npm run start:custom` - Jalankan custom production server dengan Socket.IO
- `npm run lint` - Jalankan ESLint untuk code quality check
- `npm run db:generate` - Generate Prisma Client dari schema
- `npm run db:push` - Push database schema ke database (tanpa migration)
- `npm run db:migrate` - Jalankan database migration
- `npm run db:reset` - Reset database dan jalankan semua migration dari awal
## π Deployment
### Vercel (Recommended)
1. Push code ke GitHub
2. Import project di [Vercel](https://vercel.com)
3. Set environment variables
4. Deploy!
### Manual Deployment
1. Build aplikasi: `npm run build`
2. Upload folder `.next`, `public`, `node_modules`, dan `package.json`
3. Set environment variables
4. Jalankan: `npm start`
## π Environment Variables
### Required Variables
| Variable | Description | Example |
|----------|-------------|---------|
| `AI_PROVIDER` | AI provider to use: "gemini" or "openai" | `gemini` |
| `GOOGLE_GEMINI_API_KEY` | API key untuk Google Gemini AI | `AIzaSy...` |
| `OPENAI_API_KEY` | API key untuk OpenAI (opsional) | `sk-...` |
### Optional Variables
| Variable | Description | Example |
|----------|-------------|---------|
| `DATABASE_URL` | Connection string untuk database | `postgresql://user:pass@host:5432/db` |
| `NEXT_PUBLIC_SUPABASE_URL` | Supabase project URL | `https://xxx.supabase.co` |
| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Supabase anonymous key | `eyJ...` |
| `NEXTAUTH_SECRET` | Secret key untuk NextAuth.js | `random-string-32-chars` |
| `NEXTAUTH_URL` | Base URL aplikasi | `http://localhost:3000` |
### Mendapatkan API Keys
#### Google Gemini API Key
1. Kunjungi [Google AI Studio](https://makersuite.google.com/app/apikey)
2. Login dengan akun Google
3. Klik "Create API Key"
4. Copy API key dan paste ke environment variables
#### Supabase Setup
1. Kunjungi [Supabase](https://supabase.com)
2. Buat project baru
3. Copy Database URL dari Settings > Database
4. Copy Supabase URL dan Anon Key dari Settings > API
5. Paste ke environment variables
## π API Routes
Aplikasi ini menyediakan beberapa API endpoints untuk integrasi AI dan fungsionalitas utama:
### AI-Powered Endpoints
- `POST /api/generate-team-names` - Generate nama kelompok kreatif menggunakan Gemini AI
- `POST /api/generate-icebreakers` - Generate saran ice breaker activities
- `POST /api/smart-balance` - AI-powered group balancing berdasarkan kriteria
### Utility Endpoints
- `GET /api/health` - Health check endpoint untuk monitoring
### Real-time Features
- `WebSocket /api/socketio` - Socket.IO endpoint untuk collaborative editing dan real-time updates
### Contoh Penggunaan API
```javascript
// Generate nama kelompok
const response = await fetch('/api/generate-team-names', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ theme: 'tech', count: 5 })
});
// Smart balance groups
const balanceResponse = await fetch('/api/smart-balance', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
members: ['Alice', 'Bob', 'Charlie'],
criteria: ['skill', 'gender']
})
});
# Test koneksi Gemini (default)
curl http://localhost:3000/api/test-ai
# Atau dengan browser: http://localhost:3000/api/test-ai- Setup environment variables untuk OpenAI:
AI_PROVIDER=openai
OPENAI_API_KEY=your-openai-api-key-here- Test koneksi OpenAI:
curl "http://localhost:3000/api/test-ai?provider=openai"curl -X POST http://localhost:3000/api/test-ai \
-H "Content-Type: application/json" \
-d '{"provider": "openai", "prompt": "Say hello in Indonesian"}'Success:
{
"success": true,
"message": "β
OPENAI API connected successfully",
"provider": "openai"
}Error:
{
"success": false,
"message": "β OPENAI API connection failed: API key missing",
"provider": "openai"
}Penyebab: CSS menggunakan format warna yang tidak didukung oleh html2pdf.js
Solusi: Pastikan semua CSS menggunakan warna hex (bukan oklch atau format lain)
/* β Salah */
color: oklch(0.5 0.2 240);
/* β
Benar */
color: #3b82f6;Solusi:
# Check TypeScript errors
npx tsc --noEmit
# Fix common issues
npm run lintPenyebab: API key invalid, quota habis, atau koneksi bermasalah
Solusi:
- Pastikan
GOOGLE_GEMINI_API_KEYvalid dan aktif - Check quota API di Google AI Studio
- Pastikan koneksi internet stabil
- Coba regenerate API key jika diperlukan
Solusi:
npm run db:generatePenyebab: Custom server tidak berjalan atau port conflict
Solusi:
- Gunakan
npm run dev:customuntuk development - Pastikan port 3000 tidak digunakan aplikasi lain
- Check firewall settings untuk WebSocket connections
Solusi:
- Verify
DATABASE_URLdi.env.local - Pastikan Supabase project aktif
- Untuk local PostgreSQL, pastikan service running
- Jalankan
npm run db:pushuntuk sync schema
Solusi:
# Reset database
npm run db:reset
# Atau push schema tanpa migration
npm run db:pushPenyebab: Custom server configuration
Solusi: Gunakan npm run dev:custom untuk development dengan Socket.IO, atau npm run dev untuk standard Next.js development
Solusi:
# Kill process on port 3000
npx kill-port 3000
# Atau gunakan port lain
PORT=3001 npm run devSolusi: Optimalkan CSS dan reduce image sizes dalam PDF template
Solusi: Monitor dengan Chrome DevTools, optimize React components dengan React.memo
Solusi:
- Pastikan semua dependencies ter-install
- Check build logs di Vercel dashboard
- Pastikan environment variables diset dengan benar
- Untuk custom server, gunakan build script yang sesuai
Solusi: Pastikan variables diset di Vercel dashboard, bukan di .env.local untuk production
- Selalu jalankan
npm run lintsebelum commit - Test PDF export di berbagai browser
- Monitor API quota usage
- Backup database sebelum major changes
- Use
npm run dev:customuntuk full feature testing
MIT License - Feel free to use for any purpose
Contributions are welcome! Please feel free to submit a Pull Request.
- Code Style: Ikuti ESLint configuration yang sudah ada
- TypeScript: Gunakan strict typing untuk semua components
- Testing: Tambahkan tests untuk fitur baru
- Documentation: Update README untuk perubahan signifikan
- Commits: Gunakan conventional commits
main- Production ready codedevelop- Development branchfeature/*- Feature branchesbugfix/*- Bug fix branches
- Fork repository
- Create feature branch dari
develop - Commit changes dengan conventional commits
- Push ke branch Anda
- Create Pull Request ke
develop - Wait for review dan approval
# Run linter
npm run lint
# Type check
npx tsc --noEmit
# Format code (jika menggunakan Prettier)
npx prettier --write .- Main Bundle: ~150KB (gzipped)
- Vendor Bundle: ~200KB (gzipped)
- Total: ~350KB (gzipped)
- Performance: 90+
- Accessibility: 95+
- Best Practices: 95+
- SEO: 90+
- API keys disimpan di environment variables
- Input validation menggunakan Zod
- Rate limiting untuk AI API calls
- HTTPS enforced di production
- CSP headers untuk security
- User authentication dengan NextAuth.js
- Save groups ke database
- Collaborative group editing
- Advanced AI features
- Mobile app dengan React Native
- Integration dengan Google Classroom
- Advanced analytics dashboard
- Multi-language support
- Plugin system untuk custom AI models
- Integration dengan LMS platforms
- β Pembagian kelompok otomatis dan manual
- β Smart balance dengan AI
- β Generate nama kelompok kreatif
- β Ice breaker suggestions
- β Drag & drop group editing
- β Export ke PDF, TXT, CSV
- β Responsive design
- β Real-time collaboration dengan Socket.IO
- β Custom server setup
- β Basic group creation
- β PDF export functionality
- β Google Gemini AI integration
- β Basic UI dengan Tailwind CSS
Untuk pertanyaan atau dukungan, silakan buat issue di GitHub repository.
- GitHub Issues: Laporkan bugs dan request features
- GitHub Discussions: Diskusi umum dan Q&A
- Email: Contact maintainer untuk support premium
Dibuat dengan β€οΈ menggunakan Next.js dan Google Gemini AI