A full-featured, browser-based IDE powered by WebContainer. Run Node.js, install packages, and build applications entirely in your browserβno backend required.
WebContainer IDE is a production-ready, browser-based development environment that brings the full power of Node.js to your browser. Built on StackBlitz's WebContainer technology, it enables developers to code, build, and preview applications without any server infrastructure.
- β Full Node.js Runtime - Execute Node.js code natively in the browser
- β Package Management - Install npm/pnpm packages with intelligent caching
- β Live Development - Hot module replacement with instant preview updates
- β Professional Editor - Monaco Editor with IntelliSense and multi-language support
- β Interactive Terminal - Full-featured xterm.js terminal with 10,000 line buffer
- β Dynamic File System - Real-time file operations with automatic synchronization
- β Resizable Workspace - Fully customizable panel layout with drag-to-resize
- β Zero Configuration - Works out of the box with sensible defaults
- Node.js 18+ or pnpm 8+
- Modern Browser with SharedArrayBuffer support:
- Chrome/Edge 84+
- Safari 15.2+
- Firefox 89+ (with specific flags)
# Clone the repository
git clone https://github.com/Sunny-117/webcontainer-ide.git
cd webcontainer-ide
# Install dependencies
pnpm install
# Start development server
pnpm devVisit http://localhost:5173 to access the IDE.
# Build for production
pnpm build
# Preview production build
pnpm previewβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Browser Window β
βββββββββββββββββ¬βββββββββββββββββββββββββββ¬βββββββββββββββββββββββ€
β File Tree β Code Editor β Live Preview β
β β β β
β π src/ β ββββββββββββββββββββββ β βββββββββββββββββββ β
β π public/ β β Monaco Editor β β β iframe β β
β π package β β - IntelliSense β β β (Vite HMR) β β
β π node_mod β β - Syntax HL β β β localhost:* β β
β β β - Auto-save β β βββββββββββββββββββ β
β β ββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββ€ β
β β Terminal (xterm.js) β β
β β β ~ pnpm install β β
β β β ~ pnpm run dev β β
βββββββββββββββββ΄βββββββββββββββββββββββββββ΄βββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββ
β WebContainer API β
β - Virtual File System β
β - Node.js Runtime β
β - Process Management β
ββββββββββββββββββββββββββββ
| Category | Technology | Version | Purpose |
|---|---|---|---|
| Framework | React | 18.2 | UI framework |
| Language | TypeScript | 5.2 | Type safety |
| Build Tool | Vite | 5.0 | Fast dev server & bundler |
| Runtime | WebContainer API | 1.1.9 | Browser-based Node.js |
| Library | Purpose |
|---|---|
| @monaco-editor/react | Code editor (VS Code engine) |
| xterm + addons | Terminal emulator |
| react-resizable-panels | Draggable panel layout |
| @radix-ui | Accessible UI primitives (context menu, dialog) |
| lucide-react | Icon library |
| TailwindCSS | Utility-first styling |
| Library | Purpose |
|---|---|
| zustand | Lightweight state management |
| WebContainer FS | Virtual file system |
Create File/Folder:
- Right-click in file tree β "New File" or "New Folder"
- Or use toolbar buttons at the top of file tree
Delete:
- Right-click on file/folder β "Delete"
- Confirmation dialog will appear
Edit:
- Click any file to open in Monaco Editor
- Changes auto-save to WebContainer
The terminal supports all standard shell commands:
# List files
ls
# View file contents
cat package.json
# Install packages
pnpm install
pnpm add lodash
# Run scripts
pnpm run dev
pnpm run build
# File operations
mkdir components
touch components/Button.tsx- Run
pnpm run devin terminal - Wait for "Dev server ready!" message
- Preview automatically loads in right panel
- Edit files β Changes reflect instantly via HMR
| Shortcut | Action |
|---|---|
Ctrl/Cmd + S |
Save file (auto-save enabled) |
Ctrl/Cmd + / |
Toggle comment |
Ctrl/Cmd + F |
Find in file |
Ctrl + C |
Cancel running command |
Edit src/webcontainer/template.ts:
export const defaultTemplate: FileSystemTree = {
'package.json': {
file: {
contents: JSON.stringify({
name: 'my-custom-project',
dependencies: {
'react': '^18.2.0',
// Add your dependencies
}
}, null, 2)
}
},
'src': {
directory: {
'main.tsx': {
file: { contents: '// Your code here' }
}
}
}
};Modify src/ui/Terminal.tsx:
const xterm = new XTerm({
fontSize: 14, // Font size
scrollback: 10000, // History buffer
cursorBlink: true, // Blinking cursor
theme: {
background: '#0a0a0a',
foreground: '#d4d4d4',
// Customize colors
}
});Adjust polling frequency in src/webcontainer/fileWatcher.ts:
watchFileSystem((tree) => {
setFileTree(tree);
}, 2000); // Change interval (ms)- Import repository to Vercel
- Build settings:
- Build Command:
pnpm build - Output Directory:
dist
- Build Command:
- Add environment headers in
vercel.json:
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Cross-Origin-Embedder-Policy",
"value": "require-corp"
},
{
"key": "Cross-Origin-Opener-Policy",
"value": "same-origin"
}
]
}
]
}- Connect repository
- Build settings:
- Build Command:
pnpm build - Publish Directory:
dist
- Build Command:
- Create
_headersfile inpublic/:
/*
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
location / {
add_header Cross-Origin-Embedder-Policy "require-corp";
add_header Cross-Origin-Opener-Policy "same-origin";
try_files $uri $uri/ /index.html;
}- Dependency Caching - Detects existing
node_modules, skips reinstall - pnpm - 2-3x faster than npm for package operations
- File System Polling - 2-second interval balances responsiveness and performance
- Lazy Component Loading - Components load on-demand
- Virtual Scrolling - Efficient rendering of large file trees
- Debounced Auto-save - Reduces unnecessary writes
| Operation | Time |
|---|---|
| Initial boot | ~2s |
| pnpm install (cached) | <1s |
| pnpm install (fresh) | 10-30s |
| File save | <100ms |
| HMR update | <500ms |
WebContainer requires specific browser features:
- SharedArrayBuffer - For multi-threading support
- Cross-Origin Isolation - COOP/COEP headers must be set
- Modern JavaScript - ES2020+ support
- Memory Constraints - Limited by browser memory (typically 2-4GB)
- No Native Modules - Cannot use Node.js native addons (C++ modules)
- Network Restrictions - CORS applies to external API requests
- File System Isolation - Cannot access local file system
- Performance - Slower than native Node.js for CPU-intensive tasks
- β Sandboxed execution environment
- β No access to local file system
- β Isolated from host system
- β CORS-protected network requests
- Collaboration - Multi-user editing with Yjs
- Git Integration - Commit, push, pull via isomorphic-git
- Extension System - Plugin architecture for custom tools
- Theme Customization - Light/dark themes + custom colors
- Keyboard Shortcuts - Configurable keybindings
- Debugging - Breakpoints and step-through debugging
- Multiple Terminals - Tab-based terminal management
- File Upload/Download - Import/export project files
- Search & Replace - Global find/replace across files
- Project Templates - Gallery of starter templates
- AI-powered code completion
- Integrated testing framework
- Performance profiling tools
- Mobile-responsive layout
- Offline mode with service workers
We welcome contributions! Here's how to get started:
# Fork and clone the repository
git clone https://github.com/Sunny-117/webcontainer-ide.git
cd webcontainer-ide
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Run type checking
pnpm tsc --noEmit- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use TypeScript for all new code
- Follow existing code style (Prettier/ESLint)
- Add comments for complex logic
- Update README if adding features
This project is licensed under the MIT License - see the LICENSE file for details.
This project is built on the shoulders of giants:
- WebContainer by StackBlitz - Browser-based Node.js runtime
- Monaco Editor by Microsoft - VS Code's editor engine
- xterm.js by SourceLair - Terminal emulator for the web
- Radix UI - Unstyled, accessible UI components
- Vite by Evan You - Next-generation frontend tooling
- React by Meta - UI library
- π Documentation - GitHub Wiki
- π Bug Reports - Issue Tracker
- π¬ Discussions - GitHub Discussions
- π Star the project if you find it useful!
Built with β€οΈ using WebContainer technology