Getting started

Quickstart

This guide walks through installing the framework, starting the API, seeding demo data, and running each demo script end-to-end.

Requirements

Install

Clone the repository and install dependencies.

Install
git clone https://github.com/ntwrkd-labs/sovereign-wallet-os
cd sovereign-wallet-os
pnpm install

Verify the TypeScript types compile correctly:

Type check
pnpm typecheck

Snapshot mode

Snapshot mode is the fastest way to run the local demo. State is persisted to a local file. No Docker required.

Start API — snapshot mode
SOVEREIGN_STORAGE_DRIVER=snapshot \
API_PORT=3002 \
node --import tsx/esm apps/api/src/index.ts

The API is now available at http://localhost:3002.

Postgres mode

For durable runtime validation and integration tests, use Postgres mode.

Start with Postgres
# Start Postgres
docker compose down -v
docker compose up -d postgres

# Run migrations
DATABASE_URL=postgres://sovereign:sovereign@127.0.0.1:5432/sovereign \
pnpm db:migrate

# Start API
SOVEREIGN_STORAGE_DRIVER=postgres \
DATABASE_URL=postgres://sovereign:sovereign@127.0.0.1:5432/sovereign \
API_PORT=3003 \
node --import tsx/esm apps/api/src/index.ts

Seed the demo

Seed creates the demo wallets, merchants, routes, and agent identities. Run once after starting the API.

Seed
curl -X POST http://localhost:3002/v1/demo/seed
# or
pnpm demo:seed

Run paid data demo

The paid data demo shows a full procurement flow: EconomicIntent → constitution evaluation → mock x402 payment → DataArtifact creation.

Paid data demo
pnpm demo:paid-data

Run paper trade demo

Creates a trade plan from paid data, runs a deterministic risk check, and requests paper execution through the trading wallet.

Paper trade demo
pnpm demo:paper-trade

Inspect provenance

Returns the full provenance chain for the data artifact created in the paid data demo.

Provenance lookup
pnpm demo:provenance
# or
curl http://localhost:3002/v1/provenance/:artifactId

Export accounting

Exports journal records for all settled economic actions in the demo session.

Accounting export
pnpm demo:accounting-export
# or
curl http://localhost:3002/v1/accounting/export

Run the full test suite

Tests
pnpm typecheck
pnpm test
pnpm test:integration
pnpm test:postgres    # requires Docker
Snapshot mode is recommended for your first run. Switch to Postgres mode when you want to validate durable state and run the full integration suite.