Skip to content

Node.js for inside the browser. An open-source, lightweight WebContainer alternative.

License

Notifications You must be signed in to change notification settings

ScelarOrg/DevBox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

📦 DevBox

Node.js for inside the browser. WebContainers but free, open-source, and lightweight.

License: MIT TypeScript Status Maintained By

DevBox is a browser-based runtime that executes Node.js environments entirely within a web page. Unlike other solutions that rely on cloud proxies or heavy Linux kernel emulation, DevBox is a lightweight shim that maps Node.js syscalls to browser APIs.

It allows you to run full-stack frameworks like Next.js, Vite, and Svelte natively in the browser with zero hardcoded behavior.


🚧 Status: Testing Phase

Current State: DevBox is currently in active Beta/Testing. ETA: Soon.

Star this repository to be notified immediately upon release.


💡 Why DevBox?

DevBox has been in stealth development for over a year.

It was born out of strict necessity. My main product is an AI Platform Generator (Scelar), and during development, it became clear that spinning up cloud-hosted Next.js servers for every single user instance would turn our profits into losses due to infrastructure costs.

We needed a way to move that compute entirely to the client without sacrificing the ability to run standard Node.js tooling. DevBox was the solution: a runtime that allows full-stack applications to run purely in the browser, eliminating server costs.

🆚 DevBox vs. Others (e.g., AlmostNode)

Recently, other browser-based implementations (like AlmostNode) have surfaced. While the goal is similar, the architecture is different.

Many alternatives rely on mocking and hardcoding specific internal paths just to make popular frameworks like Vite or Next.js work. While this gets a "Hello World" running, it often creates a fragile environment where less common packages fail because the runtime isn't actually behaving like Node.js—it's just pretending to for specific scenarios.

DevBox is different. We prioritize a complete Node.js environment emulation. We don't patch Next.js to make it work; we fix the runtime so Next.js just works naturally.


✨ Features

  • 🚫 Not a Linux Clone: We don't emulate a full OS kernel. We emulate the Node.js runtime. This results in a significantly smaller bundle size (~small KB) and faster boot times.
  • 🌐 Native Browser Execution: Everything runs client-side using Service Workers and standard JavaScript. No server-side compute required.
  • 💻 Full Terminal Access: Includes a fully functional terminal environment hooked directly into the virtual file system.
  • ⚡ Framework Agnostic: No hardcoded logic for specific frameworks.
    • ✅ Next.js
    • ✅ Vite
    • ✅ SvelteKit
    • ✅ React / Vue
  • 🔒 Secure & Sandboxed: Runs safely within the browser's security model.
  • 🦕 100% TypeScript: Written in modern TypeScript for type safety and easy contribution.
  • 🆓 MIT Licensed: Truly open source. Build your own cloud IDEs, playgrounds, or tutorials without proprietary lock-in.

🚀 How it Works

DevBox creates a virtualized file system and mocks the Node.js built-in modules (fs, http, path, net, etc.) inside a Service Worker.

When you run npm install or npm run dev inside DevBox:

  1. Network: Requests are intercepted and routed through the virtual file system.
  2. Execution: JavaScript is executed directly by the browser's engine.
  3. IO: Terminal output and file changes are streamed instantly to the UI.

🛠 Usage (Preview)

API subject to change before v1.0 release.

import { DevBox } from '@devbox/core';

// 1. Initialize the Virtual Machine
const vm = await DevBox.boot();

// 2. Mount files to the virtual file system
await vm.fs.writeFile('package.json', JSON.stringify({
  scripts: { dev: "vite" },
  dependencies: { vite: "latest" }
}));

await vm.fs.writeFile('index.html', '<h1>Hello from DevBox!</h1>');

// 3. Spawn a terminal process
const process = await vm.spawn('npm', ['install']);

process.stdout.on('data', (data) => {
  console.log(data); // Pipe this to xterm.js
});

// 4. Start the dev server
process.on('exit', async () => {
    await vm.spawn('npm', ['run', 'dev']);
});

🔮 Roadmap to V1

  • Virtual File System implementation
  • Node.js API shims (fs, path, events)
  • HTTP Server emulation via Service Worker
  • Stabilize child_process spawning
  • Optimize dependency resolution caching
  • Public Release (Soon)

🤝 Contributing

We are currently finalizing the core architecture. The repository is locked for commits until the public beta release.

If you are interested in shaping the future of browser-based development, please Watch this repo to jump in as soon as we open up!

👤 Author

Rick huijser

  • Creator & Lead Maintainer

📄 License

DevBox is open-source software licensed under the MIT License.

About

Node.js for inside the browser. An open-source, lightweight WebContainer alternative.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors