Move architecture, env vars, and deployment details into .claude/ subdocs referenced via @-imports, keeping CLAUDE.md to commands and pointers only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.0 KiB
2.0 KiB
Architecture
Sistem Desa Mandiri is a village administration platform built on Next.js 14 (App Router) with PostgreSQL.
Key Layers
src/app/(application)/— Auth-protected pages grouped by feature (announcement, division, project, discussion, member, profile, home, group)src/app/(auth)/— Login/register pagessrc/app/api/— REST API endpoints; subdirectories map to resource types (/api/announcement,/api/project,/api/task, etc.). Mobile-specific endpoints live under/api/mobile/src/module/— Business logic modules, one per feature (19 modules). Each module contains hooks, components, and API call functions for that domainsrc/lib/— Shared utilities: Prisma client singleton (prisma.ts), Firebase init, route definitions (routes.ts), push notification hooks
Data Access
All DB access goes through the Prisma client singleton in src/lib/prisma.ts. Schema at prisma/schema.prisma (40+ models). Migrations in prisma/migrations/.
State Management
- Hookstate (
@hookstate/core+@hookstate/localstored) — client-side global state with localStorage persistence - Iron-session — server-side session management / auth
- Jose — JWT handling
UI Stack
- Mantine 7 — primary UI library (components, forms, modals, notifications, charts, dates)
- Tailwind CSS — utility classes, used alongside Mantine
- PostCSS — configured with Mantine preset (
postcss.config.mjs)
Real-time & Notifications
- Firebase FCM (
src/lib/firebase/) — mobile push notifications - Web Push + VAPID keys (
src/lib/usePushNotifications.ts) — browser push - wibu-realtime (custom library) — WebSocket-based real-time updates
User Roles
Five roles with distinct access levels (see PANDUAN PENGGUNAAN.md):
- Super Admin — full system access
- Admin Desa — village-level administration
- Ketua Divisi — division leader
- Anggota Divisi — division member
- Warga/Perangkat Desa — village resident/official