A mobile-first web application for creating location-based scavenger hunts with interactive clues and challenges.
This application lets you create and play scavenger hunts that guide players through various locations. Players solve clues, complete challenges, and collect keywords to progress through the game.
Built with: Next.js 16 (App Router + Turbopack), TypeScript, React Leaflet, and OpenStreetMap.
- 📱 Nothing to install — it's a mobile-only website, not a native app. Just open the URL on your phone.
- 🕶️ No account, no sign-up — the game is public and fully anonymous.
- 💸 Free for everyone — no paywall, no in-app purchases.
- 🔒 No backend, no tracking — progress lives entirely in your phone's
localStorage, nothing leaves the device. - 🛠️ Open source — fork the repo and build your own hunts, under the terms of the CC BY-NC-SA 4.0 license.
- 🗺️ Free, key-less mapping via Leaflet + OpenStreetMap tiles
- 🌍 Built-in i18n (French / English) with per-hunt language selection
- 🧭 Onboarding tour powered by driver.js on first launch
- 🧩 8 interactive item types (3D, scratch card, magnifier, page-flip, ...)
- 📦 Static export — deploys anywhere (GitHub Pages, Netlify, S3/CloudFront, ...)
![]() 1. Hunts list |
![]() 2. Onboarding tour |
![]() 3. Manuscript |
![]() 4. Map & place details |
![]() 5. Magnifier puzzle |
![]() 6. Keyword found |
![]() 7. Phrase reconstructed |
- Node.js 18+ and npm
- A mobile device or mobile browser emulator (the app is mobile-only)
-
Clone the repository
git clone <your-repo-url> cd scavenger-hunt
-
Install dependencies
npm install
-
Run the development server
npm run dev
-
Open the application
Navigate to http://localhost:3000 on your mobile device or browser.
📱 Testing on a real mobile device
To test on your phone while running the dev server on your computer:
- Make sure your phone and computer are on the same network
- Find your computer's local IP address:
# On Linux/Mac ip addr show | grep inet # or ifconfig | grep inet
- On your phone, navigate to
http://YOUR_IP_ADDRESS:3000
Edit the config.json file to create your scavenger hunt:
{
"hunts": [
{
"slug": "my-first-hunt",
"name": "My First Hunt",
"lang": "en",
"description": "A short description of your hunt",
"duration": "~1h",
"coordinates": { "lat": 48.8566, "lng": 2.3522 },
"manuscript": "<p>Your hunt story goes here...</p>",
"phrase": "The complete phrase players need to discover",
"defaultKeywords": ["Some", "starting", "words"],
"places": [
{
"name": "First Location",
"description": "<p>Description of this location</p>",
"coordinates": { "lat": 48.8584, "lng": 2.2945 },
"item": {
"type": "keyword",
"options": { "keyword": "hidden" }
}
}
]
}
]
}Hunt Properties
| Property | Type | Required | Description |
|---|---|---|---|
slug |
string | ✅ | Unique identifier for the hunt (used in URLs) |
name |
string | ✅ | Display name of the hunt |
lang |
string | ✅ | Hunt content language code (fr, en, ...). Determines the badge shown in the hunts list. |
description |
string | ✅ | Short description shown in the hunt list |
duration |
string | ❌ | Estimated duration (e.g., ~2h) |
coordinates |
object | ✅ | Starting point coordinates {lat, lng} |
manuscript |
string | ✅ | Hunt story/intro (supports HTML) |
phrase |
string | ✅ | Complete phrase to discover |
defaultKeywords |
array | ✅ | Starting keywords given to players |
places |
array | ✅ | List of locations in the hunt |
Place Properties
| Property | Type | Required | Description |
|---|---|---|---|
name |
string | ✅ | Location name |
description |
string | ✅ | Location description (supports HTML) |
coordinates |
object | ✅ | Location coordinates {lat, lng} |
coordinateMargin |
number | ❌ | Proximity margin in degrees (default: 0.001 ≈ 111m) |
link |
string | ❌ | External link for more information |
item |
object | ✅ | Interactive item/clue at this location |
Getting Coordinates:
- Use OpenStreetMap - right-click on the map and select "Show address"
- Use Google Maps - right-click and select coordinates to copy
- Format:
{"lat": 48.8566, "lng": 2.3522}
Automatic validation happens during:
- Build time:
npm run build - Runtime: App won't start with invalid config
Manual validation:
npm run validate:configThis checks:
- ✅ All required fields are present
- ✅ Data types are correct
- ✅ Item types are valid
- ✅ Structure matches the schema
Example error output
❌ Error validating config.json file:
1. hunts → 0 → coordinates → lat
Invalid input: expected number, received string
Total: 1 error(s) detected
💡 Check the structure and types in config.json
Items are interactive elements that players encounter at each location. Choose from these types:
A simple clickable keyword to collect.
{
"type": "keyword",
"options": {
"keyword": "treasure"
}
}2. Image
A static image without interactions.
{
"type": "image",
"options": {
"image": "/assets/my-hunt/image.png"
}
}3. Clickable Image
An image with clickable hotspots that trigger actions.
{
"type": "clickable-image",
"options": {
"image": "/assets/my-hunt/image.png",
"debug": false,
"clickableAreas": [
{
"top": "10%",
"left": "10%",
"width": "20%",
"height": "15%",
"action": {
"type": "keyword",
"options": { "keyword": "hidden" }
}
}
]
}
}Position properties: Use top/bottom and left/right with percentage values.
Actions: Can be any other item type (keyword, magnifier, image, etc.)
4. Scratch Card
An image with scratchable areas that reveal text or keywords.
{
"type": "scratch-card",
"options": {
"image": "/assets/my-hunt/scratch.png",
"width": 340,
"height": 380,
"scratchableAreas": [
{
"top": "45%",
"right": "15%",
"width": "10%",
"height": "20%",
"text": "Secret word",
"keyword": true
}
]
}
}keyword: true marks the text as a collectible keyword.
5. Magnifier
An image with a magnifying glass to reveal hidden details.
{
"type": "magnifier",
"options": {
"image": "/assets/my-hunt/image.jpg",
"keyword": "hidden",
"keywordPosition": { "x": 130, "y": 440 }
}
}Position: Pixel coordinates where the keyword is hidden.
6. Card Flip
A card that flips to reveal another image.
{
"type": "card-flip",
"options": {
"front": "/assets/my-hunt/front.png",
"back": "/assets/my-hunt/back.jpg"
}
}7. Page Flip
A book with flippable pages containing text and keywords.
{
"type": "page-flip",
"options": {
"image": "/assets/my-hunt/book.png",
"pages": [
{
"text": "<p>Page content here...</p>"
},
{
"text": "<p>Click {keyword}this{/keyword} to collect it!</p>"
}
]
}
}Keyword syntax: {keyword}word{/keyword} creates a clickable keyword.
8. Three Fiber (3D Box)
A rotatable 3D box with textures on each face.
{
"type": "three-fiber",
"options": {
"image": "/assets/my-hunt/box.png",
"textures": [
"/assets/my-hunt/right.png",
"/assets/my-hunt/left.png",
"/assets/my-hunt/top.png",
"/assets/my-hunt/bottom.png",
"/assets/my-hunt/front.png",
"/assets/my-hunt/back.png"
],
"keyword": "treasure"
}
}Texture order: right, left, top, bottom, front, back
The app interface ships in French (default) and English. Hunt content is authored independently — each hunt declares its own lang.
- Provider:
I18nProviderinsrc/components/Providers/Providers.tsx - Hook:
useTranslation()returns{ language, setLanguage, t } - Strings: declared in
src/i18n/translations.ts(type-safe via theTranslationKeyunion)
Adding a new UI string
- Add the key to both
frandenobjects insrc/i18n/translations.ts. - Use it in any component:
import { useTranslation } from '@/i18n'; const { t } = useTranslation(); return <span>{t('myNewKey')}</span>;
Adding a hunt in another language
Add a new entry in config.json with the desired lang:
{
"slug": "the-secret-of-old-lille",
"name": "The Secret of Old Lille",
"lang": "en",
"description": "Explore Old Lille and solve the puzzles...",
"manuscript": "<p>...</p>",
"phrase": "...",
"places": [ /* ... */ ]
}The hunts list automatically displays the language badge (FR, EN, ...).
scavenger-hunt/
├── config.json # Hunt configuration (validated by Zod)
├── docs/screenshots/ # README screenshots
├── public/
│ └── assets/ # Hunt images, 3D textures, icons
├── scripts/
│ └── validate-config.ts # Standalone config validator
├── src/
│ ├── app/ # Next.js App Router (pages, layout, [slug])
│ ├── components/ # React components
│ │ ├── Items/ # Interactive item implementations
│ │ ├── Map/ # Leaflet integration (Map, MarkerWithPopup, ...)
│ │ ├── Hunt/ # Hunt screen (manuscript + map tabs)
│ │ ├── HuntsList/ # Landing page hunts grid
│ │ ├── Manuscript/ # Phrase reconstruction view
│ │ ├── CompletionCard/ # End-game card
│ │ └── UI/ # Shared primitives (Icon, ParchmentCard, ...)
│ ├── contexts/ # React Context providers (Phrase, Toast, Moment)
│ ├── hooks/ # useGeolocation, useWakeLock, useOnboarding, ...
│ ├── i18n/ # Translations (fr/en) + I18nContext
│ ├── lib/ # Storage, hunts, assets, config schema
│ └── types/ # Hunt, Place, Item TypeScript types
└── tests/ # Playwright E2E tests
To create a new item type:
-
Create the component
Create a new file in
src/components/Items/YourItem/:// src/components/Items/YourItem/YourItem.tsx import { YourItemOptions } from '@/types/Item'; interface YourItemProps { options: YourItemOptions; onKeywordFound?: (keyword: string) => void; } export default function YourItem({ options, onKeywordFound }: YourItemProps) { // Your implementation return <div>Your item content</div>; }
-
Add TypeScript types
Update
src/types/Item.ts:export interface YourItemOptions { // Your options } export type ItemOptions = | KeywordOptions | ImageOptions // ... other types | YourItemOptions;
-
Update the schema
Add validation in
src/lib/config-schema.ts:const yourItemSchema = z.object({ type: z.literal('your-item'), options: z.object({ // Define your schema }) });
-
Register in ItemFactory
Update
src/components/Items/ItemFactory.tsx:import YourItem from './YourItem/YourItem'; // Add to the switch statement case 'your-item': return <YourItem options={options} onKeywordFound={onKeywordFound} />;
-
Add tests
Create
tests/your-item.spec.tswith Playwright tests.
# Run all E2E tests
npx playwright test
# Run a specific test file
npx playwright test tests/keyword.spec.ts
# Run in UI mode
npx playwright test --ui
# Run a single project (matrix)
npx playwright test --project="Mobile Chrome"Test devices
Tests run on:
- Mobile Chrome (Galaxy S24)
- Mobile Firefox (Galaxy S24)
- Mobile Safari (iPhone 15 & iPhone SE 3rd gen)
# Lint code
npm run lint
# Validate configuration
npm run validate:config-
Enable GitHub Pages
- Go to your repository → Settings → Pages
- Source: GitHub Actions
-
Deploy
- Go to the "Actions" tab
- Run the workflow: "Deploy Next.js site to Pages"
- Your site will be available at
https://<username>.github.io/<repo>/
Automatic deployment on push
The workflow is configured to deploy automatically on pushes to the main branch. Check .github/workflows/nextjs.yml to customize.
The app exports as a static site. To build:
npm run buildThis creates an out/ directory with static files.
Netlify
- Connect your repository
- Build command:
npm run build - Publish directory:
out
Or use the Netlify CLI:
npm install -g netlify-cli
netlify deploy --prod --dir=outVercel
npm install -g vercel
vercel --prodOr connect your repository through the Vercel dashboard.
Custom CDN/Server
After building, upload the out/ directory to your server or CDN:
# Build
npm run build
# Upload to your server
rsync -avz out/ user@server:/path/to/webroot/
# Or use your CDN's CLI
aws s3 sync out/ s3://your-bucket/ --deleteMake sure your server is configured to:
- Serve
index.htmlfor directory requests - Handle 404s by serving the custom 404 page
This application is licensed under the Creative Commons BY-NC-SA 4.0 License.
- Next.js - React framework
- TypeScript - Type safety
- Zod - Schema validation
- React - UI library
- OpenStreetMap and contributors
- Leaflet - Interactive maps
- React Leaflet - React bindings
- Leaflet GeoSearch - Location search
- Nominatim - Geocoding
- Bootstrap & React Bootstrap
- driver.js - Onboarding tour
- Aaron Wong - React Card Flip
- Josh Mc Farlin - React Looking Glass
- Oleg Nodlik - React Page Flip
- Shudhanshu Gunjal - React Scratch Card
- Poimandres - React Three Fiber
Fonts (via Fontsource)
- Inter Tight by Rasmus Andersson
- Geist Mono by Vercel
- Playwright - E2E testing
- GitHub Actions - CI/CD
- GitHub Copilot - AI assistance
All other credits belong to Vincent CHALAMON for the original idea, design and development of the application.






