SIMLYFE: AI-Assisted Life Simulator

Personal Project

2025 – 2026

Problem

LLM-generated content is compelling but unreliable: left unconstrained it breaks game-state coherence, and calling it naively from the browser leaks API keys. The challenge was building a playable, shippable game where procedural LLM narrative and deterministic simulation systems reinforce rather than corrupt each other.

Constraints

  • LLM output must respect current game state (age, career, finances, relationships)
  • API keys must never reach the client — all inference server-side
  • Mobile-first performance: playable on mid-range phones in the browser
  • LLM latency and cost per event had to stay low enough for a free-to-play loop
  • Game logic had to remain testable independently of non-deterministic LLM output

Approach

Split the architecture into a deterministic JavaScript simulation core and an AI narrative layer that receives a bounded game-state projection and returns schema-validated events. A Supabase Edge Function verifies Firebase identity and request origin, applies durable quotas, owns the OpenAI prompt and model configuration, and keeps provider credentials off the client. Firebase Auth and Firestore provide identity and cloud saves.

Architecture

game-state contextschema-validated eventssavesReact 19 Clientmobile-first UIDeterministic Sim Coreeconomy·careers·relationshipsSupabase Edge Fnauthenticated boundaryOpenAI Serviceevent engineFirebaseAuth + Firestore saves
React 19 client → deterministic simulation core ⇄ authenticated Supabase Edge Function → OpenAI event service; Firebase Auth and Firestore provide identity and saves

Metrics

MetricBaselineAchieved
Automated test casesCI checked Oct 27, 2026795 Vitest cases across 39 files
Provider credential boundaryDirect browser calls avoidedAuthenticated proxy with server-owned OpenAI credentials
Live acceptanceHistorical v19 repair check retainedCurrent v20 event resolved; same-browser reload passed

Product Impact

A publicly hosted game demonstrating tested LLM integration boundaries: bounded game-state prompting, server-side key management, schema validation, and separation of deterministic and generative layers. After diagnosing a too-small Nano completion ceiling, five consecutive generated events at ages 6–10 resolved successfully and the same life returned after reload. A subsequent current v20 event resolved and restored age 1/history/stats after reload. These bounded checks do not establish a reliability SLO, broad narrative quality, cost or cross-device recovery.

Tech Stack

React 19
JavaScript
Vite 8
Supabase Edge Functions
Firebase Auth
Firestore
OpenAI
Vitest
Vercel

Links