Installation
Install the NarraLeaf CLI, runtime package, and peer dependencies.
NarraLeaf projects use two package surfaces:
narraleaf-cliprovides thenarraleafcommand.narraleafprovides 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-cliyarn global add narraleaf-clipnpm add -g narraleaf-cliAfter installation, the command name is narraleaf.
narraleaf --versionInstall 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 typescriptyarn add narraleaf narraleaf-react react react-dom electron electron-builder
yarn add -D narraleaf-cli typescriptpnpm add narraleaf narraleaf-react react react-dom electron electron-builder
pnpm add -D narraleaf-cli typescriptNote: 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";narraleafandnarraleaf/mainexpose main-process APIs.narraleaf/rendererexposes renderer helpers, hooks, and types.narraleaf/configexposes build configuration helpers and target types.