r/javascript • u/Spxgdev • 15d ago
GitHub - Spxg/limo: Run JavaScript with browser Web APIs
https://github.com/Spxg/limoExamples: https://spxg.github.io/limo
It's a CLI tool that, unlike Node.js and Deno, aims to provide a complete Web API environment, including DOM, Canvas, Web Workers, IndexedDB, OPFS, and more.
It's built on top of moli, a headless browser powered by V8 with Web API support. The name "limo" is also inspired by "moli."
I maintain several WebAssembly projects that primarily run in browsers, so I frequently need to work with JavaScript and Web APIs.
I usually write code in an environment without a GUI. Whenever I need to test something, I have to start a local HTTP server and open it in a browser on another machine with a GUI, or use ChromeDriver or another browser driver for automated testing. Sometimes I also run into compatibility issues between ChromeDriver and Chrome versions.
Over time, I found this whole process increasingly cumbersome.
What I really wanted was a simple way to execute JavaScript directly from the command line while still having access to browser Web APIs, without needing to launch and manage a separate browser. That's why I built limo.
1
u/ortegaj50 11d ago
The CLI workflow is compelling; how do APIs needing a rendered surface or browser permissions work in a headless runtime?
1
u/Spxgdev 10d ago
In Limo, scripts can build and modify the DOM, apply CSS, and read computed styles. Geometry APIs such as `getBoundingClientRect()` currently return simulated positions and sizes. Canvas 2D renders real pixels offscreen, so scripts can read them back or export PNGs. Moli’s own CLI provides full-page layout and screenshots on demand.
Limo runs scripts on a secure loopback origin, so APIs like OPFS work. Permission requests follow the runtime’s headless defaults, and camera and microphone devices are reported as unavailable.
1
u/p-reyes-6823 9d ago
A real/simulated/unavailable API matrix would make it easier to judge which browser tests Limo can replace.
1
u/nielsen-b628 5d ago
Are simulated geometry values deterministic? That matters for repeatable tests that exercise layout-dependent code.
•
u/jjohnson-13233 22h ago
Are simulated geometry values deterministic for a given DOM and CSS input, or can they vary? That determines whether layout-dependent tests are repeatable in Limo.
1
u/hustlingfounder 14d ago
Really liked the concept. Will give it a try.