monoucha

Seamless Nim-QuickJS integration

Wrapper score 15/100 · tests present · no docs generated

Wraps a native library — check OS Compatibility below for platform-specific linking notes.

Summary

Latest Version 0.11.0
License Unlicense
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:26

Authors

  • bptato

Installation

nimble install monoucha
choosenim install monoucha
git clone https://git.sr.ht/~bptato/monoucha

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
monoucha - - - - - - -

Dependencies

Package Version Optional
nim >= 1.6.14 No
results >= 0.4.0 No

Source

Repository https://git.sr.ht/~bptato/monoucha
Homepage https://git.sr.ht/~bptato/monoucha
Registry Source nimble_official

README

Monoucha: seamless Nim-QuickJS integration

Monoucha is a wrapper library to simplify the process of embedding the QuickJS JavaScript engine into Nim programs.

Quick start

Include Monoucha in your project using either Nimble or as a git submodule.

requires "monoucha"

Then,

  • There is a manual. Please read the manual.
  • Examples from the manual, organized as unit tests.

Warning

Monoucha works with ORC, but it also depends on =destroy hooks with ref objects, which may leak memory in ORC (the interaction between the two features is "undefined".)

Therefore, for best results you should put the following in your nim.cfg:

--mm:refc

Dependencies

Monoucha has no hard dependencies other than QuickJS and the standard library (in particular, the tables module.) QuickJS in turn has no dependencies other than libc.

There is an optional jserror module which enables error handling that is generic to Nim and QuickJS using the nim-results library.

QuickJS is already included in this repository; you do not have to install it separately.

Q&A

  • Cool, so how do I use this thing?

There is a manual. Please read the manual.

  • I'm getting memory leaks?

See the Warning section.

(If you are also experiencing issues with refc, please open a ticket here and I'll look into it.)

  • I already have QuickJS, why are you not linking to my system library?

Monoucha does not actually use stock QuickJS, but a fork that tracks upstream.

This fork includes some GC modifications necessary for the synchronization of the Nim and QuickJS runtimes.

  • Can I compile Nim to JS and execute Nim from Nim?

Possibilities are endless, but this looks like a better solution.

  • Can I use Monoucha with [insert JS engine] instead of QuickJS?

No. Feel free to fork and adapt it to whatever engine you want, but here we only support QuickJS.

  • What is a monoucha?

A kind of tea, from the town once called Monou. You pronounce it as mo-no-u-cha.

Yes, it's a pun.

License

QuickJS was written by Fabrice Bellard and Charlie Gordon. Some patches from QuickJS-NG (maintained by Ben Noordhuis and Saúl Ibarra Corretgé) are also included.

QuickJS is distributed in this repository under the terms of the MIT license. See the monoucha/qjs/LICENSE file for details.

Monoucha is released into the public domain. See the UNLICENSE file for details.