Rombak total alur data frontend: dari static-export CSR (tiap browser fetch sendiri + akumulasi state voice per-tab) jadi server-side rendering. Frontend (Next.js): - next.config: output export -> standalone; halaman jadi server components - server data layer baru src/lib/api/server.ts (GMW_BACKEND_URL, no window) - dashboard/media/messages/moderation/recordings/voice page -> RSC yang fetch backend di render-time, seed ke client view (SWR fallbackData) - hook-hook utama terima initialData -> first paint data server, revalidate SWR setelahnya, tanpa spinner-blank-load - messages: guild/channel/tab/selected dibaca dari URL di server, page awal di-fetch server-side Shared realtime state (voice) server-authoritative: - backend src/modules/voice/live-speaker.ts: agregat voice_active_user dari gateway jadi snapshot authoritatif (single source of truth semua browser) - GET /api/voice/status kini include activeSpeakers - WS initial states kirim voice_state snapshot saat connect (late join langsung dapat state yang sama, bukan daftar kosong) - useSpeakers seed dari server snapshot + voice_state full-replace + voice_active_user delta upsert Deploy: - flake.nix: frontend package build SSR standalone (server.js wrapper, GMW_FRONTEND_PORT=4017); proxy nginx template proxy / -> Next server, /api + /ws tetap ke backend :4001
Bete Frontend
Next.js 16 (React 19) dashboard untuk Discord Moderation Watcher.
Stack: Next.js 16 (App Router, static export), React 19, TypeScript strict, Tailwind v4, shadcn/ui, base-ui, lucide-react.
Dev
bun run dev # next dev — port 3000 (lokal; prod via nginx 4009)
bun run build # next build — static export ke out/
bun run lint # Biome check
Architecture
src/
├── app/ # Pages
│ ├── page.tsx # Redirect ke /dashboard
│ └── dashboard/ # Dashboard layout + tabs
│ ├── layout.tsx # Sidebar, header, WS provider, chatbot
│ └── page.tsx # Tab routing (messages/live/dashboard)
├── features/
│ ├── messages/ # Message feed, search, review, detail modal
│ ├── live/ # Voice connection, music player, recordings
│ ├── dashboard/ # Stats, users, channels overview
│ └── chatbot/ # AI chatbot
├── lib/
│ ├── api/ # Fetch-based API client (all BE endpoints)
│ ├── ws/ # WebSocket client + React context
│ └── hooks/ # Shared hooks (config, auth)
└── components/
└── layout/ # Sidebar, header, mobile tab bar
API
Backend berjalan di port 4001. Frontend mengakses API via window.location (same-origin atau proxy).
WebSocket terhubung otomatis ke /ws di host yang sama.