This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
UN80 Dashboard is a Next.js 15 application for exploring and filtering United Nations mandates. It displays mandate data from UN budget documents, allowing users to search, filter, and analyze mandate citations across UN entities and organs.
Development server:
npm run devRuns on http://localhost:9001 (note: custom port 9001, not default 3000)
Type checking:
npm run typecheckRun before commits to catch TypeScript errors.
Build and production:
npm run build
npm run startLinting:
npm run lint- Next.js 15 with App Router
- TypeScript for type safety
- Tailwind CSS for styling
- shadcn/ui components (Radix UI + Tailwind)
- React 18 with client-side state management
The application uses a unified API architecture centered around /api/mandates/route.ts:
- Single source of truth: All mandate data flows through one API endpoint
- Server-side filtering: Filtering, sorting, and pagination happen server-side
- Lazy enrichment: Only paginated results are enriched with full details
- In-memory caching: 5-minute TTL cache with precomputed default views
src/lib/data-service.ts is the singleton data loader:
- Loads mandate data from
data/ppb2026_unique_mandates_with_metadata.json - Loads entity metadata from
data/mandate_entities.csv - Loads organ data from
data/organs.json - Provides in-memory caches with lookup maps
The filter system uses URL-based state management:
- FilterContext (
src/contexts/FilterContext.tsx): Syncs filters with URL parameters - Filter constants (
src/lib/filter-constants.ts): Central definition of all filter parameters - Page-specific filtering: Main page vs entity/organ pages handle filters differently
- Main page: All filters in URL
- Entity/organ pages: Implicit filter from route + additional filters in URL
Pages:
src/app/page.tsx- Main dashboard (all mandates)src/app/entity/[entity]/page.tsx- Entity-specific viewsrc/app/organ/[organ]/page.tsx- Organ-specific viewsrc/app/mandate/[...segments]/page.tsx- Individual mandate detail viewsrc/app/resolutions/page.tsx- Resolutions document tablesrc/app/reports/page.tsx- Reports document table
Core Components:
mandate-explorer.tsx- Main data explorer (used by all list pages)mandate-list.tsx- Displays paginated mandate cardsfilter-controls.tsx- Search, programme, subject, year filters*-sidebar.tsx- Entity list, organ list, cross-citations sidebars
UI Components:
All in src/components/ui/ - mostly shadcn/ui components with customizations
All TypeScript types are defined in src/types/index.ts:
Mandate- Core mandate data structure with enriched fieldsEntity- Entity metadata with URLs and descriptionsOrgan- UN organ informationFilterOptions- All possible filter parametersApiResponse- Unified API response structure
- Left-aligned layouts
- Consistent spacing and hierarchies
- No drop shadows on components
- Minimal boxing - avoid unnecessary borders/containers
- Consistent UN colors from Tailwind palette in
src/app/globals.css, prefer UN Blue--un-blue
- Always check
src/lib/utils.tsandsrc/lib/shared-utils.tsfor existing utility functions - Filter parameter lists are in
src/lib/filter-constants.ts- use these constants - Extend existing infrastructure rather than building parallel structures
- Use shadcn/ui components for UI elements
- make sure to use custum Tailwind colors @tailwind.config.ts and @src/app/globals.css
When adding new features that need data:
- Check if
/api/mandatesalready provides it - If not, extend the unified API rather than creating new endpoints
- Update
ApiResponsetype insrc/types/index.ts
When adding new filters:
- Add parameter to
FILTER_PARAMSinsrc/lib/filter-constants.ts - Update
FilterOptionstype insrc/types/index.ts - Implement filtering logic in
/api/mandates/route.tsfilterMandates()function - Update
FilterContextif needed
All data files are in the data/ directory:
ppb2026_unique_mandates_with_metadata.json- Main mandate dataentity_details.csv- Entity metadataorgans.json- UN organ information
- feature implementation notes are stored in
notes/and give valuable insights into feature requests and implementation plans