Skip to main content

Development Setup

This page gets you from zero to a verified local development environment for contributing to the Bike4Mind open core. For the full contribution process (CLA, issue-first workflow, PR requirements), read the repo's Contributing Guide.

Prerequisites

  • Git
  • Node.js 24.x (see .nvmrc - use nvm use)
  • pnpm (npm install -g pnpm)
  • Docker (for running MongoDB locally via compose.yaml)
  • Gitleaks (brew install gitleaks or your package manager) - used by the pre-commit hook

Install, build, verify

# 1. Fork the repo on GitHub, then:
git clone git@github.com:<your-username>/bike4mind.git
cd bike4mind
git remote add upstream git@github.com:bike4mind/bike4mind.git

# 2. Install dependencies (all workspaces)
pnpm i -r

# 3. Install the git hooks (gitleaks secret scan + lint-staged)
./install-hooks.sh

# 4. Build the core packages (dependency-ordered, cached)
pnpm turbo:core:build

# 5. Verify your environment works before changing anything
pnpm turbo:typecheck # TypeScript across all packages
pnpm turbo:test # all test suites (MongoDB tests use mongodb-memory-server - no local DB needed)
pnpm lint:check # ESLint, error severity only (mirrors the CI gate)

If all three pass on a clean checkout, you're ready. Most contributions can be fully developed and validated with just typecheck + tests + lint - you do not need AWS access or a running full stack to fix a bug in the engine, adapters, or data models.

To run the full application locally (needed for UI work), see Self-Hosting. compose.yaml provides a local MongoDB replica set (docker compose up db).

Where the code lives

├── apps/
│ ├── client/ # Next.js app - SPA (Tanstack Router) + API routes
│ │ └── server/ # Backend service code behind the API routes
│ ├── cli/ # B4M CLI - edge agent
│ └── subscriber-fanout/ # Real-time WebSocket fanout
├── b4m-core/ # The core engine - published as @bike4mind/* npm packages
│ ├── agents/ services/ utils/ common/ # Agent framework
│ ├── llm-adapters/ # Anthropic, OpenAI, Gemini, X.ai, Ollama adapters
│ └── mcp/ slack/ voice/ ... # Capabilities
├── packages/
│ └── database/ # Mongoose models & migrations
├── docs-site/ # This documentation
└── infra/ # SST/AWS infrastructure

Quick orientation for common contribution targets:

I want to work on...Start in
Agent behavior, tools, ReAct loopb4m-core/agents, and see Agents
A new LLM providerb4m-core/llm-adapters
The CLIapps/cli, and see CLI docs
API routes / backendapps/client/server, and see API docs
Data modelspackages/database
These docsdocs-site/

Build order for core packages: common → utils → agents → services → slack (handled automatically by pnpm turbo:core:build).

Useful commands

TaskCommandNotes
Typecheck (fast)pnpm turbo:typecheckCached
Run all testspnpm turbo:testParallel across packages
Test one packagepnpm --filter <package> teste.g. pnpm --filter @bike4mind/agents test
Lintpnpm lint:checkMirrors CI
Build core packagespnpm turbo:core:buildAdd --force if builds seem stale
warning

Do not run unfiltered turbo build - it attempts to build the SST-managed apps outside their deploy context and will fail. If you see unexpected type errors after pulling from main, rebuild: pnpm i -r && pnpm turbo:core:build.

Next steps