8000 GitHub - ivan-meer/fragments: Open-source Next.js template for building apps that are fully generated by AI. By E2B.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ivan-meer/fragments

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ E2B Agent Templates

ะ“ะพั‚ะพะฒั‹ะต ัˆะฐะฑะปะพะฝั‹ ะดะปั sandbox-ัั€ะตะด E2B ั ะ˜ะ˜-ะณะตะฝะตั€ะฐั†ะธะตะน ะบะพะดะฐ

Version License Status

โœจ Features

  • ๐Ÿค– Multi-LLM Support: Anthropic Claude, OpenAI GPT, Google Gemini, Mistral, Groq, and more
  • ๐Ÿ”’ Secure Execution: Isolated E2B sandbox environments for safe code execution
  • ๐ŸŽฏ Smart Templates: Pre-configured environments for different use cases
  • ๐Ÿ“ฑ Live Preview: Real-time preview of generated applications
  • ๐Ÿ”„ Hot Reload: Automatic updates during development
  • ๐ŸŽจ Modern UI: Clean interface with dark/light theme support

๐Ÿ› ๏ธ Tech Stack

  • Frontend: Next.js 15, React 18, TypeScript, Tailwind CSS
  • AI Integration: AI SDK with structured output validation
  • Backend: Next.js API routes, E2B Code Interpreter SDK
  • Sandbox: E2B cloud runtime environments
  • Authentication: Supabase (optional)
  • Styling: Tailwind CSS with Radix UI components

๐Ÿ“ฆ Available Templates

Production-Ready Templates โœ…

Template Use Case Port Technologies
AI Agent Python AI chatbots, LangChain agents, FastAPI APIs 8000 FastAPI, LangChain, Rich, Uvicorn
Next.js Developer React web apps, dashboards, full-stack apps 3000 Next.js 14, TypeScript, Tailwind CSS
Vue.js Developer Vue/Nuxt applications, SPAs, PWAs 3001 Vue 3, Nuxt 3, Composition API
Streamlit Developer Data dashboards, ML demos, analytics 8501 Streamlit, Pandas, Matplotlib
Gradio Developer ML interfaces, model demos, AI tools 7860 Gradio, Pandas, NumPy
Flask API REST APIs, microservices, web backends 5000 Flask, Gunicorn, Flask-CORS
Code Interpreter Data analysis, calculations, visualizations - Python, Jupyter, Scientific libraries

๐Ÿ”ฅ New Templates (2024-2025) ๐Ÿšง

Template Use Case Port Technologies Status
MLOps FastAPI ML model deployment, data pipelines, monitoring 8080 FastAPI, MLflow, DVC, Evidently ๐Ÿšง In Progress
React Native Expo Cross-platform mobile apps, rapid prototyping 19000 React Native, Expo, TypeScript ๐Ÿ“‹ Planned
Svelte/SvelteKit High-performance web apps, SSR 5173 Svelte, SvelteKit, Vite ๐Ÿ“‹ Planned
Solidity Hardhat Smart contracts, DApps, Web3 development 8545 Solidity, Hardhat, Ethers.js ๐Ÿ“‹ Planned
Kubernetes DevOps Container orchestration, microservices 8080 Kubernetes, Helm, Docker ๐Ÿ“‹ Planned
Flutter Developer Cross-platform mobile apps, native performance 3000 Flutter, Dart, Material UI ๐Ÿ“‹ Planned
Data Engineering ETL pipelines, data processing, analytics 8501 Apache Airflow, Spark, Pandas ๐Ÿ“‹ Planned
NestJS Enterprise Enterprise APIs, microservices architecture 3000 NestJS, TypeScript, GraphQL ๐Ÿ“‹ Planned

๐ŸŽฏ Specialized Templates ๐ŸŽฎ

Template Use Case Port Technologies Status
Discord Bot Bot development, automation, communities 3001 Discord.js, Node.js, TypeScript ๐Ÿ“‹ Planned
Chrome Extension Browser extensions, web automation 3000 Manifest V3, TypeScript, React ๐Ÿ“‹ Planned
Game Development Unity scripts, game mechanics, prototyping 7777 Unity, C#, Game Engine ๐Ÿ“‹ Planned
Go Microservice High-performance APIs, cloud-native 8080 Go, gRPC, Docker, Kubernetes ๐Ÿ“‹ Planned

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • E2B API key (get one here)
  • AI provider API keys (OpenAI, Anthropic, etc.)

Installation

# Clone the repository
git clone https://github.com/e2b-dev/fragments
cd fragments

# Install dependencies
npm install

# Set up environment variables
cp .env.template .env
# Edit .env with your API keys

# Start development server
npm run dev

Visit http://localhost:3000 to start creating code fragments!

Environment Setup

Create a .env file with the following variables:

# Required
E2B_API_KEY=your_e2b_api_key

# AI Provider Keys (at least one required)
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
GROQ_API_KEY=your_groq_key

# Optional: Authentication & Analytics
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_key
NEXT_PUBLIC_POSTHOG_KEY=your_posthog_key

๐Ÿ“– How It Works

  1. User Input: Describe what you want to build in natural language
  2. AI Generation: LLM generates structured code using our enhanced prompt system
  3. Template Selection: AI automatically chooses the best template for your use case
  4. Sandbox Creation: E2B creates an isolated environment with your code
  5. Live Preview: Access your running application via secure URL
  6. Iteration: Modify and improve your code with AI assistance

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Next.js App  โ”‚    โ”‚   AI SDK +       โ”‚    โ”‚  E2B Sandbox   โ”‚
โ”‚                 โ”‚โ”€โ”€โ”€โ”€โ”‚   Structured     โ”‚โ”€โ”€โ”€โ”€โ”‚                 โ”‚
โ”‚ - Chat UI       โ”‚    โ”‚   Output         โ”‚    โ”‚ - Code Exec     โ”‚
โ”‚ - File Preview  โ”‚    โ”‚ - Multi-LLM      โ”‚    โ”‚ - Live Preview  โ”‚
โ”‚ - Template      โ”‚    โ”‚ - Prompt Eng.    โ”‚    โ”‚ - Secure Env    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽฏ Template System

Template Structure

Each template consists of:

  • e2b.toml - E2B configuration (ports, resources, startup commands)
  • e2b.Dockerfile - Container definition with dependencies
  • Application files - Starter code and examples
  • Health checks - Automatic monitoring and validation

Creating Custom Templates

  1. Create template directory:

    mkdir sandbox-templates/my-template
  2. Add configuration files:

    # e2b.toml
    dockerfile = "e2b.Dockerfile"
    template_name = "my-template"
    template_id = "unique-template-id"
    start_cmd = "cd /home/user && python app.py"
    cpu_count = 2
    memory_mb = 2048
    team_id = "your-team-id"
  3. Create Dockerfile:

    FROM python:3.10-slim
    RUN pip install your-dependencies
    WORKDIR /home/user
    COPY . /home/user
    USER user
    HEALTHCHECK CMD curl -f http://localhost:8080/ || exit 1
  4. Update templates.json with template metadata

๐Ÿ”ง Development

Available Scripts

npm run dev          # Start development server with Turbo
npm run build        # Build for production
npm run start        # Start production server
npm run lint         # Run ESLint
pytest sandbox-templates/  # Run template tests

API Endpoints

Endpoint Method Description
/api/chat POST Generate code fragments with AI
/api/sandbox POST Create and manage E2B sandboxes
/api/templates GET List available templates

Key Files

  • app/page.tsx - Main chat interface
  • app/api/chat/route.ts - AI integration endpoint
  • app/api/sandbox/route.ts - E2B sandbox management
  • lib/prompt.ts - AI prompt engineering
  • lib/schema.ts - Structured output validation
  • lib/templates.ts - Template management

๐Ÿ›ก๏ธ Security Features

  • Sandboxed Execution: All code runs in isolated E2B environments
  • Non-root Containers: All templates use unprivileged users
  • Resource Limits: CPU and memory constraints prevent abuse
  • Health Monitoring: Automatic process and port monitoring
  • Rate Limiting: Built-in request limiting with Upstash
  • Input Validation: Zod schema validation for all inputs

๐ŸŽจ Customization

Supported AI Providers

  • Anthropic: Claude 3.5 Sonnet, Claude 3.5 Haiku
  • OpenAI: GPT-4, GPT-4 Turbo, GPT-3.5 Turbo
  • Google: Gemini Pro, Gemini Flash
  • Mistral: Mistral Large, Mistral Medium
  • Groq: Llama 3.1, Mixtral models
  • Local: Ollama support for local models

Theme Support

  • Light and dark mode toggle
  • Customizable via Tailwind CSS
  • Responsive design for all screen sizes

๐Ÿ“Š Monitoring & Debugging

The application includes comprehensive logging and monitoring:

  • Health Checks: Automatic application monitoring with retries
  • Process Monitoring: Real-time process and port status
  • Error Handling: Detailed error messages and recovery
  • Performance Tracking: Request timing and success rates

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Add tests for new templates
  • Update documentation for changes
  • Ensure all health checks pass
  • Follow security guidelines

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • E2B - Secure cloud runtime for AI applications
  • Anthropic - Original Artifacts inspiration
  • Vercel - AI SDK and deployment platform
  • Next.js - React framework

Version License Status

About

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

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 56.3%
  • Svelte 25.4%
  • Python 10.9%
  • JavaScript 3.1%
  • Dockerfile 2.2%
  • CSS 1.4%
  • Other 0.7%
0