Next.js Progressive Web App for OpenJustice -- an offline-first criminal justice information system.
- Framework: Next.js 16, React 19, TypeScript
- Styling: Tailwind CSS 4, shadcn/ui, Radix UI
- State: Zustand, SWR, React Hook Form + Zod
- Maps: Leaflet / React Leaflet
- Charts: Recharts
- PWA: Service Worker, IndexedDB offline cache
cp .env.example .env.local # Configure environment
npm install # Install dependencies
npm run dev # Start development serverThe client runs at http://localhost:3001. Requires the backend server running at the configured NEXT_PUBLIC_API_URL.
- Offline-first PWA -- full functionality without internet, background sync on reconnection
- Dashboard -- case management, persons registry, evidence tracking, analytics
- GeoCrime mapping -- interactive crime hotspot visualization
- Role-based UI -- permission-driven navigation and access control
- Country-configurable -- supports Sierra Leone, Ghana, Nigeria, Kenya presets
- Responsive -- mobile-first design with touch-friendly controls
app/ # Next.js app router (pages and API routes)
components/ # React components (69+ reusable, 18 landing page)
ui/ # shadcn/ui base components
dashboard/ # Dashboard-specific components
landing/ # Public landing page sections
pwa/ # PWA lifecycle and offline indicator
lib/ # Core utilities and business logic
api-client.ts # Axios instance with auth interceptors
auth-context.tsx # Authentication context and hooks
offline-storage.ts # IndexedDB wrapper for offline storage
sync-service.ts # Background sync with exponential backoff
types/ # TypeScript type definitions
schemas/ # Zod validation schemas
hooks/ # Custom React hooks
public/ # Static assets, service worker, PWA manifest
npm test # Run unit tests (Vitest)
npm run test:watch # Watch mode
npm run test:coverage # Run with coverageSee .env.example for all options. Key variables:
NEXT_PUBLIC_API_URL-- Backend API endpointJWT_SECRET-- Must match the server's JWT secretNEXT_PUBLIC_COUNTRY_CODE-- Target country (SL, GH, NG, KE)NEXT_PUBLIC_MAPBOX_TOKEN-- Mapbox token for maps (optional)
MIT -- see LICENSE for details.