Llama Coder

Generate multi-file web apps from a single prompt using open-source LLMs — an open-source alternative to Claude Artifacts.

7Kstars
1.7Kforks
MIT License
TypeScript

Llama Coder is an open-source AI code generator that converts a plain-English prompt into a complete, runnable multi-file React web application in seconds. It’s built as an open alternative to Claude Artifacts, letting anyone spin up a working app prototype without writing a single line of code.

The generator supports a growing roster of frontier open-source models via Together AI, including Llama 3.3 70B, Qwen3 Coder 480B, GLM 5.1, MiniMax M2.7, and DeepSeek V3. A screenshot-to-code mode lets users upload a UI image and get a faithful React recreation. Every generated app runs live inside a Sandpack sandbox with real-time preview, and the integrated Monaco editor with syntax highlighting allows on-the-fly edits without leaving the browser.

Conversation history is persisted in PostgreSQL via Neon so sessions survive page refreshes, and a multi-turn chat interface lets users iterate on their app through natural language follow-up requests. Generated projects can be downloaded as a ZIP archive or shared via a public URL with a dynamic Open Graph preview image.

Self-hosting requires only three environment variables — a Together AI API key, a CodeSandbox API key, and a Neon PostgreSQL connection string — and the project deploys cleanly on Vercel with Prisma handling schema migrations automatically at build time.

What You Get

  • Multi-File App Generation - Prompts are processed through a two-stage pipeline: an architect model decomposes the request into a structured plan, then a coder model generates a complete multi-file React + TypeScript + Tailwind + Shadcn UI application with proper file organization across App.tsx, components, utilities, and types.
  • Live Sandpack Preview - Every generated application runs instantly in a Sandpack sandbox with a real-time preview panel, so you can see the working app alongside the generated code without any local setup or build steps.
  • Monaco Code Editor with Syntax Highlighting - The integrated Monaco editor backed by Shiki syntax highlighting lets you inspect, edit, and iterate on any generated file directly in the browser, with proper language-aware coloring for TypeScript and JSX.
  • Screenshot-to-Code Mode - Upload a UI screenshot and the Kimi K2.5 multimodal model will describe it in detail before generating a faithful React recreation, enabling rapid cloning of existing interfaces.
  • Multi-Model Support - Switch between Llama 3.3 70B, Qwen3 Coder 480B, GLM 5.1, MiniMax M2.7, and DeepSeek V3 through a model selector, with automatic alias resolution ensuring continuity when models are updated or deprecated.
  • Persistent Chat Sessions - Conversation history is stored in PostgreSQL via Neon, so multi-turn refinement sessions survive page refreshes and can be resumed or shared later.
  • ZIP Download and Sharing - Download the complete generated project as a ZIP archive via JSZip, or share it publicly via a permalink with a dynamically generated Open Graph image that previews the app.
  • Helicone Observability - When configured, all LLM calls are routed through Helicone with session IDs tied to each chat, giving operators full visibility into model usage, latency, and cost per generation.

Common Use Cases

  • Rapid Prototype Validation - A product manager types a feature description and gets a working interactive mockup in under a minute, enabling stakeholder demos without involving engineering resources.
  • UI Recreation from Screenshots - A designer uploads a screenshot of a competitor’s feature and generates a React implementation as a starting point for their own version, using the screenshot-to-code mode.
  • Learning React Patterns - A junior developer generates a Kanban board or expense tracker from a prompt, then studies the multi-file output to understand component architecture, custom hooks, and Shadcn UI usage patterns.
  • Internal Tool Scaffolding - A solo founder generates a dashboard or form-heavy admin panel as a scaffold, downloads the ZIP, and extends it with real API calls and business logic in their own codebase.
  • Hackathon Speed - A team uses Llama Coder to generate the frontend for their hackathon project in minutes, freeing them to focus on the backend and presentation rather than boilerplate UI.
  • Component Exploration - A developer prompts for a specific interactive component — a drag-and-drop list, a multi-step wizard, or an animated data visualization — to see how it can be built with Shadcn UI and Framer Motion before writing it from scratch.

