An exploratory geography-focused web app combining Mapbox's globe visualization with an AI assistant for concise geographic answers and smart navigation.
A bring-your-own API key project.
- π Interactive 3D globe (Mapbox GL JS, globe projection)
- π Geocoding (Mapbox Geocoding API v6) with bounding box highlighting
- π¬ AI geography assistant (OpenAI Responses API with structured JSON parsing and validation via Zod)
- π§ Auto-navigation: AI replies can trigger fly-to on relevant locations
- π Dark / Light theme with context + toggle
- π§± Clean service-layer architecture (
/services/mapbox,/services/geo,/services/openai)
- User asks a geography-related question in the central input.
- The OpenAI service (
createGeoResponse) sends the prompt with a strict system instruction + Zod enforced schema. - Response is parsed (topics, suggested follow-ups, optional navigateTo, citations, reply).
- If
navigateTois present, a forward geocode runs and the map flies to the best match. - The conversation history displays in a scrollable panel when you've interacted.
Create an .env file (never commit real keys):
NEXT_PUBLIC_MAPBOX_TOKEN=pk.your_mapbox_public_token
OPENAI_API_KEY=sk-your_openai_key
# Optional: override model (defaults to gpt-4o-mini)
# OPENAI_MODEL=gpt-4o-minigit clone https://github.com/ReemanS/pinpoint.git
cd pinpoint
npm install
cp .env.example .env
# fill in env vars
npm run dev- Pan / zoom the globe.
- Ask a question: e.g. "Capital of the Philippines".
- If the AI includes
navigateTo, the map moves there automatically. - Click the title (Pinpoint) when docked to return to the centered hero state.
- Toggle theme with the theme switch.
- Zod for AI response validation ensures predictable structure.
- Response mapping for Mapbox features (
transformFeatureToSearchResult). - Centralized API response type:
ApiResponse<T>.