Daily GeoGame relies on three primary external data sources for country information, hints, and map visualization.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/igorek05m/daily-geogame/llms.txt
Use this file to discover all available pages before exploring further.
RestCountries API
Free REST API providing comprehensive data about world countries.Purpose
Used for:- Country autocomplete: Base country list from
countries.json - Detailed country data: Fetched on guess submission
- Target country selection: During daily game generation
- Geographic info: Coordinates, borders, area, population
- Visual elements: Flag SVG URLs
Endpoints used
Get country by alpha code
Data transformation
Raw API data is transformed into theCountry type:
app/hooks/useDailyGame.ts:155-166
Caching strategy
The/api/country route proxies RestCountries with Next.js caching:
app/api/country/route.ts:11-13
Why cache?
- Country data rarely changes
- Reduces external API calls
- Faster response times
- No rate limiting concerns
Local fallback
A staticcountries.json file contains basic info for all countries:
app/hooks/useDailyGame.ts:4
This file is used for:
- Autocomplete dropdown population
- Initial country selection during game generation
- Fallback if RestCountries is unavailable
Rate limits
RestCountries is free with no official rate limits, but the app caches responses to be respectful.Attribution
License: Public domain / CC0 Credit: Listed in README.mdREADME.md:49
CIA World Factbook
JSON-formatted dataset derived from the CIA World Factbook, providing detailed country information for game hints.Purpose
Used for generating 6 hint packages:- Climate: Weather patterns and climate zones
- Terrain: Geographic landscape descriptions
- Resources: Natural resources and agriculture
- Trade: Export commodities and industries
- Society: Demographics, religions, languages
- Symbols: Flag descriptions and national symbols
Data source
Repository: https://github.com/factbook/factbook.json Base URL:app/lib/factbook.ts:19
Regional structure
Data is organized into 11 regional folders:app/lib/factbook.ts:5-17
Fetching data
ThefetchFactbookData function iterates through all regions:
app/lib/factbook.ts:28-42
Example URL: https://raw.githubusercontent.com/factbook/factbook.json/master/europe/fr.json
Data structure
Hint generation
ThegenerateHintPackages function extracts and formats hint data:
app/lib/factbook.ts:44-118
Text truncation
Long descriptions are truncated to fit the UI:app/lib/factbook.ts:21-26
This ensures hints:
- Don’t overflow UI elements
- End at word boundaries
- Have consistent ”…” suffix
Fallback data
If Factbook data is missing for specific fields:app/lib/factbook.ts:47-50
If no Factbook data exists for a country, the game generation retries with a different country (up to 5 attempts).
Reference: app/api/daily/route.ts:79-94
Update frequency
The Factbook JSON repository is updated periodically by its maintainers. Daily GeoGame fetches data fresh during game generation (not cached).Attribution
License: Public domain (U.S. government work) Credit: Listed in README.mdREADME.md:49
SimpleMaps
Provides the world map SVG file for interactive visualization.Purpose
Used for:- Map rendering: Base SVG world map
- Country highlighting: Show guesses and target
- Interactive features: Zoom, pan, country selection
Data type
SVG (Scalable Vector Graphics) file with:- Country polygons as
<path>elements - Country codes as
idordata-idattributes - Projection: Mercator or similar
Integration
The map is loaded usingreact-svg and manipulated with D3:
package.json:21,14
Country highlighting
CSS classes are applied to SVG paths based on game state:- Guessed countries: Highlighted in color
- Neighbor countries: Different shade if adjacent to target
- Target country: Revealed when game is over
- Hover state: Interactive feedback
Zoom and pan
Interactivity is handled byreact-zoom-pan-pinch:
package.json:22
Attribution
Source: SimpleMaps Credit: Listed in README.mdREADME.md:50
Verify SimpleMaps’ license terms if using their map data. Some maps require attribution or have commercial restrictions.
Data flow summary
Daily game generation
User guess
Data reliability
RestCountries
- Uptime: ~99% based on community reports
- Accuracy: High (regularly maintained)
- Breaking changes: Versioned API (using v3.1)
CIA Factbook
- Uptime: Depends on GitHub availability (~100%)
- Accuracy: High (official U.S. government data)
- Freshness: Updated quarterly/annually
- Gaps: Some small territories lack complete data
SimpleMaps
- Uptime: Served from Next.js public folder (100%)
- Accuracy: Professional cartography
- Updates: Static file (no runtime dependency)
Offline considerations
The app requires external APIs for full functionality, but has fallbacks:- MongoDB unavailable: Game generation works in-memory
- RestCountries down: Uses local
countries.jsonfor basic info - Factbook missing: Retries with different countries or shows placeholder hints
- SimpleMaps: Bundled with app (always available)
Privacy and data usage
All external APIs are accessed server-side (not from client browsers):- No user data sent to external services
- No tracking or analytics from data providers
- All API calls are for game content only
Future data improvements
Potential enhancements:- Cache Factbook data: Store in MongoDB to reduce external requests
- Backup data source: Mirror RestCountries data locally
- Image hints: Add capital city photos or landmarks
- Historical data: Track country data changes over time
- Custom hints: Add difficulty-based hint selection