Skip to content

Build System

The monorepo is orchestrated by a root Makefile (~750 lines). All build, lint, dev, deploy, and database operations go through it.

Run make help for the full target list.

Package Dependency Graph

make build runs build-3rd first, then build-packages in the order shown above.

Setup

TargetCommandPurpose
make installbun install + gateway portal installInstall all workspace dependencies
make cleanbun run --filter "*" cleanRemove dist/ from all packages
make purgefind . -name node_modules -exec rm -rfDelete all node_modules (nuclear option)
make setup-toolsgit config core.hooksPath .githooksEnable project git hooks
make rebuildpurge → clean → install → buildFull clean rebuild from scratch

Build Targets

Aggregate

TargetWhat it builds
make buildEverything (alias for build-all)
make build-allbuild-3rd then build-packages
make build-packagesAll packages/* in dependency order
make build-3rdAll third-parties/* (iiapi, mq-pay, mq-sms, t-van)

Individual packages

Each target automatically builds its dependencies first (via Makefile prerequisites).

TargetDependenciesPackage
make core-@nx/core
make assetcore@nx/asset
make searchcore@nx/search
make identitycore, mq-sms@nx/identity
make inventorycore@nx/inventory
make financecore@nx/finance
make outreachcore@nx/outreach
make ledgercore, asset@nx/ledger
make pricingcore@nx/pricing
make taxationcore@nx/taxation
make commerceasset, search@nx/commerce
make salecore@nx/sale
make paymentcore, mq-pay@nx/payment
make signalcore@nx/signal
make licensingcore@nx/licensing

Third-parties

TargetPackage
make iiapi@nx/iiapi
make mq-pay@nx/mq-pay
make mq-sms@nx/mq-sms
make t-van@nx/t-van

Frontend apps

TargetPackage
make bo@nx-app/bo
make client@nx-app/client
make overture@nx-app/overture
make app-core@nx-app/core

Frontend builds run bun run apps:rebuild first (rebuilds shared app libraries), then the app-specific build.

Per-Package Build Internals

Every backend package has identical build scripts:

bash
bun run rebuild     # → scripts/rebuild.sh → clean.sh + compile.sh
bun run build       # → scripts/build.sh
bun run compile     # → scripts/compile.sh (tsc + tsc-alias)
bun run clean       # → scripts/clean.sh (rm -rf dist/)

Always use bun run rebuild or make <pkg>

Never invoke tsc or npx directly. The build uses tsc-alias to resolve path aliases like @/services to relative paths in the compiled output. Raw tsc produces broken imports.

Compile (Standalone Binaries)

Bun can compile services into single-file executables:

TargetBuilds firstOutput
make compile-commercecommercepackages/commerce/dist/bin/
make compile-financefinancepackages/finance/dist/bin/
make compile-identityidentitypackages/identity/dist/bin/
make compile-inventoryinventorypackages/inventory/dist/bin/
make compile-paymentpaymentpackages/payment/dist/bin/
make compile-pricingpricingpackages/pricing/dist/bin/
make compile-salesalepackages/sale/dist/bin/
make compile-signalsignalpackages/signal/dist/bin/
make compile-ledgerledgerpackages/ledger/dist/bin/
make compile-licensinglicensingpackages/licensing/dist/bin/
make compile-outreachoutreachpackages/outreach/dist/bin/

Docker

Build Docker images for deployment:

bash
# Current version
make docker pkg=identity

# Bump patch version (0.0.1 → 0.0.2) then build
make docker pkg=identity v=patch

# Set explicit version
make docker pkg=identity v=0.2.0

# Bump prerelease (0.0.1 → 0.0.1-1)
make docker pkg=identity v=pre

# Build with tag only (no package.json change)
make docker pkg=identity tag=0.0.1-2

# Build ALL images
make docker-all

Available package names: identity, commerce, sale, finance, inventory, ledger, payment, pricing, signal.

The build script is at scripts/build-docker.sh. Images are pushed to the project's container registry.

Lint

TargetScope
make lintEverything (alias for lint-all)
make lint-alllint-apps + lint-packages + lint-3rd + lint-docs
make lint-appsAll apps/*
make lint-packagesAll packages/*
make lint-3rdAll third-parties/*
make lint-docsAll docs/*
make lint-wiki@nexpando/eventry-docs only
make lint-packages-fixAuto-fix all packages
make lint-<package>Single package (e.g. lint-identity, lint-commerce)
make lint-app-<app>Single app (e.g. lint-app-client, lint-app-bo)

Pass --elide-lines=0 to a bun run command for verbose (un-elided) output in a terminal. Note: this flag only works in a TTY and errors in CI, so the Makefile does not use it.

Dev Servers

TargetServicePort
make dev-identityIdentity31010
make dev-commerceCommerce31020
make dev-saleSale31030
make dev-financeFinance31040
make dev-inventoryInventory31050
make dev-ledgerLedger31060
make dev-pricingPricing31070
make dev-paymentPayment31080
make dev-signalSignal31090
make dev-outreachOutreach31110
make dev-taxationTaxation31130
make dev-app-boBack Office3000
make dev-app-clientAdmin Dashboard3001
make dev-overtureMarketing Site4321
make dev-portalGateway Portal-
make dev-wikiThis documentation5175

Database

TargetUsage
make db-generate schema=<name> env=<env>Generate migration SQL for a schema
make db-generate-all env=developmentGenerate migrations for all 14 schemas
make db-migrate schema=<name> env=<env>Apply migrations for a schema
make db-migrate-all env=developmentApply migrations for all schemas
make db-migrate-<pkg>-devDev seed migration for one package (e.g. db-migrate-ledger-dev)

Schema names: allocation, finance, helpdesk, identity, inventory, invoice, ledger, licensing, outreach, payment, pricing, public, sale, tax

Database commands run in packages/core which owns the shared Drizzle ORM schema definitions.

Deploy (Dev Server)

TargetDeploys
make deploy-develop-infraInfrastructure dependencies
make deploy-develop-gatewayTraefik gateway
make deploy-develop-backend-servicesAll backend services (identity through licensing)
make deploy-develop-<service>Individual service (e.g. deploy-develop-identity)
make deploy-develop-clientAdmin dashboard
make deploy-develop-boBack office
make deploy-develop-overtureMarketing site
make deploy-develop-wikiDocumentation
make deploy-develop-prototypesDesign prototypes

Deploy scripts live in infrastructure/deployments/develop/scripts/.

Benchmark

TargetPurpose
make benchmark-ledgerRun PDF + XLSX generation benchmark for all 6 ledger types

Git Hooks

TargetPurpose
make setup-toolsConfigure git to use .githooks/
make pre-commitRun all linting checks (used by pre-commit hook)
PageDescription
Getting StartedFirst-time setup walkthrough
Environment ReferenceAll environment variables
Git WorkflowBranch naming, commits, MRs

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.