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.


The fastest way to get a localized demo running or to develop on native Linux is to use our pre-configured VS Code Dev Container. While native host setups are recommended for OS-agnostic builds (like compiling native Windows .exe or macOS .app/.dmg installers), the Dev Container provides a zero-install sandbox that comes pre-configured with all tools and background services.

  • Docker (Desktop or Engine) installed and running.
  • VS Code with the Dev Containers extension installed.
  1. Open in VS Code: Open the cloned repository root folder in VS Code.
  2. Reopen in Container: When prompted, click Reopen in Container (or run Dev Containers: Reopen in Container from the Command Palette).
  3. Automatic Provisioning: The container will build, configure itself, install dependencies, and run all background sidecars (Postgres, Redis, NATS, k3s) automatically.
  4. Running the Server inside the Dev Container:
    • Monolithic (Indie) Mode:
      Terminal window
      m dev --procfile=monolith.devcontainer.Procfile --env-file=monolith.devcontainer.env --no-backend --port=8000
    • Distributed (Enterprise) Mode:
      Terminal window
      m dev --procfile=macroservices.devcontainer.Procfile --env-file=macroservices.devcontainer.env --port=8000 --no-backend

Section titled “2. Native Host Setup (Recommended for packaging)”

To develop across operating systems natively—which is required to build and package native Windows (.exe), macOS (.app/.dmg), and Linux (.deb) installers natively via Tauri—configure your native host machine directly:

Verify that your development machine has the following tools installed:

  • Operating System: Linux, macOS, or Windows (All platforms natively supported for development, execution, and packaging).
  • 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 (macOS/Linux):
    Terminal window
    source .venv/bin/activate
  • Fish Shell (macOS/Linux):
    Terminal window
    . ./.venv/bin/activate.fish
  • PowerShell (Windows):
    Terminal window
    .venv\Scripts\Activate.ps1
  • Command Prompt (Windows):
    Terminal window
    .venv\Scripts\activate.bat

Install workspace-wide node packages:

Terminal window
pnpm install

4. Provisioning the Engine Layer & Services (Local Host)

Section titled “4. Provisioning the Engine Layer & Services (Local Host)”

4.1 Quick Setup: Docker Compose Engine Stack

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

To simplify local host development, we package the entire localized infrastructure Engine Layer (including PostgreSQL, Redis, and NATS) into a single Docker Compose context.

To spin up all services instantly, run:

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

Manual database creation is not required.

4.2 Fallback: Native Host Service Deployment

Section titled “4.2 Fallback: Native Host Service Deployment”

If running Docker is a challenge on your development machine, you can run the engines natively on your host:

  1. Install the Core Engines: PostgreSQL, Redis, and NATS.
  2. Verify Ports: Ensure these native processes are active on their standard ports:
    • PostgreSQL: 5432
    • Redis: 6379
    • NATS: 4222

Launch the development orchestrator CLI specifying the desired local deployment track:

To run all modules inside a single process on your host:

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 on your host:

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

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 and security standards across the codebase using the high-level verification commands provided by m studio CLI:

  • Code Formatting (ruff format):
    Terminal window
    m format
  • Linting & Style Checks (ruff lint):
    Terminal window
    m lint
  • Static Type Checking (mypy / typecheckers):
    Terminal window
    m typecheck
  • Security Vulnerability Audits (bandit):
    Terminal window
    m security