DEV Community

Cover image for ⚡ Introducing VoltJS: A Lightweight JavaScript Runtime Powered by Go and Goja
Prasoon
Prasoon

Posted on

⚡ Introducing VoltJS: A Lightweight JavaScript Runtime Powered by Go and Goja

⚡ Introducing VoltJS: A Lightweight JavaScript Runtime Powered by Go and Goja

logo

Author: Prasoon Jadon
Project: VoltJS on GitHub


Ever wanted the power of Node.js but with the performance and simplicity of Go?

Meet VoltJS – a blazing-fast JavaScript runtime inspired by Node.js, built using Goja and written in pure Go. It's designed for server-side scripting and lightweight JavaScript execution without the Node.js overhead.


🚀 Why VoltJS?

Node.js is amazing, but what if you could run JS with just a Go binary and no dependencies?

VoltJS brings:

  • A familiar CommonJS-like require() system
  • Built-in support for console, setTimeout, fs, and even http.createServer
  • A CLI-based runtime you can install and use just like Node.js

Whether you're scripting, automating tasks, or building tiny HTTP servers, VoltJS gives you JavaScript with Go's raw speed.


🧠 Features at a Glance

  • 🧩 JavaScript runtime with require()
  • ⏱ Built-in setTimeout, setInterval, etc.
  • 📂 File system access: readFileSync, writeFileSync
  • 🌐 HTTP server with http.createServer
  • ⚙️ process.argv, process.cwd() support
  • 🛡 Module isolation per file with goja.Runtime
  • 🔧 Easy to build and hack with Go

🔬 Example: Hello VoltJS

console.log("⚡ Running from VoltJS!");

setTimeout(() => {
    console.log("✅ Done after 1 second!");
}, 1000);

const data = fs.readFileSync("hello.txt");
console.log("📄 File content:", data);

http.createServer((req, res) => {
    console.log("📥 Incoming request:", req.url);
    res.end("Hello from VoltJS server!");
});
Enter fullscreen mode Exit fullscreen mode

Run it:

voltjs script.js
Enter fullscreen mode Exit fullscreen mode

Yes, it's that simple.


🛠 Installation

🔁 One-liner Installer

curl -s https://raw.githubusercontent.com/Pjdeveloper896/VoltJs/main/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

This script:

  • Detects your OS and architecture
  • Downloads the correct binary from the latest GitHub release
  • Installs it to your system (e.g., ~/.local/bin)

💻 Or Build from Source

git clone https://github.com/Pjdeveloper896/VoltJs.git
cd VoltJs
go build -o voltjs main.go
./voltjs example/script.js
Enter fullscreen mode Exit fullscreen mode

🧱 File Structure

VoltJs/
├── main.go            # VoltJS runtime core
├── install.sh         # Auto-install script
├── example/
│   └── script.js      # Sample JS file
├── modules/           # JS modules support
└── README.md
Enter fullscreen mode Exit fullscreen mode

🌱 What's Next?

Here's what's coming in future releases:

  • [ ] Native fetch() support using Go’s net/http
  • [ ] ES module (ESM) support
  • [ ] Promises and async APIs
  • [ ] Native __dirname and __filename
  • [ ] More modules: os, path, crypto, etc.

👨‍💻 About the Creator

Hi! I’m Prasoon Jadon, a developer passionate about making JavaScript more accessible and powerful — even outside of the browser.

🔗 GitHub: @Pjdeveloper896


💬 Final Thoughts

VoltJS is great for:

  • Scripting without Node.js
  • Embedding JavaScript into Go apps
  • Exploring Goja for learning or lightweight VMs
  • Developers looking for a minimalist JS runtime

Go ahead and give it a spin. Contributions, suggestions, and stars are always welcome on GitHub.


✍️ If you liked this post, follow me on GitHub or drop a comment below. Let’s build fast, light, and hackable runtimes together!


Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.