Stubrix

March 22, 2026 Β· View on GitHub

Stubrix Logo

Advanced API Engineering, Mocking & Developer Productivity Platform

GitHub Latest Release Docker NestJS React License: MIT

Stubrix is a unified hub for simulation, testing, and observability of APIs and microservices throughout the entire development lifecycle. From basic mocking to distributed tracing, contract testing, chaos engineering, event-driven simulation, and cloud service mocking β€” all in a single platform, running locally with Docker.

"Eliminates the 'works on my machine' problem" β€” simulate AWS, Kafka, PostgreSQL, gRPC, GraphQL, Keycloak and any REST API locally with full fidelity.


πŸ† What makes Stubrix different

Stubrix covers the full API development lifecycle in a single tool β€” no stitching together five different platforms:

CapabilityWhat it does
Dual Mock EngineWireMock (Java) or Mockoon (Node.js) β€” same mocks, zero lock-in, one command to switch
Multi-ProtocolREST, GraphQL, gRPC, WebSockets, Kafka, RabbitMQ β€” all mockable in one place
Contract TestingPact Broker integration β€” verify that producer and consumer contracts match before deploying
Chaos & ResilienceFault injection (latency, errors, payload corruption) + Toxiproxy network-level chaos
Cloud SimulationLocalStack for AWS (S3, SQS, SNS, DynamoDB, Lambda) β€” zero cloud cost during development
Object StorageMinIO (S3-compatible) β€” store large mock bodies and database snapshot archives
Distributed TracingJaeger + OpenTelemetry β€” follow a request across services during local testing
Prometheus MetricsBuilt-in metrics exposition + Grafana dashboards β€” observe the mock server itself
Performance Testingk6 scripts (smoke, load, stress) with baseline regression CI gate
Identity & AccessKeycloak and Zitadel β€” real OAuth2/OIDC token flows locally
AI-Native (MCP)3 MCP servers with 100+ tools β€” manage everything from your AI coding assistant
Database SnapshotsPostgreSQL pg_dump/psql, MySQL mysqldump, SQLite, MongoDB mongodump/mongorestore β€” snapshot and restore DB state alongside mocks
Service Control PanelEnable/disable 24 infrastructure services, configure, backup and restore all settings β€” no manual Docker commands
Visual Control PanelNestJS 11 API + React 19 Dashboard β€” no CLI-only workflows

Requirements

  • Node.js 24 + npm 10+
  • Docker (required for mock engines, databases, and infrastructure services)
  • pg_dump / psql (optional, for real PostgreSQL snapshot/restore)

πŸ—οΈ Architecture Overview

Stubrix is a monorepo (npm workspaces) built on three core layers:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Developer Interfaces                                           β”‚
β”‚  React 19 Dashboard β”‚ CLI (@stubrix/cli) β”‚ VS Code Extension   β”‚
β”‚  AI Assistants via MCP (Windsurf, Cursor, Claude)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ HTTP / WebSocket
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  @stubrix/api β€” NestJS 11 Control Plane (port 9090)            β”‚
β”‚                                                                 β”‚
β”‚  Core: projects Β· mocks Β· recording Β· logs Β· databases         β”‚
β”‚  Quality: governance Β· coverage Β· contracts Β· chaos            β”‚
β”‚  Intelligence: AI/RAG Β· stateful mocks Β· time machine         β”‚
β”‚  Protocols: GraphQL Β· gRPC Β· webhooks Β· events (Kafka/MQ)     β”‚
β”‚  Enterprise: auth/RBAC Β· templates Β· multi-tenancy            β”‚
β”‚  Observability: metrics Β· tracing Β· performance testing       β”‚
β”‚  Cloud: LocalStack Β· MinIO Β· Keycloak Β· Zitadel               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ Docker profiles
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Infrastructure Layer (20+ Docker profiles)                    β”‚
β”‚                                                                 β”‚
β”‚  Mock Engines: WireMock Β· Mockoon                              β”‚
β”‚  Databases: PostgreSQL Β· MySQL Β· SQLite Β· MongoDB              β”‚
β”‚  Messaging: Kafka (Redpanda) Β· RabbitMQ                        β”‚
β”‚  Protocols: GripMock (gRPC)                                    β”‚
β”‚  Cloud: LocalStack Β· MinIO Β· Keycloak Β· Zitadel               β”‚
β”‚  Observability: Prometheus Β· Grafana Β· Jaeger                  β”‚
β”‚  Chaos: Toxiproxy                                              β”‚
β”‚  Contracts: Pact Broker                                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Monorepo packages

