Skip to content

rasadov/Unimock

Repository files navigation

Unimock

Self-hosted unified API mock server for REST and gRPC with a web UI.

Quick start (pull from GHCR)

Use the prebuilt image to run Unimock locally in under a minute.

Option A: docker run

docker pull ghcr.io/rasadov/unimock:latest
docker run --name unimock \
  -p 5100:5100 -p 5101:5101 -p 5102:5102 \
  -e UNIMOCK_DB=file:/srv/data/unimock.db \
  -v unimock-data:/srv/data \
  -v unimock-protos:/srv/unimock-grpc-protos \
  ghcr.io/rasadov/unimock:latest

Open http://localhost:5100 for the admin UI.

Stop/remove container:

docker stop unimock && docker rm unimock

Option B: docker-compose.yml using GHCR image

services:
  unimock:
    image: ghcr.io/rasadov/unimock:latest
    ports:
      - "5100:5100"
      - "5101:5101"
      - "5102:5102"
    environment:
      - UNIMOCK_DB=file:/srv/data/unimock.db
    volumes:
      - unimock-data:/srv/data
      - unimock-protos:/srv/unimock-grpc-protos

volumes:
  unimock-data:
  unimock-protos:

Then run:

docker compose up -d

What it runs

  • Admin dashboard + management API: http://localhost:5100
  • REST mock server: http://localhost:5101
  • gRPC mock server: localhost:5102

Run the easy way (Docker)

Prerequisites

Start

docker compose up --build

Then open:

  • http://localhost:5100

Stop

docker compose down

Data persistence

SQLite data is persisted in the unimock-data volume (configured in docker-compose.yml).

Run the dev way (native)

Prerequisites

  • Go 1.22+ (project currently uses Go 1.26.x in go.mod)
  • Node.js 20+ and npm (for the React UI)

1) Install frontend dependencies

cd ui
npm install

2) Build UI assets

npm run build

This creates ui/dist, which is embedded/served by the Go app.

3) Run backend

From project root:

go run ./cmd/unimock

Then open:

  • http://localhost:5100

Optional: custom DB location

By default, unimock uses file:unimock.db.

Set UNIMOCK_DB to change it:

UNIMOCK_DB=file:/absolute/path/unimock.db go run ./cmd/unimock

Useful Make targets

From project root:

make ui-build
make go-build
make run
make test
make docker-build
make docker-up

Basic usage flow

  1. Open admin UI at :5100.
  2. Create REST/gRPC mock definitions.
  3. Hit protocol endpoints on :5101, :5102.
  4. Watch live logs via the UI (SSE stream).
  5. Export/import full config with management actions.

About

Self-hosted API mocking platform for REST and gRPC, with a web UI, live request logs, and import/export support.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors