2022-02-23 11:12:10 +01:00
# Developer Docs
A place to collect useful information for developers that doesn't really fit elsewhere.
👉 See [CONTRIBUTING.md ](../CONTRIBUTING.md ) for how to get started participating in this project.
## JoinMarket Development Environment
2026-07-14 07:34:06 +05:30
For a complete development environment you need a local JoinMarket NG instance that the web UI can interact with. We provide a regtest environment that should give you everything needed to get started developing with JoinMarket NG. You can find details here: [docker/regtest/readme.md ](../docker/regtest/readme.md ).
2022-02-23 11:12:10 +01:00
2026-07-14 07:34:06 +05:30
## Running Jam Against JoinMarket NG
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240)
* chore(regtest): initial joinmarket-ng backend for regtest environment
Adds jmwalletd, directory servers, makers, and bitcoind to the regtest
docker-compose environment so jam can be developed against the jm-ng
backend end-to-end.
chore(regtest): wire docker compose env and vite dev proxy for jm-ng
Connects the local regtest containers into a single compose network,
adds tor and fund-wallet helpers, and points Vite's dev proxy at the
local jmwalletd instance.
fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses
joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue
didn't cover: 'cj-change' (deanonymising change from our CJ),
'used-empty' (previously-used address with zero balance), and 'flagged'
(address shared in a CJ that later failed). They fell through to the
generic 'default' badge with no distinguishing styling.
Add them to JmPlainTagValue and the status->variant map. 'used-empty'
maps to the existing 'used' variant, 'flagged' to 'reused' (both signal
a used address the user should avoid reusing). Add a dedicated
'cj-change' badge variant (emerald) next to 'cj-out' so the
deanonymising change output is visually distinct from an equal-amount
CJ output.
fix(send): keep direct send available with maker
Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable.
Changelog: Allow direct sends while the maker service is running
docs(dev): explain jm-ng backend workflow
fix(auth): only clear auth on invalid_token 401s
Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``.
Changelog: Non-auth 401 responses no longer log the user out.
fix(dev): proxy /jmws to the jm-ng HTTPS port
jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override.
Changelog: Fix WebSocket proxying in the local jm-ng dev setup.
fix(dev): correct jm-ng websocket port and proxy targets
Update the README and developer docs to reflect that both ports must be
set when overriding for a custom jm-ng setup.
fix(dev): correct jm-ng websocket port (#1237)
chore(dev): distinct server configs for various backends
* chore(regtest): address jm-ng review comments
---------
Co-authored-by: m0wer <m0wer@sgn.space>
Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
Jam v2 can talk directly to a separately running `jmwalletd` / orderbook watcher from `joinmarket-ng` . You do not need to run the Jam regtest compose or the reference implementation for this workflow.
2026-06-07 22:07:53 +05:30
### Local dev against the Jam regtest joinmarket-ng services
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240)
* chore(regtest): initial joinmarket-ng backend for regtest environment
Adds jmwalletd, directory servers, makers, and bitcoind to the regtest
docker-compose environment so jam can be developed against the jm-ng
backend end-to-end.
chore(regtest): wire docker compose env and vite dev proxy for jm-ng
Connects the local regtest containers into a single compose network,
adds tor and fund-wallet helpers, and points Vite's dev proxy at the
local jmwalletd instance.
fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses
joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue
didn't cover: 'cj-change' (deanonymising change from our CJ),
'used-empty' (previously-used address with zero balance), and 'flagged'
(address shared in a CJ that later failed). They fell through to the
generic 'default' badge with no distinguishing styling.
Add them to JmPlainTagValue and the status->variant map. 'used-empty'
maps to the existing 'used' variant, 'flagged' to 'reused' (both signal
a used address the user should avoid reusing). Add a dedicated
'cj-change' badge variant (emerald) next to 'cj-out' so the
deanonymising change output is visually distinct from an equal-amount
CJ output.
fix(send): keep direct send available with maker
Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable.
Changelog: Allow direct sends while the maker service is running
docs(dev): explain jm-ng backend workflow
fix(auth): only clear auth on invalid_token 401s
Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``.
Changelog: Non-auth 401 responses no longer log the user out.
fix(dev): proxy /jmws to the jm-ng HTTPS port
jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override.
Changelog: Fix WebSocket proxying in the local jm-ng dev setup.
fix(dev): correct jm-ng websocket port and proxy targets
Update the README and developer docs to reflect that both ports must be
set when overriding for a custom jm-ng setup.
fix(dev): correct jm-ng websocket port (#1237)
chore(dev): distinct server configs for various backends
* chore(regtest): address jm-ng review comments
---------
Co-authored-by: m0wer <m0wer@sgn.space>
Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
2026-06-07 22:07:53 +05:30
If you are using Jam's own regtest environment, the initialized joinmarket-ng services are exposed on specific host ports. In that case run:
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240)
* chore(regtest): initial joinmarket-ng backend for regtest environment
Adds jmwalletd, directory servers, makers, and bitcoind to the regtest
docker-compose environment so jam can be developed against the jm-ng
backend end-to-end.
chore(regtest): wire docker compose env and vite dev proxy for jm-ng
Connects the local regtest containers into a single compose network,
adds tor and fund-wallet helpers, and points Vite's dev proxy at the
local jmwalletd instance.
fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses
joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue
didn't cover: 'cj-change' (deanonymising change from our CJ),
'used-empty' (previously-used address with zero balance), and 'flagged'
(address shared in a CJ that later failed). They fell through to the
generic 'default' badge with no distinguishing styling.
Add them to JmPlainTagValue and the status->variant map. 'used-empty'
maps to the existing 'used' variant, 'flagged' to 'reused' (both signal
a used address the user should avoid reusing). Add a dedicated
'cj-change' badge variant (emerald) next to 'cj-out' so the
deanonymising change output is visually distinct from an equal-amount
CJ output.
fix(send): keep direct send available with maker
Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable.
Changelog: Allow direct sends while the maker service is running
docs(dev): explain jm-ng backend workflow
fix(auth): only clear auth on invalid_token 401s
Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``.
Changelog: Non-auth 401 responses no longer log the user out.
fix(dev): proxy /jmws to the jm-ng HTTPS port
jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override.
Changelog: Fix WebSocket proxying in the local jm-ng dev setup.
fix(dev): correct jm-ng websocket port and proxy targets
Update the README and developer docs to reflect that both ports must be
set when overriding for a custom jm-ng setup.
fix(dev): correct jm-ng websocket port (#1237)
chore(dev): distinct server configs for various backends
* chore(regtest): address jm-ng review comments
---------
Co-authored-by: m0wer <m0wer@sgn.space>
Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
```bash
2026-06-07 22:07:53 +05:30
npm run dev:ng:native
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240)
* chore(regtest): initial joinmarket-ng backend for regtest environment
Adds jmwalletd, directory servers, makers, and bitcoind to the regtest
docker-compose environment so jam can be developed against the jm-ng
backend end-to-end.
chore(regtest): wire docker compose env and vite dev proxy for jm-ng
Connects the local regtest containers into a single compose network,
adds tor and fund-wallet helpers, and points Vite's dev proxy at the
local jmwalletd instance.
fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses
joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue
didn't cover: 'cj-change' (deanonymising change from our CJ),
'used-empty' (previously-used address with zero balance), and 'flagged'
(address shared in a CJ that later failed). They fell through to the
generic 'default' badge with no distinguishing styling.
Add them to JmPlainTagValue and the status->variant map. 'used-empty'
maps to the existing 'used' variant, 'flagged' to 'reused' (both signal
a used address the user should avoid reusing). Add a dedicated
'cj-change' badge variant (emerald) next to 'cj-out' so the
deanonymising change output is visually distinct from an equal-amount
CJ output.
fix(send): keep direct send available with maker
Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable.
Changelog: Allow direct sends while the maker service is running
docs(dev): explain jm-ng backend workflow
fix(auth): only clear auth on invalid_token 401s
Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``.
Changelog: Non-auth 401 responses no longer log the user out.
fix(dev): proxy /jmws to the jm-ng HTTPS port
jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override.
Changelog: Fix WebSocket proxying in the local jm-ng dev setup.
fix(dev): correct jm-ng websocket port and proxy targets
Update the README and developer docs to reflect that both ports must be
set when overriding for a custom jm-ng setup.
fix(dev): correct jm-ng websocket port (#1237)
chore(dev): distinct server configs for various backends
* chore(regtest): address jm-ng review comments
---------
Co-authored-by: m0wer <m0wer@sgn.space>
Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
```
2026-06-07 22:07:53 +05:30
If your separately running joinmarket-ng services use different ports, you can override them directly:
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240)
* chore(regtest): initial joinmarket-ng backend for regtest environment
Adds jmwalletd, directory servers, makers, and bitcoind to the regtest
docker-compose environment so jam can be developed against the jm-ng
backend end-to-end.
chore(regtest): wire docker compose env and vite dev proxy for jm-ng
Connects the local regtest containers into a single compose network,
adds tor and fund-wallet helpers, and points Vite's dev proxy at the
local jmwalletd instance.
fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses
joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue
didn't cover: 'cj-change' (deanonymising change from our CJ),
'used-empty' (previously-used address with zero balance), and 'flagged'
(address shared in a CJ that later failed). They fell through to the
generic 'default' badge with no distinguishing styling.
Add them to JmPlainTagValue and the status->variant map. 'used-empty'
maps to the existing 'used' variant, 'flagged' to 'reused' (both signal
a used address the user should avoid reusing). Add a dedicated
'cj-change' badge variant (emerald) next to 'cj-out' so the
deanonymising change output is visually distinct from an equal-amount
CJ output.
fix(send): keep direct send available with maker
Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable.
Changelog: Allow direct sends while the maker service is running
docs(dev): explain jm-ng backend workflow
fix(auth): only clear auth on invalid_token 401s
Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``.
Changelog: Non-auth 401 responses no longer log the user out.
fix(dev): proxy /jmws to the jm-ng HTTPS port
jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override.
Changelog: Fix WebSocket proxying in the local jm-ng dev setup.
fix(dev): correct jm-ng websocket port and proxy targets
Update the README and developer docs to reflect that both ports must be
set when overriding for a custom jm-ng setup.
fix(dev): correct jm-ng websocket port (#1237)
chore(dev): distinct server configs for various backends
* chore(regtest): address jm-ng review comments
---------
Co-authored-by: m0wer <m0wer@sgn.space>
Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
```bash
JAM_BACKEND=joinmarket-ng \
JMWALLETD_API_PORT=28183 \
JMWALLETD_WEBSOCKET_PORT=28283 \
JMOBWATCH_PORT=8080 \
npm run dev
```
2026-05-22 00:24:36 +05:30
## Storybook
Storybook is used to inspect reusable UI and Jam components in isolation without running a full wallet flow.
Run it locally with:
```bash
npm run storybook:up
```
Build the static Storybook preview with:
```bash
npm run storybook:build
```
The Storybook Pages workflow publishes the latest `devel` version through GitHub Pages once Pages is configured to use GitHub Actions as its source.
Hosted preview:
```text
https://joinmarket-webui.github.io/jam/
```
2022-02-23 11:12:10 +01:00
## Linting
We use Create React App's [default ESLint integration ](https://create-react-app.dev/docs/setting-up-your-editor/#displaying-lint-output-in-the-editor ).
2024-09-11 13:09:28 +02:00
You'll see linting issues in the console when running the app with `npm run dev` .
2022-02-23 11:12:10 +01:00
Pull request builds will fail if ESLint is not happy with the code.
## Code Formatting
We use the [Prettier ](https://prettier.io/ ) code formatter to keep a consistent code style.
Pull request builds will fail if Prettier is not happy with the code.
There's a couple of options on how to setup Prettier so that it formats your code automatically:
### NPM Script
Running `npm run format` will format the whole codebase.
### Editor Integration
Prettier has great [editor integrations ](https://prettier.io/docs/en/editors.html ) which will automatically format all files you touch.
### Git Pre-Commit Hook
You can use a pre-commit hook that will automatically format all changes before comitting them to Git.
We use [husky ](https://github.com/typicode/husky ) and [lint-staged ](https://github.com/okonet/lint-staged ) for that.
By default, the hook will be installed automatically as an [NPM postinstall script ](https://docs.npmjs.com/cli/v6/using-npm/scripts#npm-install ).
### Troubleshooting
If you're having issues with Husky not using the correct `$PATH` , you may need to setup a `~/.huskyrc` which will let you set up your path before the hook is run.
See [here ](https://typicode.github.io/husky/#/?id=command-not-found ) for more info.
2026-07-14 07:34:06 +05:30
## Running the Web UI Locally and Connecting to a Remote JoinMarket NG Instance
2022-02-23 11:12:10 +01:00
2026-07-14 07:34:06 +05:30
These instructions assume you want to run the web UI locally and connect it to a JoinMarket NG instance on your RaspiBlitz.
2022-02-23 11:12:10 +01:00
The process should be similar for other setups.
2026-07-14 07:34:06 +05:30
If you run the Web UI and JoinMarket NG on the same system, simply skip the SSH tunnel step.
2022-02-23 11:12:10 +01:00
2026-07-14 07:34:06 +05:30
### 🚨 Prerequisite: JoinMarket NG
2022-02-23 11:12:10 +01:00
2026-07-14 07:34:06 +05:30
To run the web UI locally you need to connect it to a running JoinMarket NG instance.
2022-02-23 11:12:10 +01:00
2026-07-14 07:34:06 +05:30
#### 1. Install JoinMarket NG
2022-02-23 11:12:10 +01:00
Install [JoininBox ](https://github.com/openoms/joininbox ) on your [RaspiBlitz ](https://github.com/rootzoll/raspiblitz ):
```
Services > j [BTC JoinMarket+JoininBox menu]
```
2026-07-14 07:34:06 +05:30
Or follow the JoinMarket NG [installation guide ](https://joinmarket-ng.github.io/joinmarket-ng/install/ ) if you're on another system.
2022-02-23 11:12:10 +01:00
2026-07-14 07:34:06 +05:30
### 🚨 Prerequisite: JoinMarket NG API Service
2022-02-23 11:12:10 +01:00
2026-07-14 07:34:06 +05:30
This app makes use of the JoinMarket NG API.
2022-02-23 11:12:10 +01:00
#### 2. SSL Certificate
2026-07-14 07:34:06 +05:30
As the joinmarket user on your RaspiBlitz, generate a self-signed certificate for the JoinMarket NG API Service as described [here ](https://linuxize.com/post/creating-a-self-signed-ssl-certificate/ ), and put the certificate and the key in the `~/.joinmarket-ng/ssl/` directory.
2022-02-23 11:12:10 +01:00
_Hint:_ To login as the JoinMarket user, you can ssh into your RaspiBlitz, type `jm` , and exit the JoininBox menu.
Create the SSL directory:
```bash
2026-07-14 07:34:06 +05:30
(jmvenv) joinmarket@raspberrypi: ~ $ mkdir ~/.joinmarket-ng/ssl/
2022-02-23 11:12:10 +01:00
```
Generate the certificate and associated key:
```bash
2026-07-14 07:34:06 +05:30
openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes -out ~/.joinmarket-ng/ssl/cert.pem -keyout ~/.joinmarket-ng/ssl/key.pem
2022-02-23 11:12:10 +01:00
```
_Hint:_ You don't have to enter anything meaningful, you can just hit the return key a couple of times.
#### 3. API Service
2026-07-14 07:34:06 +05:30
Start the JoinMarket NG [API service ](https://joinmarket-ng.github.io/joinmarket-ng/README-jmwalletd/ ):
2022-02-23 11:12:10 +01:00
```bash
2026-07-14 07:34:06 +05:30
(jmvenv) joinmarket@raspberrypi: ~/joinmarket-ng $ jmwalletd serve
2022-02-23 11:12:10 +01:00
```
You should see the following:
```text
2021-11-18 18:16:57,639 [INFO] Starting jmwalletd on port: 28183
2021-11-18 18:16:57,661 [INFO] Joinmarket daemon listening on port 27183
```
#### 4. SSH Tunnel
Create an SSH tunnel for the API service. On the machine where you want to run the web UI, add the following lines to your `~/.ssh/config` file:
```conf
Host raspiblitz
HostName 192.168.X.X # (IP address of your RaspiBlitz)
User admin
ForwardAgent yes
LocalForward 28183 localhost:28183
```
2022-03-03 12:07:45 +01:00
### 💻 Download, Install, Jam
2022-02-23 11:12:10 +01:00
In short:
```bash
2022-09-22 13:09:28 +02:00
git clone https://github.com/joinmarket-webui/jam.git
cd jam/
2024-09-11 13:09:28 +02:00
npm install & & npm run dev
2022-02-23 11:12:10 +01:00
```
2026-01-23 23:33:23 +01:00
## Resources
- yup (GitHub): https://github.com/jquense/yup
- react-hook-form (GitHub): https://github.com/react-hook-form/react-hook-form
- react-query (GitHub): https://github.com/TanStack/query