PackageDescription
@stubrix/apiNestJS 11 control plane β€” 28 modules, REST API + WebSockets
@stubrix/uiReact 19 + Vite 7 dashboard host
@stubrix/mock-uiMock server microfrontend
@stubrix/db-uiDatabase management microfrontend
@stubrix/sharedTypeScript types shared across all packages
@stubrix/cliStandalone CLI (stubrix binary)
@stubrix/vscode-extensionVS Code sidebar + commands
stubrix-mcpMCP server β€” full Stubrix API (100+ tools)
wiremock-mcpMCP server β€” WireMock Admin API (16 tools)
docker-mcpMCP server β€” Docker Compose management (12 tools)

πŸ“‚ Project Structure

stubrix/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ shared/              @stubrix/shared β€” TypeScript types
β”‚   β”œβ”€β”€ api/                 @stubrix/api β€” NestJS 11 (27 modules)
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ projects/      Project CRUD
β”‚   β”‚       β”œβ”€β”€ mocks/         Mock CRUD + WireMock integration
β”‚   β”‚       β”œβ”€β”€ recording/     Traffic recording (4 modes)
β”‚   β”‚       β”œβ”€β”€ logs/          REST + WebSocket (Socket.IO)
β”‚   β”‚       β”œβ”€β”€ databases/     Snapshot/restore + project DB configs
β”‚   β”‚       β”œβ”€β”€ stateful-mocks/ Stateful scenario machine
β”‚   β”‚       β”œβ”€β”€ import/        HAR, Postman, Insomnia, OpenAPI import
β”‚   β”‚       β”œβ”€β”€ governance/    Spectral OpenAPI linting
β”‚   β”‚       β”œβ”€β”€ coverage/      Mock hit/miss coverage analysis
β”‚   β”‚       β”œβ”€β”€ intelligence/  AI/RAG (ChromaDB + OpenAI)
β”‚   β”‚       β”œβ”€β”€ scenarios/     Time machine: capture & restore state
β”‚   β”‚       β”œβ”€β”€ contracts/     Pact Broker contract testing
β”‚   β”‚       β”œβ”€β”€ chaos/         Fault injection (latency, errors)
β”‚   β”‚       β”œβ”€β”€ chaos-network/ Toxiproxy network chaos
β”‚   β”‚       β”œβ”€β”€ webhooks/      Webhook receiver, replay, simulator
β”‚   β”‚       β”œβ”€β”€ events/        Kafka + RabbitMQ event publishing
β”‚   β”‚       β”œβ”€β”€ protocols/     GraphQL SDL + gRPC via GripMock
β”‚   β”‚       β”œβ”€β”€ auth/          API keys, RBAC, multi-tenancy
β”‚   β”‚       β”œβ”€β”€ templates/     Environment templates with variable substitution
β”‚   β”‚       β”œβ”€β”€ metrics/       Prometheus + app metrics
β”‚   β”‚       β”œβ”€β”€ performance/   k6 test runner + baselines
β”‚   β”‚       β”œβ”€β”€ tracing/       Jaeger + OpenTelemetry
β”‚   β”‚       β”œβ”€β”€ cloud/         LocalStack AWS integration
β”‚   β”‚       β”œβ”€β”€ storage/       MinIO object storage
β”‚   β”‚       β”œβ”€β”€ iam/           Keycloak + Zitadel IAM
β”‚   β”‚       └── settings/      Service control panel (F34)
β”‚   β”œβ”€β”€ ui/                  @stubrix/ui β€” React 19 + Vite 7 host
β”‚   β”œβ”€β”€ mock-ui/             @stubrix/mock-ui β€” Mock management microfrontend
β”‚   β”œβ”€β”€ db-ui/               @stubrix/db-ui β€” Database management microfrontend
β”‚   β”œβ”€β”€ cli/                 @stubrix/cli β€” Standalone CLI binary
β”‚   β”œβ”€β”€ vscode-extension/    VS Code / Windsurf sidebar extension
β”‚   └── mcp/
β”‚       β”œβ”€β”€ stubrix-mcp/       MCP server β€” full Stubrix API
β”‚       β”œβ”€β”€ wiremock-mcp/      MCP server β€” WireMock Admin API
β”‚       └── docker-mcp/        MCP server β€” Docker Compose
β”œβ”€β”€ mocks/
β”‚   β”œβ”€β”€ mappings/            WireMock route definitions (JSON)
β”‚   β”œβ”€β”€ __files/             Response body files
β”‚   └── proto/               gRPC .proto files + stubs
β”œβ”€β”€ scripts/                 Converter, entrypoint, recording helpers
β”œβ”€β”€ config/                  Prometheus, Grafana configs
β”œβ”€β”€ Dockerfile               Multi-engine Docker image (WireMock/Mockoon)
β”œβ”€β”€ Dockerfile.api           NestJS API + React build
β”œβ”€β”€ docker-compose.yml       20+ profiles
└── Makefile                 CLI shortcuts (60+ targets)

πŸš€ Quick Start

1. Clone & install

git clone https://github.com/marcelo-davanco/stubrix.git
cd stubrix
npm install

2. Build shared packages

npm run build:shared
npm run build:db-ui
npm run build:mock-ui

3. Start services

# Option A: Docker (recommended for production-like setup)
make wiremock            # WireMock + PostgreSQL + Control Plane

# Option B: Local development
npm run dev -w @stubrix/api    # API on :9090
npm run dev -w @stubrix/ui     # UI on :5173

4. Open the dashboard

http://localhost:9090          # Production (Docker)
http://localhost:5173          # Development (Vite)

🐳 Docker Compose Profiles

Mock Engines

ProfileServicePortCommand
wiremockWireMock (serve):8081make wiremock
wiremock-recordWireMock (record):8081make wiremock-record
mockoonMockoon CLI (serve):8081make mockoon
mockoon-proxyMockoon (proxy):8081make mockoon-proxy

Databases

ProfileServicePortCommand
postgresPostgreSQL 17:5442make postgres
mysqlMySQL 8:3307make mysql
mongodbMongoDB:27017make mongodb
adminerAdminer UI:8084make adminer-up
cloudbeaverCloudBeaver UI:8083make cloudbeaver-up

Messaging & Protocols

ProfileServicePortCommand
kafkaRedpanda (Kafka):9092 / :8082make kafka
rabbitmqRabbitMQ:5672 / :15672make rabbitmq
gripmockGripMock (gRPC):4770 / :4771make gripmock

Quality & Contracts

ProfileServicePortCommand
pactPact Broker:9292make pact

Observability

ProfileServicePortCommand
monitoringPrometheus:9091make prom
monitoringGrafana:3000make grafana
jaegerJaeger:16686 / :4318make jaeger

Cloud & Infrastructure

ProfileServicePortCommand
localstackLocalStack:4566make localstack
minioMinIO:9000 / :9001make minio
keycloakKeycloak:8180make keycloak
zitadelZitadel:8085make zitadel
redisRedis:6379make redis
toxiproxyToxiproxy:8474make toxiproxy
hoppscotchHoppscotch:3100make hoppscotch

πŸ§ͺ Testing

# Unit tests (API)
npm run test -w @stubrix/api

# Build all packages
npm run build

# Lint + format
npm run lint
npm run format

πŸ”Œ API Quick Reference

Projects & Mocks

# List projects
curl http://localhost:9090/api/projects

# Create a mock
curl -X POST http://localhost:9090/api/projects/:id/mocks \
  -H 'Content-Type: application/json' \
  -d '{"request":{"method":"GET","url":"/api/hello"},"response":{"status":200,"body":"{\"msg\":\"hi\"}"}}'

# Start recording
curl -X POST http://localhost:9090/api/recording/start \
  -d '{"targetUrl":"https://pokeapi.co/api/v2","projectId":"..."}'

Import (HAR, Postman, OpenAPI)

# Import HAR file
curl -X POST http://localhost:9090/api/import/har \
  -F 'file=@recording.har' -F 'projectId=...'

# Import Postman collection
curl -X POST http://localhost:9090/api/import/postman \
  -F 'file=@collection.json' -F 'projectId=...'

Contracts (Pact)

make pact
# POST /api/contracts/publish   β€” publish pact file
# POST /api/contracts/verify    β€” verify consumer contract
# GET  /api/contracts/matrix    β€” compatibility matrix

Chaos Engineering

# Fault injection (API-level)
curl -X POST http://localhost:9090/api/chaos/rules \
  -d '{"name":"slow-payments","pathPattern":"/api/payments/**","latencyMs":2000,"errorRate":0.3}'

# Network chaos (Toxiproxy)
make toxiproxy
# POST /api/chaos-network/proxies β€” create proxy
# POST /api/chaos-network/proxies/:name/toxics β€” add toxic (latency, timeout, etc.)

