Bare
lastmod 2025-04-08created 2025-04-081 edits
Small and modular JavaScript runtime for desktop and mobile
A fast, lightweight, modular JavaScript runtime
About
- A minimal JavaScript runtime that supports both mobile and desktop and can run on a wide range of hardware
- Focuses on modularity, versatility, and lightness with an asynchronous event-driven architecture
- Optimized for P2P application development and cross-platform apps
Key features
- Fully modular structure
- No standard library → a modular approach where you pull in only the features you need
- e.g. bare-fs, bare-http1, bare-crypto, bare-zlib, bare-stream, etc.
- A lightweight runtime environment can be set up by installing and using only the features you need
- Both require() and import can be used
- The two module systems interact freely even in mixed environments
- A JavaScript runtime can be embedded in mobile apps using Bare Kit
- Easy integration into Android and iOS via react-native-bare-kit
- IPC communication support; Bare worklets can run in React Native apps
- Native add-ons can be written based on libjs and libuv
- Supports various JavaScript engines (V8, JavaScriptCore, QuickJS)
- Most N-API symbols are available
Bare's philosophy: simplicity is power
- With its small, modular runtime structure, Bare runs on both desktop and mobile without performance degradation
- Provides an asynchronous event-driven architecture like Node.js, but is designed around embedding and cross-device compatibility
What you can build with Bare
- P2P applications
- Real-time data streaming, file sharing, communication apps, etc. can be built quickly on the Holepunch stack
- Serverless communication and sharing apps like Keet and Pear can be built
- Supports high-performance real-time communication even without WebRTC
- Its lightweight structure and modularity provide both scalability and efficiency
- Achieves blockchain-level decentralization with a serverless structure
- Suitable for various distributed apps such as DeFi, data sharing, and private networks
- Suitable for media libraries, real-time games, video streaming, etc.
- Supports fast and reliable sync and streaming
- Modules written once can be reused on both mobile and desktop
- e.g. push notifications, video re-encoding, encryption tasks, etc. run smoothly even in low-spec environments
Performance and scalability
- Supports various JS engines such as V8, JavaScriptCore, and QuickJS
- Maintains compatibility with existing runtimes through LibJS integration
- Uses fastcall to achieve native-level performance
- Technical lead Kasper Isager: "Bare is designed to run anywhere — from computers to phones to embedded devices"
== Pear + Bare = a complete P2P development stack ==
- Pear is a platform that integrates a P2P runtime with development and deployment tools
- Bare-based apps run on Holepunch's Pear Runtime, providing a complete P2P environment that can operate without servers
- No server costs, full data privacy guaranteed
- Pear updates automatically and includes the Bare runtime
- This combination offers an entirely new lightweight container model
Conclusion
- Bare is an innovative runtime that realizes JavaScript's true versatility and efficiency
- Within the Holepunch team itself, mobile + desktop apps are being shipped simultaneously from code written once
- Implements "Write Once, Run Anywhere" in the truest sense
- Now complete serverless P2P apps can run on any device from a single codebase