Run it locally
This page brings up the whole of DigiFIR on one developer machine: the Fabric network, the four chaincodes, the backend and an app. It takes about 15 minutes the first time.
Prerequisites
- Linux or macOS with bash, Docker with Compose v2 (give Docker 4 GB of memory), and about 16 GB of RAM.
- Node.js 22.12 or newer and
openssl. - Go 1.27.3, or any Go that can fetch it with
GOTOOLCHAIN=go1.27.3. - Flutter for the apps; Dart 3.13 for the Dart SDK.
- The seven repositories side by side in one folder (see Repositories).
1. Start the network
cd digifir-network
./scripts/network.sh up # 5 CAs, 3 orderers, 6 peers, 6 CouchDB (about 1 minute)
./scripts/network.sh createChannel # channel firnationalTo check the network on its own, ./scripts/network.sh all also deploys a sample chaincode and runs the 53-check smoke test.
2. Deploy the chaincodes and bootstrap them
cd ../digifir-chaincode
make deploy-dev # builds and deploys the four chaincodes (about 3 minutes)
cd integration && DIGIFIR_INTEGRATION=1 go test -count=1 -run '^TestBootstrap$' ./...The bootstrap initialises the network on the ledger, onboards both states, and creates registrars, gateway keys, reference data, officials and a test citizen. It can be run again safely.
3. Run the backend
cd ../digifir-backend
npm ci
npm run deps:up # PostgreSQL 16, Redis 7, SeaweedFS
npm run migrate
scripts/dev-network-env.sh -o .env.network # the network profile: gateways, peers, TLS material
npm run dev:network # api on :8080, projector and worker
curl http://127.0.0.1:8080/healthzEvery setting has a development default, and every outside system runs on its simulator. Without a network profile the backend still starts, but answers every write with 503 NOT_CONFIGURED. Nothing pretends a transaction committed.
| Process | Port |
|---|---|
| api | 8080 (REST and events), 9464 (health and metrics) |
| projector | 9465 (health and metrics) |
| worker | 9466 (health and metrics) |
4. Run an app
Each app runs in demo mode with no backend at all, which is the quickest way to see it:
cd ../digifir-police-app
flutter pub get
flutter run --dart-define=BACKEND=demoTo run it against your local backend instead, give the backend's address:
flutter run --dart-define=API_BASE_URL=http://10.0.2.2:808010.0.2.2 is the host machine as seen from the Android emulator; on a desktop or iOS simulator use http://127.0.0.1:8080. Debug builds may use plain HTTP; release builds need HTTPS. Each app's docs/03-backend-setup.md and docs/06-local-backend.md (the police app: 05-local-backend.md) have the details, including test identities for the citizen app (--dart-define=IDENTITY_SIMULATOR=true).
The citizen web portal:
cd ../digiFIR-citizen-app/portal
npm ci
npm run dev # http://localhost:5173, demo mode without a backend address5. Watch it
cd ../digifir-network
./scripts/network.sh monitor up # Grafana on http://localhost:3000
./scripts/network.sh status # containers, health, Raft leader, heights, chaincodesRun monitor up again after starting the backend so its processes are scraped too.
Run the test suites
| Suite | Command |
|---|---|
| Backend unit and integration | npm test in digifir-backend |
| Backend on the network | npm run smoke:network, DIGIFIR_NETWORK=1 npm run e2e:network, DIGIFIR_NETWORK=1 npm run load:network |
| Chaincode | make test; make integration (about 22 minutes from nothing) |
| Network | ./scripts/network.sh smoke; ./scripts/network.sh monitor check |
| Apps | flutter test in each app |
Tear it down
cd digifir-network
./scripts/network.sh down # containers, volumes, crypto, channel artefacts
cd ../digifir-backend && npm run deps:downCAUTION
The development network uses well-known passwords and keeps private keys in plain files. It publishes its ports on 127.0.0.1 only. Never expose it to another network.
Sources: digifir-network README.md; digifir-chaincode README.md; digifir-backend README.md, docs/DEVELOPMENT.md, docs/NETWORK.md; each app's docs/02-run-the-app.md on the migration branch.