Events (Kafka + RabbitMQ)

make kafka     # or: make rabbitmq
# POST /api/events/publish    β€” publish event to topic/queue
# GET  /api/events/health     β€” broker health status

Cloud & Storage

make localstack
# POST /api/cloud/s3/buckets          β€” create S3 bucket
# POST /api/cloud/sqs/queues          β€” create SQS queue
# POST /api/cloud/sns/publish          β€” publish SNS message

make minio
# POST /api/storage/upload-mock-body   β€” upload file to MinIO
# POST /api/storage/archive-snapshot   β€” archive DB snapshot

Identity & Access Management

make keycloak   # or: make zitadel
# POST /api/iam/token/password           β€” resource owner password grant
# POST /api/iam/token/client-credentials β€” service account token
# POST /api/iam/token/introspect         β€” validate token claims

Database Snapshots (F3/F29)

Snapshot and restore database state alongside mocks:

make postgres
# POST /api/db/engines/postgres/snapshots       β€” create snapshot (pg_dump)
# POST /api/db/snapshots/:name/restore           β€” restore snapshot (psql)
# GET  /api/db/snapshots?projectId=...           β€” list project snapshots

Service Control Panel (F34)

Enable, disable, configure and health-check any of the 24 Docker services from the dashboard or API β€” no manual docker compose commands:

# Via Settings dashboard: http://localhost:9090/settings

# Via API
curl -X POST http://localhost:9090/api/settings/services/postgres/enable
curl -X POST http://localhost:9090/api/settings/services/postgres/disable
curl http://localhost:9090/api/settings/services            # list all + health status
curl http://localhost:9090/api/settings/backups             # list config backups
curl -X POST http://localhost:9090/api/settings/backups     # create backup

All service configuration is stored in data/stubrix-config.db (SQLite) with AES-256-GCM encryption for sensitive values.


πŸ€– MCP Ecosystem

Stubrix ships 3 MCP servers with 100+ tools, enabling AI coding assistants (Windsurf, Cursor, Claude) to manage the entire platform from the IDE.

Setup

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "stubrix-mcp": {
      "command": "node",
      "args": ["packages/mcp/stubrix-mcp/src/index.js"],
      "env": { "STUBRIX_API_URL": "http://localhost:9090" }
    },
    "wiremock-mcp": {
      "command": "node",
      "args": ["packages/mcp/wiremock-mcp/src/index.js"],
      "env": { "WIREMOCK_URL": "http://localhost:8081" }
    },
    "docker-mcp": {
      "command": "node",
      "args": ["packages/mcp/docker-mcp/src/index.js"],
      "env": { "COMPOSE_PROJECT_DIR": "/path/to/stubrix" }
    }
  }
}

What your AI can do

"Record mocks from the staging API for /api/users and /api/orders"
β†’ docker_compose_up(["wiremock-record"]) + stubrix_start_recording(...)

"Take a PostgreSQL snapshot before running migrations"
β†’ stubrix_create_snapshot({ engine: "postgres", projectId: "..." })

"Check if Kafka and gRPC are healthy"
β†’ event_health() + protocol_grpc_health()

"Get a Keycloak token for user admin"
β†’ iam_get_token({ username: "admin", password: "..." })

"Run a load test and compare with last baseline"
β†’ perf_list_scripts() + perf_compare_baseline({ id: "..." })

"Lint the OpenAPI spec for violations"
β†’ lint_spec({ content: "..." })

"Inject 500ms latency into the payments service"
β†’ toxiproxy proxy + toxic setup via chaos_network_* tools

Tool coverage by domain

DomainTools
Projects & Mocksstubrix_list_projects, stubrix_create_mock, stubrix_start_recording, ...
Database Snapshotsstubrix_create_snapshot, stubrix_restore_snapshot, ...
Contractscontract_publish, contract_verify
Chaoschaos_list_rules, chaos_create_rule, chaos_network_*
Eventsevent_publish, event_template_*, event_health
Protocolsprotocol_graphql_parse, protocol_grpc_mock, ...
Authauth_create_user, auth_validate_key, auth_audit_log
Metricsmetrics_health, metrics_summary
Performanceperf_list_scripts, perf_save_baseline, perf_compare_baseline
Tracingtracing_list, tracing_health, tracing_config
Cloud (AWS)cloud_health, cloud_s3_*, cloud_sns_publish
Storage (MinIO)storage_health, storage_upload_mock_body, storage_archive_snapshot
IAMiam_health, iam_get_token, iam_introspect_token
Governancelint_spec
Dockerdocker_compose_up, docker_logs, docker_health, ...

