MATIH Platform is in active MVP development. Documentation reflects current implementation status.
4. Installation & Setup
Local Development Setup

Local Development Setup

This guide walks you through setting up the MATIH Platform on your local machine for development. The local environment uses Docker Compose for infrastructure services and supports multiple development profiles depending on which components you need.


Development Profiles

MATIH supports several profiles to balance resource usage with the components you need:

ProfileComponentsRAM UsageBest For
minimalPostgreSQL, Redis, Kafka~4 GBBackend service development
dataMinimal + StarRocks, MinIO~8 GBQuery engine, data pipeline work
aiMinimal + AI service dependencies~6 GBAI/ML service development
fullAll infrastructure services~12 GBIntegration testing, full-stack development

Step 1: Clone and Explore the Repository

# Clone the repository
git clone https://github.com/your-org/matih-prototype.git
cd matih-prototype
 
# Explore the project structure
ls -la

Key directories:

DirectoryContents
control-plane/Java Spring Boot services (IAM, tenant, config, etc.)
data-plane/Data Plane services (AI, ML, query engine, etc.)
frontend/React/TypeScript workbench applications
infrastructure/Helm charts, Terraform modules, Kubernetes manifests
scripts/Build, deploy, and utility scripts
local/Local development configurations
commons/Shared libraries (Java, Python, TypeScript)

Step 2: Start Infrastructure Services

Use the local/matih CLI to start the infrastructure services:

# Start with minimal profile (PostgreSQL, Redis, Kafka)
./local/matih start --profile minimal
 
# Start with full profile (all services)
./local/matih start --profile full

Alternatively, use Docker Compose directly:

# Start infrastructure services
docker-compose up -d
 
# Check running containers
docker-compose ps
 
# View logs
docker-compose logs -f

Infrastructure Service Ports

ServicePortURL
PostgreSQL5432postgresql://localhost:5432
Redis6379redis://localhost:6379
Kafka29092localhost:29092
Kafka UI8090http://localhost:8090
MinIO9000 / 9001http://localhost:9000 (API), http://localhost:9001 (console)
Dgraph Alpha8080 / 9080http://localhost:8080 (HTTP), localhost:9080 (gRPC)
Dgraph Ratel8000http://localhost:8000

Step 3: Build the Platform

Build Everything

# Full build (all services, all tests)
./scripts/build.sh
 
# Build with tests skipped (faster for development)
./scripts/build.sh --skip-tests

Build by Language

# Build only Java services (Control Plane)
./scripts/build.sh --java
 
# Build only Python services (AI, ML, Data Quality)
./scripts/build.sh --python
 
# Run tests only
./scripts/build.sh --test-only --with-deps

Build a Single Service

# Build and deploy a specific service
./scripts/tools/service-build-deploy.sh ai-service
 
# Full rebuild of a specific service
./scripts/tools/full-service-rebuild.sh ai-service

Step 4: Build Base Images

Some services share base Docker images. Build these first:

./scripts/tools/build-base-images.sh

This builds the shared base images that provide common dependencies for Java, Python, and Node.js services.


Step 5: Set Up Databases

Initialize the database schemas for all services:

./scripts/tools/setup-databases.sh

This script creates the required databases and schemas in PostgreSQL:

DatabasePurpose
matih_control_planeControl plane services (IAM, tenant, config, etc.)
matih_ai_serviceAI service data
matih_ml_serviceML service and MLflow data
matih_query_engineQuery engine metadata
matih_catalogData catalog metadata
matih_pipelinePipeline definitions and execution state

Step 6: Run Control Plane Services

Control Plane services are Java Spring Boot applications. Run them using Gradle:

# Run the IAM service
cd control-plane/iam-service
./gradlew bootRun
 
# Run the tenant service (in another terminal)
cd control-plane/tenant-service
./gradlew bootRun
 
# Run the config service
cd control-plane/config-service
./gradlew bootRun

Control Plane Service Ports

ServicePortHealth Check
api-gateway8080http://localhost:8080/actuator/health
iam-service8081http://localhost:8081/actuator/health
tenant-service8082http://localhost:8082/actuator/health
platform-registry8084http://localhost:8084/actuator/health
notification-service8085http://localhost:8085/actuator/health
audit-service8086http://localhost:8086/actuator/health
billing-service8087http://localhost:8087/actuator/health
observability-api8088http://localhost:8088/actuator/health
infrastructure-service8089http://localhost:8089/actuator/health
config-service8888http://localhost:8888/actuator/health

Step 7: Run Data Plane Services

AI Service (Python)

cd data-plane/ai-service
 
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
 
# Install dependencies
pip install -r requirements.txt
 
# Run the service
uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload

ML Service (Python)

