SIMLYFE: AI-Assisted Life Simulator
Personal Project
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
Metrics
| Metric | Baseline | Achieved |
|---|---|---|
| Automated test assertions | 0 | 350+ (engine, LLM boundary, market) |
| Client-side API key exposure | Common naive pattern | Zero — server-side proxy |
| Deployment | Prototype | Live on Vercel with cloud saves |
Product Impact
A shipped, publicly playable game demonstrating production LLM integration patterns: structured prompting against live application state, server-side key management, schema validation at the LLM boundary, and a test suite that keeps deterministic and generative layers safely separated.