βš™οΈ Environment Variables

See .env.example for the full reference. Key variables:

VariableDefaultDescription
MOCK_PORT8081Mock server port
PROXY_TARGETβ€”Real API URL for recording/proxy
MOCK_ENGINEwiremockwiremock or mockoon
CONTROL_PORT9090NestJS API port
PG_HOST / PG_PORTlocalhost:5442PostgreSQL connection
LOCALSTACK_URLhttp://localhost:4566LocalStack endpoint
MINIO_URLhttp://localhost:9000MinIO endpoint
KEYCLOAK_URLhttp://localhost:8180Keycloak endpoint
PROMETHEUS_PORT9091Prometheus port
JAEGER_UI_PORT16686Jaeger UI port
OTEL_ENDPOINThttp://localhost:4318OpenTelemetry HTTP endpoint

πŸ“– API Documentation

The full OpenAPI spec is available at http://localhost:9090/api/docs (Swagger UI) when the API is running.

All 27 modules are documented with request/response schemas, organized by tag:

projects Β· mocks Β· recording Β· import Β· databases Β· governance Β· coverage Β· stateful-mocks Β· intelligence Β· scenarios Β· contracts Β· chaos Β· chaos-network Β· webhooks Β· events Β· protocols Β· auth Β· templates Β· metrics Β· performance Β· tracing Β· cloud Β· storage Β· iam Β· status


πŸ—ΊοΈ Roadmap (Releases)

VersionMilestoneKey Features
v1.3.1FoundationWireMock/Mockoon dual engine, recording, dashboard, DB snapshots, MCP servers
v1.4.0Stateful MockingStateful mock scenarios, Adminer/CloudBeaver DB viewers
v1.5.0API ClientsHAR/Postman/OpenAPI import, Bruno tests, Hoppscotch
v1.6.0GovernanceSpectral OpenAPI linting, mock coverage analysis
v1.7.0IntelligenceAI/RAG mock generation (ChromaDB), Time Machine scenarios
v1.8.0Contracts & ChaosPact Broker, fault injection, Toxiproxy network chaos
v1.9.0CLI & Automation@stubrix/cli standalone binary, Makefile automation
v2.0.0Multi-ProtocolGraphQL/gRPC mocking, Kafka/RabbitMQ event simulation, webhooks
v2.1.0EnterpriseAuth/RBAC/multi-tenancy, VS Code extension, environment templates
v2.2.0ObservabilityPrometheus/Grafana metrics, k6 performance testing, Jaeger tracing
v2.3.0Cloud & StorageLocalStack AWS, MinIO object storage, Keycloak/Zitadel IAM
v2.4.0Micro Frontends@stubrix/mock-ui and @stubrix/db-ui extracted as standalone packages
v2.5.0Service Control PanelEnable/disable 24 services via dashboard, health monitoring, config backup
v2.6.0Proto & StubsgRPC proto file editor, live GripMock stub management, container runtime fixes

🧩 IDE Extension (VS Code / Windsurf)

The stubrix-vscode extension adds a sidebar with Mocks, Status, and Scenarios views, plus commands for engine control, scenario capture, and health check.

One-time setup β€” add Windsurf CLI to PATH

The Windsurf CLI binary is not added to PATH automatically on macOS:

echo 'export PATH="$PATH:/Applications/Windsurf.app/Contents/Resources/app/bin"' >> ~/.zshrc
source ~/.zshrc
windsurf --version   # β†’ 1.108.x

Install

make windsurf-install   # package .vsix + install in Windsurf
make vscode-install     # package .vsix + install in VS Code

Or via UI: Cmd+Shift+P β†’ Extensions: Install from VSIX... β†’ select packages/vscode-extension/stubrix-vscode-X.Y.Z.vsix.

Configuration

{
  "stubrix.apiUrl": "http://localhost:9090"
}

Full reference: packages/vscode-extension/README.md


πŸ“š Guides

GuideDescription
Recording with PokΓ©APIRecord PokΓ©API mocks, serve offline, use via Postman
packages/api/API.mdFull NestJS API module reference
packages/vscode-extension/README.mdExtension install + Windsurf CLI PATH setup

πŸ“„ License

MIT β€” see LICENSE for details.


Stubrix β€” made with β˜• by Marcelo DavanΓ§o