cd data-plane/ml-service
 
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
 
uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload

Query Engine (Java)

cd data-plane/query-engine
./gradlew bootRun

Step 8: Run Frontend Workbenches

Install Frontend Dependencies

# Install shared dependencies
cd frontend/shared
pnpm install
 
# Install workbench dependencies
cd ../bi-workbench
pnpm install

Start a Workbench

# BI Workbench (port 3000)
cd frontend/bi-workbench
pnpm dev
 
# ML Workbench (port 3001)
cd frontend/ml-workbench
pnpm dev
 
# Data Workbench (port 3002)
cd frontend/data-workbench
pnpm dev
 
# Agentic Workbench (port 3003)
cd frontend/agentic-workbench
pnpm dev
 
# Control Plane UI (port 3004)
cd frontend/control-plane-ui
pnpm dev

Frontend Port Summary

WorkbenchPortURL
BI Workbench3000http://localhost:3000
ML Workbench3001http://localhost:3001
Data Workbench3002http://localhost:3002
Agentic Workbench3003http://localhost:3003
Control Plane UI3004http://localhost:3004
Data Plane UI3005http://localhost:3005

Environment Variables

Create a .env file in the project root for local development (this file is gitignored):

# Database
DATABASE_URL=postgresql://matih:password@localhost:5432/matih_control_plane
 
# Redis
REDIS_URL=redis://localhost:6379
 
# Kafka
KAFKA_BOOTSTRAP_SERVERS=localhost:29092
 
# Authentication
JWT_SECRET=your-local-development-secret-key-minimum-256-bits
 
# AI Service
OPENAI_API_KEY=sk-your-openai-api-key
 
# ML Service
MLFLOW_TRACKING_URI=http://localhost:5000

Running Tests

Java Tests

# All Java tests
./scripts/build.sh --test-only --java
 
# Tests for a specific service
cd control-plane/iam-service
./gradlew test
 
# With test report
./gradlew test jacocoTestReport

Python Tests

# All Python tests
./scripts/build.sh --test-only --python
 
# Tests for a specific service
cd data-plane/ai-service
pytest tests/ -v
 
# With coverage
pytest tests/ --cov=src --cov-report=html

Frontend Tests

cd frontend/bi-workbench
pnpm test
 
# With coverage
pnpm test:coverage

Integration Tests

# Run integration tests (requires infrastructure services running)
cd tests/integration
./run-tests.sh

Local Validation

Validate that services are running correctly:

# Validate local services
./scripts/tools/local-service-validate.sh
 
# Validate schema consistency
./scripts/tools/local-schema-validate.sh
 
# Validate port assignments (no conflicts)
./scripts/tools/validate-ports.sh

Common Development Workflows

Working on the AI Service

# 1. Start infrastructure
./local/matih start --profile ai
 
# 2. Start the AI service in development mode
cd data-plane/ai-service
source .venv/bin/activate
uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload
 
# 3. Start the Agentic Workbench
cd frontend/agentic-workbench
pnpm dev
 
# 4. Test via the UI at http://localhost:3003

Working on the Control Plane

# 1. Start infrastructure
./local/matih start --profile minimal
 
# 2. Start required services
cd control-plane/iam-service && ./gradlew bootRun &
cd control-plane/tenant-service && ./gradlew bootRun &
 
# 3. Start the Control Plane UI
cd frontend/control-plane-ui
pnpm dev
 
# 4. Access the UI at http://localhost:3004

Working on BI Dashboards

# 1. Start infrastructure with data profile
./local/matih start --profile data
 
# 2. Start the BI service and query engine
cd data-plane/bi-service && ./gradlew bootRun &
cd data-plane/query-engine && ./gradlew bootRun &
 
# 3. Start the BI Workbench
cd frontend/bi-workbench
pnpm dev
 
# 4. Access at http://localhost:3000

Stopping the Environment

# Stop infrastructure services
./local/matih stop
 
# Or with Docker Compose
docker-compose down
 
# Remove volumes (reset all data)
docker-compose down -v

Troubleshooting

Port Conflicts

# Check for port conflicts
./scripts/tools/validate-ports.sh
 
# Find what is using a port
lsof -i :8080

Docker Resource Issues

If services are crashing or failing to start:

  1. Increase Docker Desktop memory allocation (Settings > Resources)
  2. Use a smaller profile (--profile minimal instead of --profile full)
  3. Stop services you are not actively developing

Database Connection Issues

# Verify PostgreSQL is running
docker-compose ps postgres
 
# Check connection
psql -h localhost -p 5432 -U matih -d matih_control_plane -c "SELECT 1"
 
# Reset databases
docker-compose down -v
docker-compose up -d postgres
./scripts/tools/setup-databases.sh

Next Steps