Open source

MockForge

A multi-tenant mock API gateway driven by one YAML file

StableRustMIT

About

MockForge is a mock API server that simulates several backend services and simple CRUD data from one YAML file. It routes requests by hostname or path prefix, updates in-memory data on write requests and returns different responses based on conditions. It reloads when the configuration file changes, without a restart. Data is kept in memory only.

Features

  • Multi-tenant routing by hostname or path prefix
  • Stateful in-memory CRUD with POST, PUT, PATCH and DELETE
  • Rules on params, query, headers and body with ==, !=, contains, exists and !exists
  • Hot reload of the config file without a restart
  • Permissive CORS headers on every response

Requirements

A recent stable Rust toolchain to build from source (verified with 1.96); or Node.js for the npm wrapper

Install

cargo install --git https://github.com/Ankara-Software/mockforge
npm install -g mockforge-gateway

Usage

mockforge --config mockforge.yaml --port 8080
curl http://localhost:8080/auth/users
curl -X POST -H "Content-Type: application/json" -d '{"name": "Alice"}' http://localhost:8080/auth/users
GitHub repository
https://github.com/Ankara-Software/mockforge
Report an issue
https://github.com/Ankara-Software/mockforge/issues
Security policy
SECURITY.md
License file
LICENSE (MIT)
Last update

Want to contribute?

Bug reports and pull requests are handled on GitHub.