NarraLeaf

Installation

Install the NarraLeaf CLI, runtime package, and peer dependencies.

NarraLeaf projects use two package surfaces:

  • narraleaf-cli provides the narraleaf command.
  • narraleaf provides the main-process runtime, renderer entry, and build configuration types.

Install the CLI

Use the CLI when you want to initialize, run, inspect, or package a NarraLeaf project.

npm install -g narraleaf-cli
yarn global add narraleaf-cli
pnpm add -g narraleaf-cli

After installation, the command name is narraleaf.

narraleaf --version

Install in a Project

For an existing application, install the runtime package and its peer dependencies.

npm install narraleaf narraleaf-react react react-dom electron electron-builder
npm install -D narraleaf-cli typescript
yarn add narraleaf narraleaf-react react react-dom electron electron-builder
yarn add -D narraleaf-cli typescript
pnpm add narraleaf narraleaf-react react react-dom electron electron-builder
pnpm add -D narraleaf-cli typescript

Note: The current runtime expects React 19 and Electron 34 compatible projects.

Package Entrypoints

NarraLeaf exposes three runtime entrypoints:

import { AppConfig } from "narraleaf";
import { render, useApp } from "narraleaf/renderer";
import { BuildTarget } from "narraleaf/config";
  • narraleaf and narraleaf/main expose main-process APIs.
  • narraleaf/renderer exposes renderer helpers, hooks, and types.
  • narraleaf/config exposes build configuration helpers and target types.

Next Steps

On this page