Skip to content

OpenJustice-org/openjustice-client

OpenJustice Client

Next.js Progressive Web App for OpenJustice -- an offline-first criminal justice information system.

Tech Stack

  • 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

Quick Start

cp .env.example .env.local   # Configure environment
npm install                   # Install dependencies
npm run dev                   # Start development server

The client runs at http://localhost:3001. Requires the backend server running at the configured NEXT_PUBLIC_API_URL.

Features

  • 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

Project Structure

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

Testing

npm test              # Run unit tests (Vitest)
npm run test:watch    # Watch mode
npm run test:coverage # Run with coverage

Environment Variables

See .env.example for all options. Key variables:

  • NEXT_PUBLIC_API_URL -- Backend API endpoint
  • JWT_SECRET -- Must match the server's JWT secret
  • NEXT_PUBLIC_COUNTRY_CODE -- Target country (SL, GH, NG, KE)
  • NEXT_PUBLIC_MAPBOX_TOKEN -- Mapbox token for maps (optional)

License

MIT -- see LICENSE for details.

About

Next.js PWA frontend for OpenJustice — offline-first criminal justice system

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages