# \[ANN\] ppx\_expjs: transparently export OCaml values to JavaScript

**URL:** <https://discuss.ocaml.org/t/ann-ppx-expjs-transparently-export-ocaml-values-to-javascript/10938>\
**Category:** Community\
**Tags:** announce\
**Created:** [December 9, 2022, 10:27pm UTC](https://discuss.ocaml.org/t/ann-ppx-expjs-transparently-export-ocaml-values-to-javascript/10938 "2022-12-09T22:27:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zbaylin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/zbaylin/32/4047_2.png) [@zbaylin](https://discuss.ocaml.org/u/zbaylin)\
**Post date:** [December 9, 2022, 10:27pm UTC](https://discuss.ocaml.org/t/ann-ppx-expjs-transparently-export-ocaml-values-to-javascript/10938/1 "2022-12-09T22:27:30Z")

</div>

Hi everyone,

I’d like to share a ppx I’ve been working on to help us build frontends with JSOO at Skolem as well as a blog post to accompany it.

[ppx\_expjs](https://github.com/skolemlabs/ppx_expjs) is a ppx that helps generate the boilerplate of exporting OCaml values (including functions) to JavaScript when using Js\_of\_ocaml.

### Example

`my_module.ml`:

```ocaml
let concat (s1 : string) (s2 : string) : string = s1 ^ s2
[@@expjs]

```

`node`:

```plaintext
Welcome to Node.js v16.13.0.
Type ".help" for more information.
> const my_module = require("./_build/default/my_module.bc.js");
undefined
> x.concat("Hello ", "World")
"Hello World"
>

```

(note there is no need to use either `Js.string` nor `Js.to_string`)

### Blog post

I’ve written a blog post that describes why one might find this ppx useful and how it works, which can be found [here](https://blog.skolem.com/ppx_expjs-generate-transparent-javascript-from-your-ocaml/).

### Installation

Currently there’s no official release of the ppx on OPAM, but if you would like to install it you can run

```plaintext
opam pin add ppx_expjs https://github.com/skolemlabs/ppx_expjs.git

```
