Skip to content

Running Locally

In development the client and server run as two separate processes. The server hosts the GraphQL API, and the Angular dev server hosts the UI with live reload and proxies API calls to the server.

  1. Fork cashubtc/orchard on GitHub.

  2. Clone your fork:

    Terminal window
    git clone https://github.com/<you>/orchard.git
    cd orchard
  3. Install dependencies:

    Terminal window
    npm install

Next create your .env from the example.

Terminal window
cp .env.example .env
nano .env

The Configuration page documents every .env option, including how to point Orchard at your Bitcoin, Lightning, and Cashu mint services.

Terminal window
npm run start:server

This runs the NestJS server in watch mode, so it restarts when you change server code. It listens on SERVER_HOST:SERVER_PORT (localhost:3321 by default).

Three commands are available:

CommandWhat it does
npm run start:serverWatch mode, restarts on change.
npm run start:server:nowatchSingle run, no watching.
npm run start:server:debugWatch mode with the Node inspector attached.

The development server also exposes a GraphQL playground at http://localhost:3321/api (default). Here you can browse the schema and run queries, mutations, and subscriptions against your local server.

In a second terminal:

Terminal window
npm run start:client

This generates the runtime config, regenerates the GraphQL types, then starts the Angular dev server on http://localhost:4200. Open that address to see Orchard’s UI. The dev server reloads the page as you change client code.

The client reaches the server through a proxy: requests to /proxy are forwarded to SERVER_HOST:SERVER_PORT (set in proxy.conf.js).

The types in src/shared are generated from the server’s GraphQL schema. start:client regenerates them on startup, so most of the time you do not run this yourself. After changing the server’s GraphQL schema, regenerate them with:

Terminal window
npm run generate:types

A few settings are useful in development that you would not use in production.

DEV_AUTH_BYPASS=true

With this set, unauthenticated requests are granted admin access, so you can work on the codebase without authentication. The server logs a warning on startup when it is on.

LOG_LEVEL=debug

Raises the log level so you see the detailed output that helps while debugging. The full range, quietest to loudest, is fatal, error, warn, info, debug, verbose.

In development the database is created (default data/orchard.db) automatically on first run, and the schema is kept in step with the code automatically, so you do not run migrations for routine development.

The migration:generate, migration:run, migration:revert, and migration:show scripts are there for working on schema changes that ship to production, where the schema is not synced automatically.


Development Running Locally

Last updated: