Template Examples
E2B templates allow you to create custom sandbox environments with pre-installed dependencies, configurations, and startup commands.
Available Templates
Web Development
| Template | Description | Use Case |
|---|---|---|
| Next.js App | Next.js with Tailwind & shadcn UI | Modern web applications |
| Next.js (Bun) | Next.js with Bun runtime | Fast JavaScript runtime |
Development Tools
| Template | Description | Use Case |
|---|---|---|
| Claude Code | Claude Code Agent in sandbox | AI-assisted development |
| Desktop VNC | Ubuntu Desktop with VNC | GUI applications |
Template Management
- Error Handling - Handle template operation errors
- Logging - Retrieve and monitor build logs
- Migration Guide - Upgrade to V2 template format
Quick Start
typescript
import { Template } from 'e2b'
// Use a pre-built template
const template = Template.fromAlias('nextjs-app')
// Or build your own
const customTemplate = Template()
.fromNodeImage('21-slim')
.setWorkdir('/home/user/app')
.runCmd('npm install')
.setStartCmd('npm run dev')Template Features
- Pre-installed Dependencies - Package managers, languages, tools
- Custom Commands - Startup scripts and initialization
- Environment Variables - Configuration and secrets
- Filesystem State - Persistent files and directories
Next Steps
- Explore example templates
- Learn about error handling
- Review migration guide for V2 updates