This file provides guidance for Claude Code (claude.ai/claude-code) when working on this repository.
tripm.app is a React + TypeScript application that extracts travel history from calendar data and displays visited countries on an interactive world map. All data processing happens client-side with no backend.
npm run dev # Start development server (Vite)
npm run build # TypeScript check + production build
npm run lint # ESLint check
npm test # Run tests in watch mode (Vitest)
npm run test:run # Run tests once
npm run check # Pre-commit check: tests, lint, build, e2e- User imports calendar (.ics file or pasted iCal data)
calendar-parser.tsparses iCal format using ical.jscountry-extractor.tsdetects travel events and extracts countries- Visits are stored in localStorage and displayed on map
src/App.tsx- Main application component, state management, hash-based routingsrc/components/WorldMap.tsx- MapBox GL map with country highlightingsrc/components/VisitList.tsx- Sortable list of visited countriessrc/components/CalendarInput.tsx- File upload, paste, and Google Calendar importsrc/components/LegalPage.tsx- Renders privacy policy and terms of service from markdownsrc/content/privacy.md- Privacy policy contentsrc/content/terms.md- Terms of service contentsrc/lib/calendar-parser.ts- iCal parsing using ical.jssrc/lib/country-extractor.ts- Travel event detection and country extractionsrc/lib/storage.ts- localStorage persistence and JSON export/importsrc/data/location-codes.ts- IATA codes, city names, and train station mappingssrc/data/countries.ts- Country code to name mappings
CountryVisit- A country with multiple visit entriesVisitEntry- A single trip with dates and sourceCalendarEvent- Parsed calendar eventDateRange- Start/end date filter
Unit tests in src/lib/country-extractor.test.ts cover:
- Airport code and train station detection
- Country/city name matching
- Geographic disambiguation (Paris TX ≠ Paris FR)
- Flight number pattern detection
- Virtual event filtering
- Compound city names (New York vs York)
- 2-letter codes require uppercase (LA, SF, DC)
- Visit merging logic
Integration tests in src/lib/integration.test.ts cover:
- Calendar parsing with real .ics fixture
- Full extraction pipeline
- JSON export/import cycle
Test fixture: test-calendar.ics contains sample events exercising all matching criteria.
VITE_MAPBOX_TOKEN- Required MapBox access token for the mapVITE_GOOGLE_CLIENT_ID- Optional Google OAuth client ID for Google Calendar import
- The app uses Tailwind CSS v4 with the Vite plugin
- MapBox country boundaries use ISO 3166-1 alpha-2 codes
- Travel detection uses keywords, airport codes, flight numbers, train stations, and multi-day heuristics
- Virtual/remote events are filtered out even if they mention locations
- US/Canadian cities with international namesakes are disambiguated (e.g., "Paris, TX" won't match France)
- Hash-based routing:
#privacyand#termsshow legal pages, all other hashes show the main app - Legal page content lives in markdown files (
src/content/) rendered with react-markdown - Hosted on GitHub Pages — hash routing is used because GH Pages doesn't support SPA path fallback