This blockchain is for educational purposes only and should not be used for production purposes in its current state. As the application matures and meets standards, then at that point it can be used for production purposes.
- Node.js 25.8.1
- pnpm 10.32.1
git clone https://github.com/exilesprx/blockchain.git
cd blockchain
pnpm installTo run the bank or miner locally:
pnpm app:bank
pnpm app:minerThis is a pnpm monorepo containing three packages:
packages/
common/ @blockchain/common shared domain logic, infrastructure, and events
bank/ @blockchain/bank HTTP API for submitting transactions
miner/ @blockchain/miner Kafka consumer that mines blocks
Run all scripts from the workspace root.
| Script | Description |
|---|---|
pnpm test |
Run all tests |
pnpm test:watch |
Run tests in watch mode |
pnpm test:ui |
Open the Vitest UI |
pnpm lint |
Lint source files with oxlint |
pnpm lint:fix |
Lint and auto-fix |
pnpm fmt |
Check formatting with oxfmt |
pnpm fmt:fix |
Auto-format source files |
pnpm app:bank |
Start the bank server |
pnpm app:miner |
Start the miner |
pnpm typecheck:bank |
Type-check the bank package |
pnpm typecheck:miner |
Type-check the miner package |
pnpm debug:bank |
Start the bank with the Node inspector |
pnpm debug:miner |
Start the miner with the Node inspector |
Vitest is the test runner. No compilation step is required — tests run directly against the TypeScript source via tsx.
Coverage is provided by @vitest/coverage-v8.
pnpm test # run once
pnpm test:watch # watch mode
pnpm test:ui # browser UITo run tests for a single package:
pnpm --filter @blockchain/common test
pnpm --filter @blockchain/bank test
pnpm --filter @blockchain/miner testThere is no compilation step. The apps run TypeScript source directly at runtime via tsx.
typecheck:bank and typecheck:miner run type-checking only (tsc --noEmit) — no JavaScript output is produced. These are used in CI to catch type errors before deployment.
Add a dependency to a specific package:
pnpm --filter @blockchain/bank add <package>
pnpm --filter @blockchain/common add <package>Add a dev dependency to the workspace root:
pnpm add -D <package> -wRun a script in a specific package:
pnpm --filter @blockchain/bank <script>- Create the directory:
packages/<name>/ - Add
packages/<name>/package.json:{ "name": "@blockchain/<name>", "version": "0.1.0", "type": "module", "scripts": {} } - Add
packages/<name>/tsconfig.json:{ "extends": "../../tsconfig.json", "compilerOptions": { "noEmit": true, "paths": { "@/*": ["./src/*"] } }, "include": ["src/**/*"] } - Create
packages/<name>/src/ - Run
pnpm installfrom the workspace root
Images for this project can be found: https://hub.docker.com/r/exilesprx/blockchain
source— base Node image (node:25.8.2-bookworm-slim)base— setsNODE_ENV, user, and working directorypnpm— installs pnpmdev— full install of all dependencies (used for local development and CI)bank— production image for the bank appminer— production image for the miner app
Apps run TypeScript source directly at runtime via tsx. No compilation to JavaScript is required.
Use docker-compose.version.yml to build versioned images for bank and miner:
VERSION=1.0.0 docker compose -f docker-compose.version.yml buildThis produces:
exilesprx/blockchain:bank-1.0.0exilesprx/blockchain:miner-1.0.0