README.md

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/software-mansion/popcorn/refs/heads/main/assets/dark-mode-logo-text.svg">
  <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/software-mansion/popcorn/refs/heads/main/assets/light-mode-logo-text.svg">
  <img alt="Popcorn" src="https://raw.githubusercontent.com/software-mansion/popcorn/refs/heads/main/assets/fallback-logo-text.svg">
</picture>

[![Ad](https://swm-delivery.com/www/images/zone-gh-popcorn-1?n=1)](https://swm-delivery.com/www/delivery/ck.php?zoneid=zone-gh-popcorn-1&n=1)
[![Ad](https://swm-delivery.com/www/images/zone-gh-popcorn-2?n=1)](https://swm-delivery.com/www/delivery/ck.php?zoneid=zone-gh-popcorn-2&n=1)
[![Ad](https://swm-delivery.com/www/images/zone-gh-popcorn-3?n=1)](https://swm-delivery.com/www/delivery/ck.php?zoneid=zone-gh-popcorn-3&n=1)

**Popcorn is a library that allows you to run client-side Elixir in browsers, with JavaScript interoperability**

Popcorn is early stages and may break. Please report an issue if it does. Contributions are very welcome, but please open an issue before committing too much effort.

Under the hood, Popcorn runs [AtomVM](https://github.com/atomvm/AtomVM), a tiny Erlang VM.

## Documentation

The API documentation and guides are available at <https://hexdocs.pm/popcorn>

## Examples

The examples are hosted at [popcorn.swmansion.com](https://popcorn.swmansion.com), and the source code is in the `examples/` directory.

See also third-party examples:

- Running Popcorn on iOS (WebView based): https://github.com/u9g/uno-royale
- A collection of local Live View demos: https://petermm.github.io/popcorn_live_view/

## Repository Structure

- **`popcorn/elixir/`** - Elixir library used to patch OTP and Elixir stdlib, create .avm bundles and containing JS interop API.
- **`popcorn/js/`** - JavaScript library loads the VM in Wasm, manages its isolation, and bridges JS and Elixir.
- **`otp/`** - temporary location for integration with BEAM/OTP.
- **`examples/`** - Example projects showcasing Popcorn features, hosted at [popcorn.swmansion.com](https://popcorn.swmansion.com/#examples). Examples use development version of Popcorn.
- **`landing-page/`** - Popcorn [landing page](https://popcorn.swmansion.com/).
- **`language-tour/`** - Interactive [Elixir language tour](https://elixir-language-tour.swmansion.com/) running purely in the browser.
- **`local-live-view/`** - Experimental client-side LiveView implementation.
- **`scripts/`** - Shell scripts for development, testing, and CI tasks.
- **`docker/`** - Dockerfiles and nginx configs for CI and deployment.

## Development

We use [`mise`](https://mise.jdx.dev) to manage tool versions and run tasks. [Install it](https://mise.jdx.dev/installing-mise.html), then:

```shell
mise install
mise run dev
```

This installs all dependencies (Elixir, Node, pnpm) and starts the JS library in watch mode.

To develop with an example or project:

```shell
mise run dev --example hello-popcorn
mise run dev --project landing-page
mise run dev --project language-tour
```

Run `scripts/dev.sh --help` to see all available examples and projects.

### Testing

```shell
mise run test            # Elixir unix tests (default)
mise run test --wasm     # Elixir wasm tests
mise run test --js       # JS tests
```

AtomVM is built automatically if artifacts are missing. Make sure you have [AtomVM dependencies](https://github.com/atomvm/atomvm?tab=readme-ov-file#dependencies) installed.

### Other tasks

```shell
mise run clean           # Clean build artifacts
mise run clean --all     # Clean everything including examples
```

All tasks are thin wrappers around `scripts/*.sh` — you can run those directly.

## Authors

Popcorn is created by Software Mansion.

Since 2012 [Software Mansion](https://swmansion.com/) is a software agency with experience in building web and mobile apps as well as complex multimedia solutions. We are Core React Native Contributors and experts in live streaming and broadcasting technologies. We can help you build your next dream product – [Hire us](https://swmansion.com/contact/projects).

Copyright 2025, [Software Mansion](https://swmansion.com/)

[![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=membrane-github)](https://swmansion.com/)

Licensed under the [Apache License, Version 2.0](LICENSE)