This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a map comparison application built with React, TanStack Router, and Vite. It allows users to view and compare Google Maps, Naver Maps, and Kakao Maps side-by-side in real-time with synchronized controls.
npm run dev- Start development server on port 3002npm run build- Build for production (runs Vite build and TypeScript compilation)npm run serve- Preview production buildnpm run test- Run tests with Vitest
npm run test- Run all tests in run mode (not watch)
Uses TanStack Router with file-based routing. Routes are defined in src/routes/ and auto-generated route tree is in src/routeTree.gen.ts.
__root.tsx- Root layout with APIProvider for Google Maps, Header component, and dev toolsindex.tsx- Home/landing pagecompare.tsx- Main map comparison page with 3-column layout
Each map provider (Google, Naver, Kakao) is integrated using a different approach:
Google Maps (src/components/map/GoogleMap.tsx)
- Uses
@vis.gl/react-google-mapsReact wrapper - API key configured via
VITE_GOOGLE_MAPS_API_KEYenvironment variable - APIProvider wraps entire app in
__root.tsx
Naver Maps (src/components/map/NaverMap.tsx)
- Uses vanilla JavaScript SDK with React hooks
- Dynamically loads SDK via
public/naver-maps-loader.jshelper - Window-level
initNaverMaps()function loads SDK on-demand - Requires
VITE_NAVER_MAPS_CLIENT_IDenvironment variable - Map instance managed with
useRefand updated viauseEffect
Kakao Maps (src/components/map/KakaoMap.tsx)
- Uses vanilla JavaScript SDK with React hooks
- Dynamically loads SDK via
public/kakao-map-loader.jshelper - Window-level
initKakaoMap()function loads SDK on-demand - Requires
VITE_KAKAO_MAP_APP_KEYenvironment variable - Zoom level conversion: Kakao uses inverted "level" (lower = zoomed in), converted from standard zoom (1-20) via
20 - zoom
Copy .env.example to .env and populate with API keys:
VITE_GOOGLE_MAPS_API_KEY- Google Maps Platform API keyVITE_NAVER_MAPS_CLIENT_ID- Naver Cloud Platform client IDVITE_NAVER_MAPS_CLIENT_SECRET- Naver Cloud Platform client secret (for backend/serverless functions)VITE_KAKAO_MAP_APP_KEY- Kakao Developers app keyVITE_API_BASE_URL- API proxy base URL (optional, defaults to localhost:3003 in dev)
The /compare route implements synchronized controls for all three maps:
- Center coordinates - Shared
centerstate updates all maps simultaneously - Zoom level - Shared
zoomstate (with Kakao conversion) - Joystick control - Custom joystick component (
src/components/map/Joystick.tsx) with adjustable sensitivity for precise map movement - Manual coordinate input - Direct lat/lng input fields
- Path alias:
@/maps to./src/(configured in vite.config.ts and tsconfig.json) - Styling: Tailwind CSS v4 with Vite plugin
- TypeScript: Strict mode enabled with bundler module resolution
- Dev tools: TanStack Router Devtools and React Devtools available in development
All map components using vanilla SDKs follow this pattern:
- Component mounts, check if
mapRefexists - Call async
initMap()to load SDK via window helpers - Create map instance and store in
mapInstanceRef - Separate
useEffecthooks update center/zoom when props change - Updates directly call map instance methods (e.g.,
setCenter(),setZoom())
- Create loader script in
public/{provider}-loader.jswith window-level init function - Add script tag to
index.html - Create component in
src/components/map/{Provider}Map.tsxfollowing Naver/Kakao pattern - Add environment variable for API key to
.env.example - Update compare page grid to include new map
Add a file to src/routes/ - TanStack Router will auto-generate the route tree. Use createFileRoute() pattern for type safety.
This application uses serverless functions to proxy the Naver Directions API and avoid CORS issues.
- Development: Express server (
server.js) runs on localhost:3003 - Production: Serverless functions handle API proxying
- Vercel:
/api/directions.js(recommended) - Netlify:
/netlify/functions/directions.js
- Vercel:
- Vercel (recommended) - Zero config, automatic serverless function detection
- Netlify - Uses Netlify Functions with
netlify.tomlconfiguration - Separate Backend - Deploy
server.jsto Railway/Render/AWS and setVITE_API_BASE_URL
See DEPLOYMENT.md for detailed deployment instructions and environment variable configuration.