Frontend aplikasi BagiBerkah - AI-Powered THR Experience built with Next.js 16.
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Custom components
- Charts: Recharts
- QR Code: qrcode.react + html5-qrcode
- Forms: React Hook Form + Zod
frontend/
βββ app/ # Next.js App Router
β βββ create/ # Halaman buat amplop
β βββ claim/[token]/ # Halaman klaim THR
β βββ envelope/[id]/ # Detail amplop (coming soon)
β βββ layout.tsx # Root layout
β βββ page.tsx # Landing page
β βββ globals.css # Global styles
βββ components/
β βββ ui/ # UI components (Button, Input, Card, dll)
β βββ charts/ # Chart components (coming soon)
β βββ animations/ # Animation components (coming soon)
βββ lib/
β βββ api.ts # API client
β βββ types.ts # TypeScript types
β βββ utils.ts # Utility functions
βββ public/ # Static assets
- Node.js 18+ atau 20+
- pnpm (recommended) atau npm
# 1. Install dependencies
pnpm install
# 2. Copy environment variables
cp .env.example .env.local
# 3. Edit .env.local dengan konfigurasi yang sesuai
# NEXT_PUBLIC_API_URL=http://localhost:5000/api
# NEXT_PUBLIC_APP_URL=http://localhost:3000
# 4. Run development server
pnpm devAplikasi akan berjalan di http://localhost:3000
NEXT_PUBLIC_API_URL=http://localhost:5000/api
NEXT_PUBLIC_APP_URL=http://localhost:3000
NODE_ENV=developmentPort Already in Use:
# Use different port
pnpm dev -- -p 3001Module Not Found:
# Clear cache and reinstall
rm -rf node_modules .next
pnpm installAPI Connection Failed:
- Ensure backend is running on port 5000
- Check
NEXT_PUBLIC_API_URLin.env.local - Check CORS settings di backend
# Run development server
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start
# Run linter
pnpm lintAplikasi akan berjalan di http://localhost:3000
- Hero section dengan CTA
- Features showcase
- How it works
- Call to action
- Step 1: Input total budget
- Step 2: Tambah penerima dengan data lengkap
- Step 3: AI allocation & visualization (coming soon)
- Step 4: Pilih mode distribusi (coming soon)
- Step 5: Payment/Generate links (coming soon)
- Envelope opening animation
- Mini quiz Ramadhan
- Reveal nominal & greeting
- Pilih metode pencairan (digital/cash)
- Status tracking
- Daftar penerima & status klaim
- QR scanner untuk mode cash
- Analytics
- Primary: Green (#4CAF50, #81C784)
- Secondary: Amber (#FFD700, #FFC107)
- Background: White, Green-50, Amber-50
- Text: Gray-900, Gray-600
- Font: Inter
- Sizes:
- Heading: 24-48px
- Body: 14-16px
- Caption: 12-14px
Semua komponen UI ada di components/ui/:
- Button (variants: default, outline, ghost, destructive)
- Input (dengan validation styling)
- Card (dengan Header, Content, Footer)
- Dan lainnya (coming soon)
API client tersedia di lib/api.ts dengan methods:
// Envelope
api.createEnvelope(data)
api.getEnvelope(id)
api.getEnvelopeStatus(id)
// AI
api.getAIAllocation(data)
api.generateGreeting(data)
// Claim
api.getClaim(token)
api.submitClaim(token, data)
api.validateQR(qrToken)
// Payment (Xendit - THR System)
api.createPayment(envelopeId)
api.getPaymentStatus(paymentId)
// Donation (Mayar - Support Developer)
api.createDonation(data)
api.getDonationStats()BagiBerkah menggunakan dua payment gateway untuk fungsi yang berbeda:
Use Case: Fitur utama THR (payment collection + disbursement)
Features:
- Payment collection dari pengirim (VA, E-wallet, Credit Card)
- Disbursement otomatis ke rekening penerima
- Webhook integration untuk real-time status updates
- Sandbox mode untuk testing
Alasan:
- Memiliki Disbursement API yang lengkap
- Support otomasi penuh (payment + payout)
- Dokumentasi jelas dan sandbox tersedia
Use Case: Fitur tambahan (donation, support developer)
Features:
- Payment link sederhana untuk donation
- Multiple payment methods
- Dashboard untuk monitoring
Alasan:
- Sesuai dengan sponsor kompetisi
- Cocok untuk payment link sederhana
- Menunjukkan kemampuan integrasi multi-gateway
Catatan Penting: Mayar tidak menyediakan Disbursement API, sehingga untuk fitur utama THR yang memerlukan payout otomatis, kami menggunakan Xendit. Mayar tetap diintegrasikan untuk fitur tambahan yang sesuai dengan kapabilitasnya.
- Mobile-first approach
- Breakpoints:
- sm: 640px
- md: 768px
- lg: 1024px
- xl: 1280px
-
AI Allocation Visualization β Done
- Recharts integration
- Pie, Bar, and Table views
- Interactive tooltips
-
QR Code Scanner
- Implement scanner for cash mode validation
- Real-time validation feedback
- Error handling
-
Animations & Polish
- Smooth transitions
- Loading states
- Error states
-
Production Deployment
- Configure production Xendit API keys
- Configure production Mayar API keys
- Deploy to Vercel
- Test end-to-end flow
- QR code scanner not fully implemented
- Some animations are placeholders
- Production payment gateway keys not configured (using mock mode)
- STRUCTURE.md - Detailed project structure
- API_INTEGRATION.md - Complete API integration guide
- DEVELOPMENT_CHECKLIST.md - Development progress tracking
- Root README.md - Complete application documentation
- Gunakan
"use client"directive untuk components yang butuh interactivity - Semua API calls harus melalui
lib/api.ts - Gunakan TypeScript types dari
lib/types.ts - Follow Tailwind CSS conventions untuk styling
- Create feature branch
- Implement feature
- Test thoroughly
- Create pull request
Private - BagiBerkah Project