Ssteven_copy
case_study · 01 / 06·Startup · entrepreneurial project·beta

Klorv.

SaaS platform that turns a user prompt into a functional mobile app, scannable live via Expo. AI pipeline distributed across three Docker workers, freemium with Stripe paywall, deployed on Hetzner.

30
Supported game archetypes
3
Specialized Docker workers
~$0.01
AI cost per generation
61
Test files
Next.jsReactTypeScriptTailwind CSSSupabaseBullMQRedisDocker SwarmDeepSeek APIExpongrokStripeGitHub OAuthHetzner

// 01 · the-context

The context

Building a mobile app is still long, expensive and technical for non-developers. Even for experienced devs, shipping a working MVP takes weeks.

With my co-founder, we asked a simple question: what if you could describe your idea in natural language and get a working app? Not a mockup. Not a prototype. A real app you scan with your phone.

That's Klorv's promise. The technical bet: turn a user prompt into generated, validated, packaged, playable code in an Expo preview — in minutes, for about one cent of AI cost.

// 02 · the-solution

The solution

I designed and built the entire AI pipeline and infrastructure. The architecture is a multi-service monorepo with a Next.js web app for the chat + editor interface, and three specialized Docker workers passing jobs through Redis (BullMQ).

The pipeline in 5 steps

// code
1. User types a prompt in the editor
   → POST /api/ai/sessions/[id]/messages → 202 immediate
   → BullMQ job enqueued in Redis

2. AI Queue Worker claims the job
   → Loads project files from Supabase
   → Determines the mode (ask / plan / build)
   → POSTs to the Claw Worker

3. Claw Worker executes the agent
   → DeepSeek agent loop (reasoner for build, chat for ask)
   → Agent reads/writes/lists files via tool use
   → Returns changedFiles[]

4. AI Queue Worker validates and applies
   → Whitelist paths, protected files
   → Snapshot current version
   → Apply patches via transactional RPC

5. Expo Preview Worker detects the change
   → Scaffolds an Expo project
   → Launches expo start + ngrok tunnel
   → Publishes URL → playable preview in editor iframe

The 3 Docker workers

AI Queue Worker — The orchestrator. BullMQ consumer that atomically claims ai_runs, orchestrates the whole pipeline (scaffold → claw → validation → apply patches → snapshot), handles user quotas and cost guard.

Claw Worker — The LLM executor. HTTP server on :8787 that fully isolates the model call. Zero direct database access: it receives files[], returns changedFiles[], authenticated by bearer token. That's what lets us scale inference independently from the rest.

Expo Preview Worker — The mobile runner. Polls pending expo_previews, manages one active tunnel at a time (expo start + ngrok), cleans workspaces, kills orphan processes, applies exponential backoff on errors.

The Klorv design system

I designed 30 game archetypes in the orchestrator package's ARCHETYPE_REGISTRY (runner, platformer, match3, idle-clicker, roguelike-dungeon, bullet-hell, crossword, sandbox-painting, card-deckbuilder, rhythm-tap, etc.). Each archetype defines a gameplay skeleton and a coherent visual theme.

Users prompt in free language, but the system constrains generation to an identified archetype — which guarantees code coherence and result quality.

// 03 · technical-challenges

Technical challenges

Pipeline reliability. An LLM can break anything. Error handling isn't an option, it's the core of the system. I set up a 10-minute max build timeout and a 3-minute repair timeout if the agent tries to fix an error. Jobs that exceed are killed cleanly and the AI cost stays predictable (~$0.01 per run on average with DeepSeek).

Separation of concerns. If the Claw Worker crashes, the rest keeps running. If the Expo Preview Worker bugs, builds keep generating. This strict separation is what makes the platform robust — not the code of each individual worker.

Freemium and quotas. Free tier allows 5 builds/day on the UI side and 20 builds/day via the API, with a monthly cap. Above that, Stripe paywall with 3 plans (pro, max, enterprise). The cost-guard computes AI cost in real-time during generation and cuts off if the quota is exceeded. No bad surprises for the user, no bad surprises for our DeepSeek invoice.

61 test files. With the pipeline distributed across multiple workers, it's test coverage that guarantees a change on one worker doesn't break the others.

// 04 · status

Status

Publicly launched with freemium and Stripe paywall (3 plans: pro, max, enterprise). Auth via GitHub OAuth + Supabase. Deployed on Docker Swarm on Hetzner, GitHub Actions CI/CD.

// 05 · tech-stack

Tech stack

LayerTechnologies
FrontendNext.js, React, TypeScript, Tailwind CSS
BackendNext.js API routes, Supabase (Postgres + Auth)
QueueBullMQ + Redis
AIDeepSeek API (reasoner for build, chat for ask)
WorkersNode.js HTTP servers (3 independent Docker services)
PreviewExpo + ngrok (live tunnels)
Auth & paymentsGitHub OAuth, Supabase Auth, Stripe
InfraDocker Swarm on Hetzner, GitHub Actions CI/CD

// 06 · what-im-taking-away

What I'm taking away

Klorv forced me to rethink what "integrating an LLM in production" really means. The real challenge is never the prompt. It's the architecture around it: queues, timeouts, service isolation, cost guards, quotas, snapshots, rollbacks.

Anyone can build an AI demo. A reliable AI system in production is a different job — and that's exactly what I bring to AI integration missions today.