YourPlayground.games — Canonical Engineering, Scientific Research & Platform Documentation Suite
Platform Motto: "Dream It. Prompt It. Play Your Universe."
Canonical Origin: https://www.yourplayground.games | Local Runtime: http://localhost:9033
AI Compute Backbone: Google Cloud Vertex AI (project: 'ids-hybrid-model', location: 'global')
Default Active Coding Model: gemini-4-neon (XHIGH Thinking) | Forensic 1-Shot Repair Model: gemini-4-carbon
1. Platform Vision & Engineering Philosophy
YourPlayground.games (www.yourplayground.games) is an AI-native multi-surface game creation studio, instant playable browser arcade, and universal iOS/Android mobile & tablet ecosystem. Any creator or player—with or without an account, and without writing a single line of code—can describe a 2D or 3D game concept in plain English, unlock synthesis via a lightweight rewarded-ad gate (Watch Ad -> Earn Credit -> Generate & Play), and immediately play, remix, export, or compete on global leaderboards inside a cryptographically and origin-isolated execution sandbox.
Every subsystem of the platform is engineered from first principles around five non-negotiable architectural pillars:
- Deterministic Neuro-Symbolic Game Synthesis: Coupling
gemini-4-neon(XHIGHreasoning) for rapid single-file HTML5 Canvas 2D, Phaser 3.90.0, and Three.js r160 synthesis with linear-time structural validation, V8vm.Scriptcompilation verification, andgemini-4-carbon1-shot forensic root-cause repair. - Linear-Time
O(N)Sandbox Isolation: Eliminating regular-expression catastrophic backtracking (O(2^N)ReDoS) and cross-origin data exfiltration through spec-exact WHATWG HTML5 §13.2.5, W3C CSS Syntax Level 3, and ECMA-262 lexical state machines paired with opaque-origin<iframe sandbox="allow-scripts allow-pointer-lock">OOPIF isolation. - 1:1 Cosmic Midnight Visual Craft: Matching the canonical visual design anchors (
your_playgrpound_games_design_1.pngandYapay Zekâ Evrenini Oyna ve Yarat-1.png) across desktop, tablet, and mobile viewports—combining deep cosmic midnight surfaces, violet glassmorphism, luminous cyan-to-violet-magenta gradients, andgemini-nano-banana-2.1/gemini-3-pro-imagetext-free multimodal artwork. - Near-Zero-Spend 5-Pillar Organic Discovery (
SEO+GEO+ASO+AEO+AIO): Delivering full Server-Side Rendered (SSR) HTML5 documents with zero client-JS dependency for crawlers, interconnected Schema.org@graphJSON-LD topologies,/llms.txt&/llms-full.txtcorpora,/.well-known/ai-context.json,IndexNowinstant push notifications, and installable PWA / native store readiness. - Sustainable Free-to-Play Rewarded Monetization & Privacy-First Telemetry: Financing frontier AI compute via Google AdSense, Google IMA HTML5 SDK VAST 4.2 rewarded video, single-use HMAC-SHA256
adGrantTokencryptographic state machines, Google AdMob on iOS/Android, and default-denied Google Consent Mode v2 (ypg_consent_v2).
2. High-Level Architectural Topology
flowchart TB
subgraph Clients["Multi-Surface Client Tier"]
WebSSR["Desktop & Mobile Web Shell<br/>(SSR HTML5 + ES Modules)"]
PWA["Installable PWA Shell<br/>(/manifest.webmanifest + ypg-shell-v2 SW)"]
MobileApp["iOS & Android Universal App<br/>(Phone & Tablet Adaptive Stage)"]
end
subgraph Edge["Express 5 HTTP Engine (:9033 -> www.yourplayground.games)"]
SecMW["Security & Cache Hygiene Layer<br/>(SSR CSP, X-Frame-Options, No-Store HTML)"]
SessMW["HMAC-SHA256 Cookie Middleware<br/>(ypg_vid 30d + Optional ypg_sid 7d)"]
PagesR["SSR Pages & Growth Router<br/>(/, /showcase, /categories, /games/:slug, /faq)"]
DiscR["AI & Search Discovery Router<br/>(/robots.txt, /sitemap.xml, /llms*.txt, /.well-known/*)"]
ApiR["REST API Routers<br/>(/api/config, /api/ads/*, /api/games/*, /api/auth/*)"]
RunR["Isolated Runtime Router<br/>(/runtime/:slug/* + RUNTIME_CSP_HEADER)"]
end
subgraph Core["Core Domain & Security Services"]
AdGate["Ad-Gate State Machine<br/>(adGateService.mjs · Single-Use JTI)"]
GenSvc["Game Synthesis Orchestrator<br/>(gameGeneratorService.mjs)"]
Sanitizer["Linear-Time O(N) Sanitizer<br/>(gameSanitizer.mjs + vm.Script + SDK)"]
VertexSvc["Vertex AI Client & Auth Resilience<br/>(vertexAiService.mjs · 45m gcloud Fallback)"]
IdxNow["IndexNow Instant Publisher<br/>(indexNowService.mjs)"]
end
subgraph Persistence["Crash-Safe Atomic Persistence & Cloud Backing"]
AtomicFS["Copy-on-Write JSON & Binary Store<br/>(storage/catalog.json, users.json, games/*)"]
VertexCloud["Google Cloud Vertex AI<br/>(project: ids-hybrid-model · location: global)"]
FirebaseCloud["Firebase Mobile Cloud Suite<br/>(Auth, Firestore, Storage, Remote Config, App Check)"]
end
WebSSR --> SecMW
PWA --> SecMW
MobileApp --> ApiR
MobileApp --> FirebaseCloud
SecMW --> SessMW
SessMW --> PagesR
SessMW --> DiscR
SessMW --> ApiR
SecMW --> RunR
ApiR --> AdGate
ApiR --> GenSvc
GenSvc --> VertexSvc
GenSvc --> Sanitizer
GenSvc --> AtomicFS
GenSvc --> IdxNow
VertexSvc --> VertexCloud
RunR --> AtomicFS
PagesR --> AtomicFS
DiscR --> AtomicFS
3. Master Documentation Navigation Table (10 Domain Volumes)
All documentation inside docs/ is self-contained, portable, and cross-linked directly to the live codebase.
| Vol. | Domain Volume | Document Path | Core Engineering & Scientific Scope | Primary Codebase Traceability |
|---|---|---|---|---|
| 01 | System Architecture | architecture/SYSTEM_ARCHITECTURE.md | Express 5 SSR engine (:9033), null-origin OOPIF runtime, copy-on-write atomicJson persistence, ypg-shell-v2 cache-purge invariant, cross-platform mobile/tablet topology, and 10-layer butterfly-effect matrix. | server.mjs, src/app.mjs, src/storage/atomicJson.mjs, public/sw.js |
| 02 | Frontier Research Foundations | research/FRONTIER_RESEARCH_FOUNDATIONS.md | Constrained neuro-symbolic synthesis for 60 FPS interactive loops, Markov convergence math for Gemini 4 Neon → Gemini 4 Carbon 1-shot repair, multimodal crop-to-asset style locking, O(N) DFA vs O(2^N) NFA ReDoS proofs, GEO/AIO retrieval mechanics, and rewarded-ad game theory. | src/services/gameGeneratorService.mjs, src/services/gameSanitizer.mjs, scripts/generate-creatives.mjs |
| 03 | UI/UX Design Specification | design-system/UI_UX_DESIGN_SPECIFICATION.md | Canonical 1:1 visual specification anchored to docs/UI/*.png: Cosmic Midnight palette (#080A1A), #2CEEF8 -> #7C5CFF -> #D946EF gradients, violet glassmorphism, full-bleed hero blending, 5-stat ribbon, 4-step flow, carousel, ticket banner, horizon footer, non-overlapping consent bar, and phone/tablet/desktop breakpoints. | docs/UI/your_playgrpound_games_design_1.png, docs/UI/Yapay Zekâ Evrenini Oyna ve Yarat-1.png, public/assets/css/tokens.css, src/views/layout.mjs |
| 04 | Vertex AI & Model Routing | ai-engine/VERTEX_AI_AND_MODEL_ROUTING.md | Complete 8-model engineering matrix (gemini-4-neon default, gemini-4-carbon repair, hydrogen, argon, 3.8/3.7/3.6-flash, 3.1-pro-preview), thinking-level clamping calculus (MINIMAL..XHIGH/AUTO), 32,768 output token floor, Nano Banana 2.1 & Gemini 3 Pro Image, and 45-minute cached gcloud CLI fallback on invalid_rapt. | src/config/models.mjs, src/services/vertexAiService.mjs, src/services/gameGeneratorService.mjs |
| 05 | Sandbox & O(N) Sanitizer | security/SANDBOX_AND_ON_SANITIZER.md | Linear-time O(N) complexity proofs across HTML5/CSS3/ECMA-262 scanners, blocked exfiltration sinks, local /vendor/{phaser.min.js,three.min.js} whitelisting, allow-scripts OOPIF null-origin isolation, dual CSP headers (SSR_CSP_HEADER vs RUNTIME_CSP_HEADER), HMAC-SHA256 cookies, and adversarial fuzzing benchmarks. | src/services/gameSanitizer.mjs, src/routes/runtimeRouter.mjs, src/middleware/sessionMiddleware.mjs |
| 06 | 5-Pillar Organic Growth Stack | growth/ORGANIC_GROWTH_5_PILLAR_STACK.md | Near-zero-marketing-spend SEO + GEO + ASO + AEO + AIO stack: SSR canonical graph (https://www.yourplayground.games), Schema.org @graph JSON-LD builders, /llms.txt, /llms-full.txt, /.well-known/ai-context.json, IndexNow instant push, Google/Bing/Yandex verification tags, and PWA manifest. | src/seo/metaBuilder.mjs, src/seo/schemaBuilder.mjs, src/routes/discoveryRouter.mjs, src/services/indexNowService.mjs |
| 07 | Ads, Monetization & Consent | monetization/ADS_AND_CONSENT_ARCHITECTURE.md | Google AdSense publisher/slot integration, Google IMA HTML5 SDK VAST 4.2 rewarded video gate, single-use HMAC adGrantToken state machine, play-credit loop, Google AdMob iOS/Android placements, Google Consent Mode v2 (ypg_consent_v2), and GA4 / GTM / Microsoft Clarity telemetry (window.ypgTrack). | src/services/adGateService.mjs, src/routes/apiAdsRouter.mjs, public/assets/js/adGateModal.mjs, public/assets/js/authModal.mjs |
| 08 | Mobile & Tablet Architecture | mobile/MOBILE_AND_TABLET_ARCHITECTURE.md | Universal iOS & Android phone + tablet application blueprint: 1:1 docs/UI adaptive split-stage UX, hardware-accelerated isolated WKWebView/android.webkit.WebView + virtual touch bridge, full Firebase suite (Auth, Firestore, Storage, Analytics, Crashlytics, FCM, Remote Config, App Check), AdMob mediation, and store release checklists. | public/assets/js/playerStage.mjs, src/routes/discoveryRouter.mjs, src/config/env.mjs |
| 09 | API & Runtime SDK Reference | api/API_AND_RUNTIME_SDK_REFERENCE.md | Complete HTTP REST API specification (/api/health, /api/config, /api/ads/*, /api/games/* including sprites, scores, and game metadata & score contract, /api/auth/*, /auth/google/*), JSON schemas, error codes, body-size guards, and window.YourPlaygroundSDK postMessage bridge protocol. | src/routes/apiConfigRouter.mjs, src/routes/apiGamesRouter.mjs, src/routes/authRouter.mjs, src/services/gameSanitizer.mjs |
| 10 | Operations & Verification Ladder | operations/RUNBOOK_AND_VERIFICATION_LADDER.md | Production deployment runbook, exhaustive .env configuration dictionary (Vertex AI, AdSense, VAST, GA4, GTM, Clarity, Search Console, Bing, Yandex, IndexNow, OAuth, Firebase, AdMob), Zero-Ghost-UI Service Worker cache hygiene, and the 5-Rung Deterministic Verification Suite. | src/config/env.mjs, package.json, public/sw.js |
| 11 | QA Verification Matrix & Defect Ledger | operations/qa-department-matrix-and-defect-ledger.md | Full-stack QA department verification architecture, multi-layer acceptance gates (Backend/Security, 5-Pillar SSR/Visual Lock, All 12 Browser Games Interactive & 60 FPS Pacing, Mobile Read-Only Parity), and live closed-loop defect & retest ledger (PRE-001, QA-001..QA-NNN). | tests/unit/, tests/integration/, tests/e2e/, mobile/scripts/verify-mobile-contracts.mjs |
| 12 | ASO & 5-Pillar Dynamic URL Growth | growth/ASO_AND_5PILLAR_GROWTH_ARCHITECTURE.md | Programmatic dynamic SSR hubs (/creators/:slug, /engines/:slug, /models/:slug), Google Image Sitemap + /sitemap-index.xml, 38-bot /robots.txt, /ai.txt, /.well-known/llms.txt, RFC 9116 security.txt, live RSS/Atom/JSON feeds, Android/iOS deep links (assetlinks.json, AASA), /app-ads.txt, and Apple App Store + Google Play ASO metadata pack. | src/seo/growthCatalog.mjs, src/views/hubViews.mjs, src/routes/discoveryRouter.mjs, src/services/indexNowService.mjs |
4. Canonical Visual Reference Assets (Read-Only Immutable Locks)
The two visual design anchor artifacts inside docs/UI/ define the canonical 1:1 atmosphere, typography hierarchy, glassmorphism, color science, and layout geometry for both the web platform and universal mobile/tablet applications:
- Primary Cosmic Platform Panorama & Full Funnel Reference:
docs/UI/your_playgrpound_games_design_1.png(2,806,971bytes, SHA-256ACCA31B4AE1CF937EDB649C8C2FBAF8BF13BE733...) - Companion AI Studio & Community Remix Reference:
docs/UI/Yapay Zekâ Evrenini Oyna ve Yarat-1.png(2,302,623bytes, SHA-2569941B38AA52EA25E4BA802F55F85E6FFD3AF49FC...)
[!IMPORTANT]
Both PNG artifacts inside docs/UI/ are governed by a strict read-only preservation invariant. Asset synthesis workflows inspect or crop regions exclusively into isolated scratch buffers and generate clean, text-free high-resolution artwork via gemini-nano-banana-2.1 or gemini-3-pro-image without mutating docs/UI/*.
5. Core Invariants Summary
| Invariant Domain | Canonical Value / Enforcement Mechanism | Verification Rung |
|---|---|---|
| Local HTTP Port | 9033 (http://localhost:9033 via server.mjs) | Rung 4 (Live HTTP) |
| Canonical Origin | https://www.yourplayground.games (CANONICAL_ORIGIN in src/seo/metaBuilder.mjs) | Rung 2 & Rung 4 |
| Default Coding Model | gemini-4-neon (XHIGH supported, maxOutputTokens >= 32768) | Rung 2 & Rung 3 |
| Default Repair Model | gemini-4-carbon (temperature: 0.3, 1-shot structural & vm.Script repair) | Rung 2 & Rung 3 |
| Sanitizer Complexity | Θ(N) time and O(N) space in document byte length N; zero backtracking regexes | Rung 2 (Adversarial) |
| Game Sandbox | <iframe sandbox="allow-scripts allow-pointer-lock"> (origin === "null") + RUNTIME_CSP_HEADER | Rung 4 (CDP/OOPIF) |
| Zero Ghost-UI Cache | ypg-shell-v2 deletes all key !== CACHE_NAME on activate; skips navigate & text/html | Rung 4 & Rung 5 |
| Language Standard | 100% English across all code, UI, SSR metadata, JSON-LD, discovery corpora, and docs/* | Rung 1 & Rung 5 |