Skip to content

Getting started

dartea ships as an npm package with a native binary inside. You need Node.js 18 or newer.

Terminal window
npm install --save-dev @dartea/cli

npm picks the binary for your machine. There are builds for:

  • macOS on Apple silicon and Intel
  • Linux on x64 and arm64, with glibc
  1. Create the project files.

    Terminal window
    npx dartea init

    You get two files:

    • dartea.json
    • Directorysrc/
      • Main.elm a small counter
  2. Build a page with the program inside.

    Terminal window
    npx dartea make src/Main.elm --output index.html
  3. Open index.html in a browser. No server needed.

init refuses to run where a dartea.json or an elm.json already exists, so it never overwrites a project.

The extension of --output decides what you get.

Terminal window
npx dartea make src/Main.elm --output index.html

One HTML file with the script inside. Good for trying things out and for small apps.

They work as in Elm. The global object is called Dartea, not Elm:

const app = Dartea.Main.init({ flags: JSON.parse(localStorage.getItem("state")) });
app.ports.save.subscribe((state) => {
localStorage.setItem("state", JSON.stringify(state));
});

Some modules of the standard library come from elm/core, elm/html, elm/browser, elm/url and elm/http. When any of them ends up in your bundle, dartea writes dartea.LICENSE.txt next to it and adds a one line banner pointing there. Your own code stays yours to license.