Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8b4e6d3
feat: create @waku/run package for local dev env
adklempner Oct 9, 2025
263a4b7
chore: add @waku/run to release please config
adklempner Oct 9, 2025
0966ed1
feat: test @waku/run with playwright
adklempner Oct 9, 2025
0736926
fix: don't run waku/run tests in CI
adklempner Oct 10, 2025
3c8cdeb
fix: cache images so docker-compose can work offline
adklempner Oct 10, 2025
52a4a5d
feat: set nodekey and staticnode flags for each nwaku node
adklempner Oct 10, 2025
3ea83f8
fix: use constants for node ids
adklempner Oct 10, 2025
5944c83
chore: set directories for running via npx
adklempner Oct 10, 2025
cc7ab12
fix: remove .env, support env vars for nwaku ports
adklempner Oct 12, 2025
d2699e3
fix: use separate db (same instance) for each node
adklempner Oct 12, 2025
9e34309
feat: add command to test dev env
adklempner Oct 13, 2025
161d094
chore: use package version in container name
adklempner Oct 20, 2025
b352825
fix: replace hardcoded WS/REST ports with constants/env vars
adklempner Oct 20, 2025
e27a6c1
chore: clean up README
adklempner Oct 20, 2025
53ba53c
fix: refactor config printing into own function
adklempner Oct 20, 2025
ec113f8
fix: add run package to release please manifest
adklempner Oct 21, 2025
1c4cb78
fix: defer to root folder gitignore/cspell
adklempner Oct 21, 2025
fe1f0d7
fix: update node version and remove tsx
adklempner Oct 22, 2025
471d054
fix: remove browser tests and express dep
adklempner Oct 22, 2025
ff730db
fix: replace magic values with constants
adklempner Oct 22, 2025
5d91b9d
fix: move to root .gitignore
adklempner Oct 22, 2025
13364b7
fix: move cspell to root
adklempner Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@
"fontsource",
"globby",
"gossipsub",
"hackathons",
"huilong",
"iasked",
"ihave",
"ihaves",
"ineed",
"IPAM",
"ipfs",
"isready",
"iwant",
"jdev",
"jswaku",
Expand Down Expand Up @@ -165,6 +167,7 @@
"gen",
"proto",
"*.spec.ts",
"*.log",
"CHANGELOG.md"
],
"patterns": [
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ packages/discovery/mock_local_storage
.giga
.cursor
.DS_Store
CLAUDE.md
CLAUDE.md
.env
postgres-data/
3 changes: 2 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"packages/discovery": "0.0.12",
"packages/sds": "0.0.7",
"packages/rln": "0.1.9",
"packages/react": "0.0.7"
"packages/react": "0.0.7",
"packages/run": "0.0.1"
}
32 changes: 32 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"packages/rln",
"packages/sdk",
"packages/relay",
"packages/run",
"packages/tests",
"packages/reliability-tests",
"packages/browser-tests",
Expand Down
20 changes: 20 additions & 0 deletions packages/run/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: "./tsconfig.dev.json"
},
rules: {
"@typescript-eslint/no-non-null-assertion": "off"
},
globals: {
process: true
},
overrides: [
{
files: ["*.js"],
rules: {
"no-console": "error"
}
}
]
};
11 changes: 11 additions & 0 deletions packages/run/.mocharc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
extension: ['ts'],
require: ['ts-node/register'],
loader: 'ts-node/esm',
'node-option': [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
timeout: 90000,
exit: true
};
148 changes: 148 additions & 0 deletions packages/run/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# @waku/run

> **Spin up a local Waku network for development without relying on external infrastructure**

Perfect for hackathons, offline development, or when you need a controlled testing environment for your js-waku application.

## What's Included

- **2 nwaku nodes** connected to each other with all protocols enabled:
- **PostgreSQL database** for message persistence
- **Isolated network** - nodes only connect to each other

## Requirements

- [Docker Desktop](https://www.docker.com/products/docker-desktop/) or Docker Engine with Compose plugin

## Quick Start

### 1. Start the Network

```bash
npx @waku/run start
```

This will:
- Start 2 nwaku nodes and a PostgreSQL database
- Run in the background (detached mode)
- Display connection information you need for your app

**Example output:**
```typescript
import { createLightNode } from "@waku/sdk";

const waku = await createLightNode({
defaultBootstrap: false,
bootstrapPeers: [
"/ip4/127.0.0.1/tcp/60000/ws/p2p/16Uiu2HAmF6oAsd23RMAnZb3NJgxXrExxBTPMdEoih232iAZkviU2",
"/ip4/127.0.0.1/tcp/60001/ws/p2p/16Uiu2HAm5aZU47YkiUoARqivbCXwuFPzFFXXiURAorySqAQbL6EQ"
],
numPeersToUse: 2,
libp2p: {
filterMultiaddrs: false
},
networkConfig: {
clusterId: 0,
numShardsInCluster: 8
}
});
```

### 2. Connect Your js-waku App

Copy the configuration from the output above and paste it into your application. Then start your node:

```typescript
await waku.start();

// Your app is now connected to your local Waku network!
```

### 3. Stop When Done

```bash
npx @waku/run stop
```

## Available Commands

### Using npx (published package)

| Command | Description |
|---------|-------------|
| `npx @waku/run start` | Start the network (detached) and show connection info |
| `npx @waku/run stop` | Stop the network and clean up |
| `npx @waku/run info` | Show connection info for running network |
| `npx @waku/run logs` | View and follow logs from all nodes |
| `npx @waku/run test` | Test the network by sending a message |

## Configuration

All configuration is done via environment variables passed to the command.

### Custom Ports

If the default ports are in use, specify custom ports:

```bash
NODE1_WS_PORT=50000 NODE2_WS_PORT=50001 npx @waku/run start
```

Available port configuration:
- `NODE1_WS_PORT` (default: 60000)
- `NODE2_WS_PORT` (default: 60001)
- `NODE1_REST_PORT` (default: 8646)
- `NODE2_REST_PORT` (default: 8647)

### Cluster Configuration

The default configuration uses:
- Cluster ID: 0
- Number of shards: 8

To test with a different cluster:

```bash
CLUSTER_ID=16 npx @waku/run start
```

### Custom nwaku Version

To use a different nwaku image version:

```bash
NWAKU_IMAGE=wakuorg/nwaku:v0.35.0 npx @waku/run start
```

## Debugging

### View Node Logs

```bash
npx @waku/run logs
```

### Check Node Health

```bash
# Node 1
curl http://127.0.0.1:8646/health

# Node 2
curl http://127.0.0.1:8647/health
```

### Check Peer Connections

```bash
# Node 1 debug info
curl http://127.0.0.1:8646/debug/v1/info

# Node 2 debug info
curl http://127.0.0.1:8647/debug/v1/info
```


## License

MIT OR Apache-2.0
Loading
Loading