Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

fragments

> 前端框架
Open source

Open-source Next.js template for building apps that are fully generated by AI. By E2B.

6.4K stars0 likes3 views
WebsiteGitHub

About

Open-source Next.js template for building apps that are fully generated by AI. By E2B.

Fragments by E2B

This is an open-source version of apps like Anthropic's Claude Artifacts, Vercel v0, or GPT Engineer.

Powered by the E2B SDK.

→ Try on fragments.e2b.dev

Features

  • Based on Next.js 14 (App Router, Server Actions), shadcn/ui, TailwindCSS, Vercel AI SDK.
  • Uses the E2B SDK by E2B to securely execute code generated by AI.
  • Streaming in the UI.
  • Can install and use any package from npm, pip.
  • Supported stacks (add your own):
    • Python interpreter
    • Next.js
    • Vue.js
    • Streamlit
    • Gradio
  • Supported LLM Providers (add your own):
    • OpenAI
    • Anthropic
    • Google AI
    • Mistral
    • Groq
    • Fireworks
    • Together AI
    • Ollama
  • Integrates with Morph Apply model for token efficient, accurate and faster code editing.

Make sure to give us a star!

Get started

Prerequisites

  • git
  • Recent version of Node.js and npm package manager
  • E2B API Key
  • LLM Provider API Key

1. Clone the repository

In your terminal:

bash
git clone https://github.com/e2b-dev/fragments.git

2. Install the dependencies

Enter the repository:

bash
cd fragments

Run the following to install the required dependencies:

bash
npm i

3. Set the environment variables

Create a .env.local file and set the following:

…

4. Start the development server

bash
npm run dev

5. Build the web app

bash
npm run build

Customize

Adding custom personas

  1. Make sure E2B CLI is installed and you're logged in.

  2. Add a new folder under sandbox-templates/

  3. Initialize a new template using E2B CLI:

    e2b template init

    This will create a new file called e2b.Dockerfile.

  4. Adjust the e2b.Dockerfile

    Here's an example streamlit template:

    dockerfile
    # You can use most Debian-based base images
    FROM python:3.19-slim
    
    RUN pip3 install --no-cache-dir streamlit pandas numpy matplotlib requests seaborn plotly
    
    # Copy the code to the container
    WORKDIR /home/user
    COPY . /home/user
  5. Specify a custom start command in e2b.toml:

    toml
    start_cmd = "cd /home/user && streamlit run app.py"
  6. Deploy the template with the E2B CLI

    e2b template build --name <template-name>

    After the build has finished, you should get the following message:

    ✅ Building sandbox template <template-id> <template-name> finished.
  7. Open lib/templates.json in your code editor.

    Add your new template to the list. Here's an example for Streamlit:

    json
    "streamlit-developer": {
      "name": "Streamlit developer",
      "lib": [
        "streamlit",
        "pandas",
        "numpy",
        "matplotlib",
        "requests",
        "seaborn",
        "plotly"
      ],
      "file": "app.py",
      "instructions": "A streamlit app that reloads automatically.",
      "port": 8501 // can be null
    },

    Provide a template id (as key), name, list of dependencies, entrypoint and a port (optional). You can also add additional instructions that will be given to the LLM.

  8. Optionally, add a new logo under public/thirdparty/templates

Adding custom LLM models

  1. Open lib/models.json in your code editor.

  2. Add a new entry to the models list:

    json
    {
      "id": "mistral-large",
      "name": "Mistral Large",
      "provider": "Ollama",
      "providerId": "ollama"
    }

    Where id is the model id, name is the model name (visible in the UI), provider is the provider name and providerId is the provider tag (see adding providers below).

Adding custom LLM providers

  1. Open lib/models.ts in your code editor.

  2. Add a new entry to the providerConfigs list:

    Example for fireworks:

    typescript
    fireworks: () => createOpenAI({ apiKey: apiKey || process.env.FIREWORKS_API_KEY, baseURL: baseURL || 'https://api.fireworks.ai/inference/v1' })(modelNameString),
  3. Optionally, adjust the default structured output mode in the getDefaultMode function:

    typescript
    if (providerId === 'fireworks') {
      return 'json'
    }
  4. Optionally, add a new logo under public/thirdparty/logos

Contributing

As an open-source project, we welcome contributions from the community. If you are experiencing any bugs or want to add some improvements, please feel free to open an issue or pull request.

Issues· 21 open

View all issuesOpen on GitHub
  • #210

    Dependency Dashboard

    Updated Sep 24, 2026
  • #229

    Sandbox route: forEach(async) fire-and-forget can run code before multi-file writes finish

    Updated Jul 6, 2026
  • #64

    [Feature Request] Composer Support

    FragmentsFeatureUpdated Apr 13, 2026
  • #53

    Select element as context

    FragmentsFeatureUpdated Apr 8, 2026
  • #39

    Make code editable

    FragmentsFeatureUpdated Apr 8, 2026
  • #11

    File Upload

    FragmentsFeatureUpdated Apr 8, 2026
  • #33

    Bedrock support

    FragmentsFeatureUpdated Apr 8, 2026
  • #3

    Can you add OpenRouter

    FragmentsFeatureUpdated Apr 8, 2026
  • #207

    Templates are private, readme uses the old build system for custom templates

    Updated Jan 11, 2026
  • #176

    the result can't be seen

    Updated Sep 8, 2025

> Tags

TypeScriptaiai-code-generationanthropicclaude

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 24, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架