Skip to main content

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.

Daily GeoGame uses Next.js 15 App Router API routes to provide the backend functionality for the geography guessing game. All API routes are internal and used exclusively by the frontend application.

Base URL

All API routes are relative to the application root:
/api/*

Architecture

The API follows a serverless architecture using Next.js App Router conventions:
  • Located in app/api/ directory
  • Each endpoint is a route.ts file exporting HTTP method handlers
  • Built on Next.js NextRequest and NextResponse types
  • Connected to MongoDB for data persistence
  • Session-based user tracking via HTTP-only cookies

Authentication

The API uses session-based authentication through HTTP-only cookies:
  • Session cookie: geo_session
  • Automatically created on first progress save
  • UUID v4 format
  • 10-year expiration
  • Secure in production, HttpOnly, SameSite strict
No explicit authentication endpoints exist - sessions are created automatically when saving progress.

Response format

All endpoints return JSON responses: Success response:
{
  // Endpoint-specific data
}
Error response:
{
  "error": "Error message description"
}

Error handling

Standard HTTP status codes are used:
StatusDescription
200Success
400Bad Request - Invalid parameters or payload
500Internal Server Error - Database or external API failure
The API gracefully handles database connection failures by falling back to in-memory data generation where possible.

Rate limiting

No explicit rate limiting is currently implemented. The API relies on Next.js serverless function limitations and caching strategies.

Endpoints

Daily game

Get the daily geography challenge with hints

Country details

Fetch country information from cache

User progress

Save and retrieve user game progress

Global statistics

View global player statistics for a date

External dependencies

The API integrates with external services:
  • RestCountries API: Country details (name, flag, coordinates, borders)
  • CIA World Factbook: Detailed country information for hints
  • MongoDB: User progress and daily game persistence
If external APIs fail, the system falls back to cached data or generates minimal game configurations.

Build docs developers (and LLMs) love