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)

Use --elide-lines=0 for verbose output (the Makefile already does this for lint-packages and dev-* targets).

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-boBack Office5174
make dev-clientAdmin Dashboard5173
make dev-overtureMarketing Site4321
make dev-portalGateway Portal
make dev-wikiThis documentation5175

Database

TargetUsage
make db-generate schema=<name>Generate migration SQL for a schema
make db-generate-allGenerate migrations for all 8 schemas
make db-migrate schema=<name>Apply migrations for a schema
make db-migrate-allApply migrations for all schemas
make db-migrate-package-dev package=<name>Run per-package migration in dev mode
make db-migrate-ledger-devShortcut for ledger dev migration

Schema names: public, pricing, allocation, sale, inventory, finance, payment, ledger

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

Deploy (Dev Server)

TargetDeploys
make deploy-dev-depsInfrastructure dependencies
make deploy-dev-gatewayTraefik gateway
make deploy-dev-backend-servicesAll backend services (identity through licensing)
make deploy-dev-<service>Individual service (e.g. deploy-dev-identity)
make deploy-dev-clientAdmin dashboard
make deploy-dev-boBack office
make deploy-dev-overtureMarketing site
make deploy-dev-wikiDocumentation
make deploy-dev-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.