Skip to content

Local deployment

NovelGraph has two local surfaces with different stores. Studio serves the local authoring API and writes .novelgraph/studio.sqlite. The site is a static Astro build; it uses the bundled fixture and never connects to Studio.

The repository requires Node.js 22.13 or newer and pnpm 9 or newer. Node 22.13 supplies the built-in SQLite module used by packages/core/src/studio/store.ts.

From the repository root:

Terminal window
corepack pnpm install --frozen-lockfile
corepack pnpm build

pnpm build builds every workspace package. The package boundaries are:

PathRuntime responsibilityDurable data
packages/coreSQLite store, migrations, validation, workflow harness.novelgraph/studio.sqlite when opened by Studio
packages/studioHono API and React workbenchUses the selected project root
packages/clinovelgraph launcher and compatibility commandsnovelgraph.json and books/ for file-based commands
packages/siteStatic documentation and fixture demoNothing from the local project

The CLI compatibility tree and the Studio SQLite store are not interchangeable exports. SQLite is authoritative for Studio; Markdown and JSON are generated outputs.

Run this from the project directory that should contain .novelgraph/:

Terminal window
node /absolute/path/to/novelgraph/packages/cli/dist/index.js studio --no-open

On Windows PowerShell, from the repository root:

Terminal window
node .\packages\cli\dist\index.js studio --no-open

The default listener is http://127.0.0.1:4567. The command creates .novelgraph/ and opens studio.sqlite through the store migrator. To select a project root explicitly:

Terminal window
$env:NOVELGRAPH_PROJECT_ROOT = (Resolve-Path .\my-project).Path
node .\packages\studio\dist\server\server.js

The server also accepts NOVELGRAPH_STUDIO_PORT and NOVELGRAPH_STUDIO_HOST. A host other than 127.0.0.1, localhost, or ::1 prints a warning because the API is unauthenticated and has no cross-origin access control.

The npm equivalent is not available yet. After the first registry release passes canary verification, it will be:

Terminal window
npx @actalk/novelgraph studio --no-open

Check the process before opening a browser:

Terminal window
curl http://127.0.0.1:4567/api/v1/health

Expected response: {"ok":true}. A refused connection means the process did not bind; an address-in-use error means choose another port, for example novelgraph studio --port 4568 --no-open.

Configuration is loaded from the global NovelGraph environment first, then the project .env overrides it. Keep both files out of version control.

NOVELGRAPH_LLM_PROVIDER=openai
NOVELGRAPH_LLM_BASE_URL=https://api.openai.com/v1
NOVELGRAPH_LLM_API_KEY=replace-locally
NOVELGRAPH_LLM_MODEL=your-model

Initialize the directory and inspect its local boundary before opening Studio:

Terminal window
novelgraph init
novelgraph doctor

doctor checks Node, the English project configuration, environment-file locations, and whether the Studio database exists. It does not transmit credentials or make a provider call. Fresh 0.5 projects do not create the earlier radar state or autonomous-daemon schedule. A file export must not be treated as a second writable source of truth.

From the repository root:

Terminal window
corepack pnpm site:dev

This runs the packages/site Astro development server. For a release-like check:

Terminal window
corepack pnpm site:build

The build runs astro check before producing packages/site/dist. It does not need provider credentials or a Studio process.

SymptomEvidenceActionAuthority boundary
SQLite cannot loadNode is below 22.13, or the process reports an unavailable node:sqlite moduleUpgrade Node, reinstall with the lockfile, and retrypackages/core owns schema access
Studio cannot startnovelgraph.json is absent only when using compatibility commands; .novelgraph/ is created by StudioRun the command from the intended project root; do not create studio.sqlite by handThe selected project root is the storage boundary
Port bind failsEADDRINUSE or ECONNREFUSEDStop the old process or use --port 4568; confirm /api/v1/healthLoopback is the default safety boundary
Provider check failsdoctor reports a missing key, 401, 400, or connection errorCorrect the local .env, base URL, or model; never paste the key into an issueCredentials stay local
A book is lockedError names books/<book-id>/.write.lockConfirm no writer is active, then remove only that stale lock fileThe lock protects one compatibility book, not the SQLite database
A workflow is blockedJob state is blocked, or closure reports a critical findingInspect job events and findings, resolve the cause, then resume or rerun with a new idempotency keyAgents may propose; approval and closure remain explicit

Open the rendered local-architecture diagram · Read the canonical Mermaid source

Accessible equivalent: the browser and CLI call the loopback Hono API; discovery, workflow, and validation services read or write the local SQLite store; exports are Markdown and reports; model providers and research sources are optional external inputs.