How woutdp/geoquest works
Project type and purpose
• This is a full-stack, SvelteKit-based Progressive Web App (“map quiz game”) that runs entirely on Cloudflare Pages/Workers.
• On the client side it delivers a rich, interactive geography quiz (maps, achievements, quests, multilingual UIs, sounds). On the server side it provides a small set of serverless endpoints (e.g., a “buy me a coffee” webhook).
File structure
• Top-level config files (svelte.config.js, vite.config.js, wrangler.toml) signal a SvelteKit/Vite app deployed as Cloudflare Workers/Pages.
• src/routes – SvelteKit pages & server routes (/api/webhooks/coffee).
• src/lib – core components and domain logic:
– Game logic & state (Game.svelte, store.ts, map.ts, jwt.ts)
– Static data assets (maps, quests, translations)
– Utility modules (utils.ts, sounds.ts)
• static – truly static files (ads.txt, manifest, robots.txt).
• service-worker.ts – PWA caching logic.
• schema.sql – (future or external) persistence schema (not currently used in code).
README
• Standard SvelteKit dev/build scripts.
• Translations guidelines.
a. Main components
• Browser (Client UI):
– SvelteKit SPA shell (SSR entry + hydration)
– Service Worker (offline caching, asset routing)
– Game logic components (Game.svelte + store)
– UI, map, assets loader modules
• CDN/Static Host (Cloudflare Pages):
• Serverless Runtime (Cloudflare Workers):
– SvelteKit SSR endpoints under /routes (SSR of pages, SSR+API handlers)
– API webhook endpoint (/api/webhooks/coffee) for third-party integration
• External Services:
– BuyMeACoffee (incoming webhooks)
– Possible analytics or other integrations
• (Optionally) Database or KV store:
– Represent schema.sql as a future or external DB component or Cloudflare D1/KV
b. Relationships & interactions
– On page load, Browser → CDN: fetch HTML/JS/CSS (via global CDN edge).
– Service Worker intercepts requests, serves cached assets or falls back to network.
– Browser ↔ Serverless Runtime for SSR or data calls.
– Browser loads static JSON (maps/quests/translations) directly from CDN or via fetch.
– API webhook: Cloudflare Worker → external “BuyMeACoffee” service.
– (If DB used) Worker endpoints → Database.
c. Architectural patterns & design principles
– Hybrid SSR + client hydration (SvelteKit)
– PWA with Service Worker for offline/fast caching
– Serverless functions for minimal backend (edge computing)
– Separation of concerns: UI components vs domain logic vs data assets vs translations
– Asset-heavy static hosting, “map/quest” micro-data files
d. Key technologies & frameworks
– SvelteKit & Vite for build and routing
– Tailwind CSS / PostCSS for styling
– Cloudflare Pages / Workers (wrangler.toml) for deployment
– Service Worker API for PWA caching
– JSON-based assets (maps, translations, quests)
Elements
– HTML/JS/CSS/JSON asset requests (Browser → CDN)
– SSR & API calls (Browser → Worker → [optional DB])
– Webhook call (Worker → BuyMeACoffee)
– Client-side (blue) vs Static (green) vs Dynamic/serverless (orange) vs External (purple)