Under The Hood

Architecture The application follows the Next.js App Router pattern with a deliberate two-phase LLM orchestration flow. Chat creation involves an optional planning pass where a dedicated architect model decomposes the user prompt into a structured implementation plan, which is then passed as the user message to the main coding model. Conversation state is persisted in PostgreSQL as an ordered message chain, with a server-side token optimization layer that strips code blocks from all assistant messages except the two most recent before sending history to the LLM. Client components handle all Sandpack rendering, file tree management, streaming display, and version navigation, while server API routes own LLM orchestration, database writes, and file download generation. The sharing system uses Vercel OG for dynamic Open Graph image generation from chat state.

Tech Stack The application runs on Next.js 16.2.6 with React 19, deployed on Vercel with Neon Serverless PostgreSQL accessed via Prisma 6.5 using the Neon driver adapter. LLM inference is handled through the Together AI SDK, with an interchangeable model roster including Llama 3.3 70B, Qwen3 Coder 480B, GLM 5.1, MiniMax M2.7, and DeepSeek V3. Screenshot-to-code processing uses the multimodal Kimi K2.5 model. Generated app previews run inside Sandpack from CodeSandbox, and Monaco Editor with Shiki provides the in-browser code editing experience. Helicone handles LLM observability with per-session tracing, Plausible manages analytics, JSZip powers multi-file project exports, and Framer Motion adds UI transitions.

Code Quality No automated tests exist in the repository — there are no unit, integration, or end-to-end test files anywhere in the codebase. Error handling is present at API route boundaries with try/catch blocks but relies on generic responses rather than structured error types or centralized logging. TypeScript is enforced throughout with strict mode via tsc --noEmit, and Prettier with the Tailwind plugin handles formatting consistency. The main chat page client component accumulates substantial complexity by mixing streaming state, file version management, tab switching, and error recovery in a single component. No CI/CD configuration is included in the repository.

What Makes It Unique LlamaCoder’s most distinctive feature is the two-stage generation pipeline: rather than sending a raw prompt directly to the coding model, a separate architect model first produces a structured multi-file implementation plan that enforces separation of concerns before any code is written. The system embeds the complete Shadcn UI component documentation directly into the coding system prompt, guaranteeing accurate component API usage rather than hallucinated imports. A token-optimization middleware strips code blocks from older assistant messages before sending conversation history to the LLM, significantly reducing costs while preserving the semantic context of multi-turn sessions. An explicit architecture evolution roadmap documents the project’s path from single-file output toward autonomous multi-agent development, reflecting intentional architectural thinking rather than ad-hoc feature growth.

Self-Hosting

Llama Coder is licensed under the MIT License, one of the most permissive open-source licenses available. This means you can use it commercially, modify the source code, distribute it freely, and incorporate it into proprietary products without restriction, provided you include the original copyright notice. There are no copyleft implications for self-hosters — you are not required to open-source any modifications you make.

Running Llama Coder yourself requires external service dependencies that you are responsible for managing. You need an active Together AI account for LLM inference (costs are usage-based and not free at scale), a CodeSandbox API key for Sandpack sandbox functionality, and a Neon PostgreSQL database for persisting chat history and generated app records. The app itself is stateless and deploys cleanly on Vercel with zero configuration beyond environment variables, and Prisma handles schema migrations automatically at build time. Operational burden is low for a small number of users but scales with Together AI API costs as generation volume grows.

The hosted version at llamacoder.io runs on Together AI’s infrastructure, which means the public instance may be updated, rate-limited, or changed independently of the open-source repository. Self-hosting gives you full control over model selection, API key management, and data privacy, but you give up Together AI’s platform-level reliability guarantees, the curated model roster they maintain, and any future features that may only ship to the hosted service. There is no paid tier, SLA, or managed support offering for self-hosted deployments — community issues and pull requests are the primary support channel.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search