Installation and Setup
Installation and Setup
Section titled “Installation and Setup”TL;DR: Install prerequisites, start Docker containers, and verify your development environment is running.
Overview
Section titled “Overview”This guide walks you through setting up a complete local development environment for the Banyan Platform. In just a few minutes, you’ll have all infrastructure services running and ready for development.
What You’ll Learn
Section titled “What You’ll Learn”- How to install required development tools
- How to start the platform infrastructure services
- How to verify your environment is working correctly
- How to access monitoring and debugging tools
Prerequisites
Section titled “Prerequisites”Before you begin, ensure you have:
- Node.js 20.x or higher - JavaScript runtime
- Docker 20.x or higher - Container platform
- Docker Compose 2.x or higher - Multi-container orchestration
- pnpm 8.x or higher - Package manager
Quick Start
Section titled “Quick Start”If you already have all prerequisites installed:
# Clone repositorygit clone https://github.com/yourusername/banyan-core.gitcd banyan-core
# Start infrastructuredocker compose up -d
# Install dependenciespnpm install
# Build platformpnpm run buildYou’re ready! Skip to Verify Your Setup to confirm everything works.
Step 1: Install Prerequisites
Section titled “Step 1: Install Prerequisites”Check Current Versions
Section titled “Check Current Versions”First, verify which tools you already have:
node --version # Should show v20.x or higherpnpm --version # Should show 8.x or higherdocker --version # Should show 20.x or higherdocker compose version # Should show 2.x or higherInstall Node.js 20
Section titled “Install Node.js 20”If you need to install or upgrade Node.js:
Using nvm (recommended):
# Install nvm if you don't have itcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node.js 20nvm install 20nvm use 20Or download directly:
- Visit nodejs.org
- Download the LTS version (20.x)
- Follow installation instructions for your OS
Install pnpm
Section titled “Install pnpm”npm install -g pnpmInstall Docker
Section titled “Install Docker”Linux:
# Follow official Docker installation guide# https://docs.docker.com/engine/install/
# Install Docker Compose pluginsudo apt-get updatesudo apt-get install docker-compose-pluginmacOS:
- Download Docker Desktop for Mac
- Docker Compose is included
Windows:
- Download Docker Desktop for Windows
- Docker Compose is included
Verify
Section titled “Verify”Confirm all tools are installed:
node --version # v20.11.0 or higherpnpm --version # 8.15.0 or higherdocker --version # 24.0.0 or higherdocker compose version # 2.20.0 or higherStep 2: Clone the Repository
Section titled “Step 2: Clone the Repository”# Clone the repositorygit clone https://github.com/yourusername/banyan-core.git
# Navigate into the directorycd banyan-coreVerify
Section titled “Verify”ls -laYou should see:
docker-compose.ymlpackage.jsonpnpm-workspace.yamlplatform/docs/Step 3: Start Infrastructure Services
Section titled “Step 3: Start Infrastructure Services”The Banyan Platform requires several infrastructure services. Docker Compose starts them all with one command:
docker compose up -dThis starts:
- RabbitMQ - Message bus for service communication
- PostgreSQL - Event store database
- Redis - Cache and session storage
- Jaeger - Distributed tracing UI
- Prometheus - Metrics collection
- Grafana - Metrics dashboards
- DevBox - Development container with all tools
Verify
Section titled “Verify”Check all containers are running:
docker compose psExpected output:
NAME STATUSrabbitmq Up 10 secondspostgres Up 10 secondsredis Up 10 secondsjaeger Up 10 secondsprometheus Up 10 secondsgrafana Up 10 secondsdevbox Up 10 secondsAll services should show “Up” status.
Access Web Interfaces
Section titled “Access Web Interfaces”Open these URLs in your browser to verify services are accessible:
RabbitMQ Management Console:
- URL: http://localhost:55672
- Username:
admin - Password:
admin123 - You should see the RabbitMQ dashboard
Jaeger Tracing UI:
- URL: http://localhost:16686
- You should see the Jaeger search interface
Grafana Dashboards:
- URL: http://localhost:5005
- Username:
admin - Password:
admin - You should see the Grafana home page
Prometheus Metrics:
- URL: http://localhost:9090
- You should see the Prometheus query interface
Step 4: Configure GitHub Packages Authentication
Section titled “Step 4: Configure GitHub Packages Authentication”The Banyan Platform packages are published to GitHub Packages (not the public npm registry). You need to configure authentication before installing dependencies.
Create GitHub Personal Access Token
Section titled “Create GitHub Personal Access Token”- Go to GitHub Settings → Developer Settings → Personal Access Tokens
- Click “Generate new token (classic)”
- Give it a descriptive name (e.g., “Banyan Platform Development”)
- Select the
read:packagesscope - Click “Generate token”
- Copy the token (you won’t be able to see it again)
Configure .npmrc File
Section titled “Configure .npmrc File”Create or update the .npmrc file in your project root (not your home directory):
# From repository rootcat > .npmrc << 'EOF'@banyanai:registry=https://npm.pkg.github.com//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}EOFSet Environment Variable
Section titled “Set Environment Variable”Option A: Temporary (current session only)
export NODE_AUTH_TOKEN=your_github_token_hereOption B: Permanent (recommended)
Add to your shell configuration file:
# For bash (~/.bashrc)echo 'export NODE_AUTH_TOKEN=your_github_token_here' >> ~/.bashrcsource ~/.bashrc
# For zsh (~/.zshrc)echo 'export NODE_AUTH_TOKEN=your_github_token_here' >> ~/.zshrcsource ~/.zshrcImportant Security Notes:
- Never commit
.npmrcfiles with hardcoded tokens to version control - The
.npmrcin this repository uses${NODE_AUTH_TOKEN}which safely reads from environment - Keep your GitHub token secure and rotate it periodically
Alternative: Hardcoded Token (Not Recommended)
Section titled “Alternative: Hardcoded Token (Not Recommended)”If you’re working on a secure local machine, you can hardcode the token:
# .npmrc (DO NOT COMMIT THIS)@banyanai:registry=https://npm.pkg.github.com//npm.pkg.github.com/:_authToken=ghp_yourActualTokenHere⚠️ Warning: Never commit this file if it contains a hardcoded token!
Step 5: Install Platform Dependencies
Section titled “Step 5: Install Platform Dependencies”Now that authentication is configured, install dependencies:
# From repository rootpnpm installThis installs:
- All platform package dependencies from GitHub Packages
- All service dependencies
- Development tools (TypeScript, Jest, Biome)
Verify
Section titled “Verify”ls -la node_modules/@banyanai/You should see platform packages:
platform-base-service/platform-core/platform-cqrs/platform-event-sourcing/platform-telemetry/Troubleshooting Installation
Section titled “Troubleshooting Installation”Problem: 401 Unauthorized error during installation
Solution: Check your authentication setup
# Verify NODE_AUTH_TOKEN is setecho $NODE_AUTH_TOKEN
# Should output your token (not empty)# If empty, set it:export NODE_AUTH_TOKEN=your_github_token_here
# Retry installationpnpm installProblem: 404 Not Found for packages
Solution: Verify .npmrc configuration
# Check .npmrc file existscat .npmrc
# Should contain:# @banyanai:registry=https://npm.pkg.github.com# //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
# If missing, recreate it (see Step 4)Problem: Token permissions insufficient
Solution: Ensure your GitHub token has read:packages scope
- Go to GitHub Token Settings
- Click on your token
- Verify
read:packagesis checked - If not, regenerate token with correct scope
Step 6: Build the Platform
Section titled “Step 6: Build the Platform”# Build all packages and servicespnpm run buildBuild order matters but pnpm workspace handles it automatically:
core → domain-modeling → contract-system → telemetry →message-bus-client → cqrs → event-sourcing →client-system → base-serviceThis takes 1-2 minutes on first build.
Verify
Section titled “Verify”ls -la platform/packages/core/dist/You should see compiled JavaScript files:
index.jsindex.d.tsinterfaces.jstypes.jsVerify Your Setup
Section titled “Verify Your Setup”Run a comprehensive check to ensure everything works:
# Check TypeScript compilationpnpm run type-check
# Run platform testspnpm run test
# Check services can startdocker compose logs rabbitmqdocker compose logs postgresExpected results:
- type-check: No TypeScript errors
- test: All tests pass
- logs: Services show “ready to accept connections”
Next Steps
Section titled “Next Steps”Now that your environment is set up, you can:
- Create Your First Service - Build a simple microservice in 10 minutes
- Development Workflow - Learn daily development patterns
- Platform Architecture - Understand how the platform works
Common Issues
Section titled “Common Issues”Docker Compose Won’t Start
Section titled “Docker Compose Won’t Start”Problem: Services fail to start with port conflicts
Solution: Check if ports are already in use
# Find process using portlsof -i :55671lsof -i :55432
# Either kill the process or change ports in docker-compose.ymlpnpm Install Fails
Section titled “pnpm Install Fails”Problem: pnpm install shows dependency resolution errors
Solution: Clear cache and reinstall
pnpm store prunerm -rf node_modulespnpm installBuild Errors
Section titled “Build Errors”Problem: TypeScript compilation errors during build
Solution: Clean and rebuild from scratch
pnpm run cleanpnpm installpnpm run buildFor more help, see Troubleshooting Guide.
RabbitMQ Connection Issues
Section titled “RabbitMQ Connection Issues”Problem: Cannot connect to RabbitMQ
Solution: Verify RabbitMQ is running and accessible
# Check RabbitMQ container statusdocker compose ps rabbitmq
# View RabbitMQ logsdocker compose logs rabbitmq
# Restart RabbitMQdocker compose restart rabbitmqCheck connection URLs:
- From host machine:
amqp://admin:admin123@localhost:55671 - From inside Docker:
amqp://admin:admin123@rabbitmq:5672
PostgreSQL Connection Issues
Section titled “PostgreSQL Connection Issues”Problem: Database connection failed
Solution: Verify PostgreSQL is running
# Check PostgreSQL containerdocker compose ps postgres
# Test connectiondocker compose exec postgres psql -U actor_user -d eventstoreIf successful, you should see the PostgreSQL prompt:
eventstore=#Type \q to exit.
Additional Resources
Section titled “Additional Resources”- Docker Compose Documentation
- pnpm Workspace Guide
- Node.js Installation Guide
- Platform Development Guide
Development Tips
Section titled “Development Tips”Fast Container Restarts
Section titled “Fast Container Restarts”# Restart specific servicedocker compose restart rabbitmq
# View logs for specific servicedocker compose logs -f postgres
# Stop all servicesdocker compose down
# Start with fresh statedocker compose down -v # Removes volumesdocker compose up -dAccessing the DevBox Container
Section titled “Accessing the DevBox Container”The DevBox is a containerized development environment with all tools pre-installed and all platform services accessible. It’s the recommended way to build and test the platform.
# Enter DevBox containerdocker compose exec devbox /bin/bash
# Inside container you have:# - Node.js 20, pnpm, TypeScript# - All build and development tools# - Access to RabbitMQ, PostgreSQL, Redis, Jaeger# - Your workspace mounted at /workspace with hot-reloadWhy use DevBox:
- ✅ Zero local setup - no need to install Node.js or dependencies
- ✅ Matches CI environment exactly
- ✅ All services ready for integration testing
- ✅ Isolated from your local system
See the DevBox Development Guide for comprehensive usage, examples, and best practices.
Environment Variables
Section titled “Environment Variables”Default development environment variables are set in docker-compose.yml. To override locally, create a .env file:
NODE_ENV=developmentRABBITMQ_URL=amqp://admin:admin123@localhost:55671POSTGRES_URL=postgresql://actor_user:actor_pass123@localhost:55432/eventstoreREDIS_URL=redis://:redis123@localhost:56379LOG_LEVEL=debugImportant: Never commit .env files with secrets to version control.