AI Deploy Network
Software & SaaSAI AgentAI Case Study

On-Device Generative Mobile Runtime & Sandboxed TSX Execution Engine

AI Deploy Network Approved

Engineered Meta Box, a mobile-first generative runtime that lets users create, preview, and run interactive utilities and mini-games directly on their phones from plain-language prompts—eliminating cloud build servers and reducing creation time from hours to under a minute.

Melih Can DemirBy Melih Can Demir
Chapter 01

The Business Challenge

The business situation the organisation faced before the project began.

Generating and running interactive mobile software via LLMs typically requires desktop IDEs, heavy cloud build pipelines, and recurring API markups, preventing real-time on-device code synthesis and execution.

Chapter 02

Why AI Was the Right Solution

Why AI was the right approach — and what alternatives were considered.

Pre-built templates and rigid no-code blocks fail when users want genuinely custom logic, interactive state, or tailored layouts from an open-ended idea. No deterministic rule set can anticipate the endless combinations of utilities, calculators, data views, and game mechanics a user might ask for on the fly.

Generative AI provided the semantic reasoning needed to translate ambiguous natural-language intent into structured, stateful UI and logic—while pairing that generation with deterministic syntax validation ensured the output remained reliable enough to execute safely inside a constrained mobile runtime.

Chapter 03

How the Solution Was Delivered

Discovery, design, development, testing and rollout — the journey, not the tooling.

  1. 1Problem framing & constraint mapping: Identified the core bottlenecks preventing non-technical mobile users from building software—namely desktop IDE friction, remote compilation latency, and prohibitive API subscription markups.
  2. 2Sandbox & safety architecture design: Designed an isolated, client-side execution boundary capable of rendering dynamic interfaces safely on mobile hardware without exposing host OS resources or requiring server-side compilation.
  3. 3Deterministic quality-gate prototyping: Built an automated pre-execution validation layer to catch malformed syntax and runtime faults before generated code reaches the user screen, ensuring predictable execution across varied prompts.
  4. 4Multi-provider & BYOK monetization modeling: Structured a flexible routing layer supporting both local inference and user-supplied API keys, removing unit-economics risk from heavy token consumption while keeping core creation accessible.
  5. 5Production hardening & Google Play rollout: Validated end-to-end prompt-to-runtime latency across real-world utility and mini-game scenarios, localized the experience for global distribution, and shipped the production release on Google Play.
Chapter 04

Key Technical & Architecture Decisions

Architecture, model selection, workflow and trade-offs.

On-Device Sandboxed Execution vs. Cloud Compilation: Rather than spinning up remote build containers or streaming WebViews from a backend, I engineered an isolated client-side TSX runtime directly inside React Native/Expo. The trade-off was strict sandboxing complexity and tighter memory boundaries on mobile hardware, which paid off by eliminating server build latency and recurring infrastructure costs.

Multi-Provider Routing & BYOK Economics: Instead of locking the runtime to a single cloud model or absorbing unpredictable token burn through fixed subscriptions, I built an abstraction layer supporting local inference (Ollama) alongside user-supplied API keys (OpenAI, Anthropic Claude, Google Gemini, Groq, DeepSeek). This preserved near-zero marginal operating cost while letting users choose between offline privacy, ultra-low latency, or frontier reasoning.

Deterministic AST Validation Gate: LLMs inevitably produce broken JSX tags, missing imports, or unsafe global references under tight latency constraints. Placing a lightweight syntax and AST verification pass between model output and runtime mounting traded a few milliseconds of preprocessing for near-zero runtime crashes.

Chapter 05

Challenges & How They Were Solved

Obstacles hit along the way and how they were overcome.

Runtime Isolation & Host Protection: Executing dynamically generated TSX on a mobile device carries the risk of infinite loops, memory spikes, or unintended access to host APIs. I solved this by restricting the execution scope to an explicit allowlist of safe UI primitives, state hooks, and sandboxed utilities, ensuring malformed or runaway scripts fail gracefully inside a contained boundary without crashing the host application.

