Skip to content

Developer Setup Guide

Welcome to the Business M Developer Guide. This runbook walks you through configuring your local development environment to run both our modular monolithic core and decoupled macroservice configurations.


Verify that your development machine has the following tools installed:

  • Operating System: Linux (Ubuntu/Debian recommended), macOS, or Windows (WSL2 required).
  • Python 3.12+: Asynchronous runtime environment.
  • uv: Ultra-fast Python package and environment manager. Install uv.
  • Node.js LTS (v24): Required to compile frontends and Vite federation bundles.
  • pnpm: Required to manage node packages (npm install -g pnpm).
  • PostgreSQL LTS: Relational storage engine.

Clone the monorepo from GitLab and navigate to the workspace root:

Terminal window
git clone https://gitlab.com/castlecraft/business-m
cd business-m

Setting up your virtual environment and installing all package dependencies happens in a single command:

Terminal window
uv sync

This creates a unified .venv virtual environment in the workspace root and installs dependencies for all sub-libraries (libs/*) and applications (apps/*) in editable mode.

  • Bash / Zsh:
    Terminal window
    source .venv/bin/activate
  • Fish Shell:
    Terminal window
    . ./.venv/bin/activate.fish

Install workspace-wide node packages:

Terminal window
pnpm install

3. Provisioning the Engine Layer & Services

Section titled “3. Provisioning the Engine Layer & Services”

3.1 Quick Setup: Docker Compose Engine Stack

Section titled “3.1 Quick Setup: Docker Compose Engine Stack”

To simplify development, we package the entire localized infrastructure Engine Layer (including PostgreSQL for relational metadata, Redis for state caching, and NATS for event messaging) into a single, light Docker Compose context.

To spin up all services instantly, run:

Terminal window
docker compose -f dev.compose.yml up -d

Manual database creation is not required. All domain applications automatically share this unified PostgreSQL instance, and their tables will not conflict because they are dynamically isolated and prefixed by their respective domain modules.

3.2 Fallback: Native Host Service Deployment

Section titled “3.2 Fallback: Native Host Service Deployment”

If running Docker is a challenge on your development machine (e.g., due to specific Windows / WSL2 virtualization constraints or resource limits), you can easily choose to run the engines natively on your host:

  1. Install the Core Engines:
    • PostgreSQL: Install PostgreSQL locally and verify the service is running.
    • Redis: Install and start the Redis server locally.
    • NATS Server: Install and launch the NATS server.
  2. Verify Ports: Ensure these native processes are active on their standard ports:
    • PostgreSQL: 5432
    • Redis: 6379
    • NATS: 4222

No database schema configurations are needed; our migrations automatically target these default local ports.

For local execution, the environment variables and multi-process runners are pre-configured:

  • Use monolith.env and monolith.Procfile for monolithic (Indie) mode.
  • Use macroservices.env and macroservices.Procfile for distributed (Enterprise) macroservice mode.

No manual .env file editing or database configuration is necessary for the default local environment.


Launch the development orchestrator CLI specifying the desired deployment track:

To run all modules inside a single process:

Terminal window
m dev --procfile=monolith.Procfile --env-file=monolith.env --no-backend --port=8000

To run domain services as decoupled out-of-process macroservices:

Terminal window
m dev --procfile=macroservices.Procfile --env-file=macroservices.env --port=8000 --no-backend
  • Development Portal URL: http://localhost:5173 (The host Vite development server remains the same on port 5173 for both monolithic and macroservice development modes for development)

The m CLI provides built-in code scaffolding templates.

  • Scaffold a new App:
    Terminal window
    m new app my_custom_app
  • Scaffold a new DocType model:
    Terminal window
    m new doctype MyFeatureSchema --app business_m
  • Scaffold a new frontend panel:
    Terminal window
    m new frontend my_custom_frontend

To execute unit and integration test suites workspace-wide:

Terminal window
uv run pytest

To run localized tests within a specific sub-package:

Terminal window
cd libs/finance
uv run pytest

We enforce quality standards via ruff for Python files:

Terminal window
uv run ruff check .
uv run ruff format .