Fragments by E2B: An Open-Source Template for AI-Generated Web Apps
Open-source Next.js template for building apps that are fully generated by AI. By E2B.
At a glance
- What is it?
- Fragments is a Next.js template from E2B that turns natural language into running web apps, executing AI-written code in secure sandboxes. It is a practical starting point for developers building artifact-style tools, but it requires managing multiple external services.
- Who is it for?
- Adopt Fragments if you want to build an artifact-style tool like Claude Artifacts or v0 and you are comfortable with the E2B sandbox plus at least one LLM provider. Skip it if you need a fully hosted solution or if your code generation must stay entirely on your own infrastructure.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 6 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What Fragments Actually Gives You
Fragments is an open-source Next.js template that reproduces the core interaction of Claude Artifacts, Vercel v0, and GPT Engineer. The user types a request, an LLM generates code, and that code runs in a sandboxed environment. The result is streamed back into the UI. The target audience is developers who want to build their own version of that experience without starting from zero. E2B, the company behind the project, also provides the sandboxing SDK, so the template is a showcase for their infrastructure as much as a standalone tool. The README positions it as a base for apps that are fully generated by AI, not as a finished product.
The Architecture: Next.js Front End, E2B Sandbox, LLM Back End
The stack is explicit in the README: Next.js 14 with the App Router and Server Actions, shadcn/ui for components, TailwindCSS for styling, and the Vercel AI SDK for streaming. Code generated by the LLM is not executed on the host. Instead, the E2B SDK spins up a sandbox, which is a container built from a template. The sandbox can install npm and pip packages on the fly, which is how the generated app can pull in dependencies like pandas or streamlit. The UI streams output back to the user, and the supported personas include Python, Next.js, Vue, Streamlit, and Gradio. The separation is clear: the Next.js app orchestrates, the LLM writes code, and the E2B sandbox is the execution environment.
Getting It Running: Commands and Required Keys
Setup is a standard clone and install. Run git clone https://github.com/e2b-dev/fragments.git, then cd fragments, then npm i. You need a .env.local file with at least an E2B_API_KEY and one LLM provider key, for example OPENAI_API_KEY. The README lists optional keys for Anthropic, Groq, Fireworks, Together AI, Google AI, Mistral, and others. You can also set a MORPH_API_KEY for token-efficient code editing, and optional config for rate limiting, short URLs, Supabase auth, and PostHog analytics. Start the dev server with npm run dev, or build with npm run build. The environment variable list includes toggles to hide API key input or local models, which suggests the template expects a certain amount of configuration before it feels like a polished app.
Adding Your Own Personas and Models
Customization is a central feature, and the README gives a concrete path for both personas and models. To add a persona, you create a folder under sandbox-templates/, run e2b template init to generate an e2b.Dockerfile, then edit that file to install dependencies. A sample Dockerfile for Streamlit installs streamlit, pandas, numpy, matplotlib, requests, seaborn, and plotly. You then set a start command in e2b.toml, build the template with e2b template build --name <template-name>, and add an entry to lib/templates.json. That entry includes the template id, name, dependency list, entrypoint file, and an optional port. For models, you edit lib/models.json or lib/models.ts to add an entry with an id, name, provider, and providerId. Adding a provider means editing the providerConfigs list in lib/models.ts, where you map a provider tag to a function that returns a client. The README shows a fireworks example that uses createOpenAI with a custom baseURL.
Limitations and Failure Modes
The biggest limitation is that Fragments is not a turnkey service. You must sign up for E2B and at least one LLM provider, and you must keep those API keys operational. The sandbox templates are Docker-based, so any persona you add requires you to write a Dockerfile and build it with the E2B CLI. That is a real skill barrier. The README also mentions rate limiting and short URLs via Upstash KV, and auth via Supabase, but these are optional. If you do not set them up, the app may lack production safeguards. A failure mode is that the LLM can generate code that is syntactically valid but logically wrong, and the sandbox will happily run it. The template does not promise any validation beyond execution. Also, because the last push date is listed as 2026-09-09, which is ahead of a normal review timeline, you should check the repository state yourself to see if the code still matches the README.
Alternatives and How They Differ
The README names Anthropic's Claude Artifacts, Vercel v0, and GPT Engineer as inspirations. Those are closed-source products, so they are not direct alternatives for someone who wants to own the code. A closer open-source alternative would be something like a generic code-interpreter template, but the README does not name one. The key difference with Fragments is that it uses E2B's sandboxing infrastructure rather than running code on your own server or in a browser sandbox. Tools like v0 run the generated UI in an iframe or a preview environment managed by the vendor. Fragments puts the sandbox behind an API, which gives you control over the execution environment but adds a dependency on E2B. If you want to avoid that dependency, you would need to replace the E2B SDK with your own sandboxing solution, which is significant work.
Maintenance, Licensing, and Upgrade Cost
The project is licensed under Apache-2.0, which permits commercial use and modification with attribution, but it is not legal advice. The maintenance cost is moderate. You are responsible for updating the Next.js version, the E2B SDK, and the model provider SDKs as they change. The README shows a release section with no recent releases retrieved, so you cannot rely on a stable release cadence. The template is tied to a specific architecture: Next.js 14, Server Actions, and the Vercel AI SDK. If those frameworks move on, you will need to port the code. The customization system is file-based, so changes to lib/templates.json or lib/models.ts are straightforward, but they require rebuilding sandbox templates with the E2B CLI, which can be a bottleneck. The README invites contributions, but there is no mention of a changelog or migration guide, so you should plan to track upstream changes manually.
Who Should Adopt It and What to Verify
Fragments is a reasonable starting point for a small team that wants to prototype an AI app builder and is willing to use E2B's sandbox. It is not for someone who wants a production-ready, hosted solution, because you must assemble your own LLM keys, rate limiting, and auth. Before you adopt it, verify that the E2B sandbox templates build cleanly with your Docker setup, and that the LLM providers you plan to use are still supported by the lib/models.ts code. The README claims support for OpenAI, Anthropic, Google, Mistral, Groq, Fireworks, Together AI, and Ollama, but you should test each provider with a simple prompt. Also check the rate limit environment variables, because the default may not be suitable for public deployment. The template is a starting point, not a finished app, so budget time for integration and hardening.
Editorial conclusion
Adopt Fragments if you want to build an artifact-style tool like Claude Artifacts or v0 and you are comfortable with the E2B sandbox plus at least one LLM provider. Skip it if you need a fully hosted solution or if your code generation must stay entirely on your own infrastructure. Before committing, verify the current state of the repository, since the last push date is in the future relative to typical review cycles and no releases are listed. Check that the E2B SDK and the listed providers still match your stack, and confirm the rate limiting and auth options (Upstash KV, Supabase) are ones you can operate. Fragments is a template, not a product; its value depends on your willingness to maintain the glue.
Community notes