Prompt-to-Code Reliability Across Diverse Models: Smaller or faster models often struggle with consistent component structure when generating complete interactive tools in a single pass. By enforcing strict system-level output contracts and pairing them with automated pre-mount validation, the runtime reliably renders functional utilities and stateful mini-games even on fast, lightweight inference endpoints.

Chapter 06

User Adoption & Change Management

How users responded — training, change management and feedback loops.

Immediate Visual Feedback Loop: Non-technical mobile users abandon developer tools the moment they see raw stack traces or configuration screens. I designed the workflow around instant live previews and an accessible on-device code editor so users see working screens within seconds, while power users can inspect or tweak the generated TSX directly on their phone.

Lowering Friction Through Concrete Starting Points: Shipping ready-to-run examples—such as live currency converters, developer news aggregators, and playable mini-games—helped new users immediately grasp what the runtime could produce on-device, shifting their behavior from passive app browsing to iterative prompt-driven creation.

Business Impact

Business Outcomes & Impact

The measurable outcomes from the underlying AI Deployment — with the story behind them.

Hours Automated
0
Cost Savings
Currency not specified
Revenue Impact
Currency not specified
Measurable Business Outcome

Sub-second on-device TSX transpilation and sandboxed rendering via Sucrase; zero cloud build server overhead; direct BYOK routing across 5+ LLM providers with client-side execution isolation.

Business Outcome Categories

Productivity ImprovementTime SavingsQuality ImprovementAI Performance Improvement

The story behind the numbers

Eliminating server-side build infrastructure and recurring cloud compilation overhead fundamentally changed the unit economics of mobile app creation. Instead of maintaining expensive remote build farms or passing steep API markups onto users, the local-first execution model allowed Meta Box to operate with near-zero marginal compute cost per generated micro-app.

For end users, collapsing the traditional setup-code-compile-deploy loop into a sub-minute prompt-to-runtime workflow removed the technical barrier to building bespoke mobile tools. Users can generate functional utilities—such as live currency converters, developer news aggregators, and playable mini-games—on the spot without touching a computer, turning passive mobile consumption into immediate on-device creation.

Reflection

Lessons Learned

What surprised the team, what worked well, and what would be done differently.

  • What surprised me: Lightweight, low-latency models paired with strict AST validation consistently outperformed larger frontier models in real mobile usability because sub-second iteration mattered far more to users than complex single-shot generations.
  • What I'd do differently: Build the deterministic AST repair and syntax sanitization layer before writing a single system prompt, rather than discovering edge-case JSX and runtime quirks iteratively during live device testing.
  • What worked well: Pairing an isolated client-side TSX sandbox with BYOK and local inference routing eliminated cloud build overhead completely while letting users turn natural-language ideas into live utilities and mini-games in under a minute.
Looking Ahead

Future Opportunities

Where this solution could go next.

Multi-Agent Self-Healing Generation Loop: Expanding the single-pass generation flow into a deterministic multi-agent pipeline—where specialized planning, synthesis, and static-analysis agents automatically inspect AST diagnostics and repair edge-case faults before the user ever sees an error state.

Persistent Local Data & Cross-Widget Composition: Introducing sandboxed local storage primitives and modular component linking so users can connect multiple generated micro-apps into cohesive personal workspaces, paired with fully offline mobile NPU/LLM execution as local device models continue to shrink.

For Peers

Professional Reflections

Guidance for another builder tackling a similar problem.

Treat Deterministic Validation as a First-Class Layer: Never rely on prompt engineering alone when executing AI-generated code on client devices. Investing early in strict AST boundaries, safe API allowlists, and graceful error containment matters far more than chasing marginal benchmark gains on raw code generation.

Design Unit Economics Into the Architecture Early: For AI-native consumer products, cloud inference and build infrastructure costs can silently break viability at scale. Architecting around local-first execution and BYOK flexibility from day one protects margins while giving end users genuine ownership over their runtime environment.