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.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.
Base URL
All API routes are relative to the application root:Architecture
The API follows a serverless architecture using Next.js App Router conventions:- Located in
app/api/directory - Each endpoint is a
route.tsfile exporting HTTP method handlers - Built on Next.js
NextRequestandNextResponsetypes - 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
Response format
All endpoints return JSON responses: Success response:Error handling
Standard HTTP status codes are used:| Status | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid parameters or payload |
| 500 | Internal 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