moclojer

Simple and efficient HTTP mock server with specification written in yaml, edn or OpenAPI.

Features

  • No-code API Mock: Create mock APIs without writing code
  • Multiple Specification Formats: Support for YAML, EDN, and OpenAPI 3
  • Dynamic Responses: Generate dynamic responses based on request parameters
  • Multi-domain Support: Host multiple mock APIs on different domains
  • External Body Support: Load response bodies from external files
  • Open Source: MIT licensed and community-driven

Getting Started

Docker

1
2
3
docker run -it \
  -p 8000:8000 -v $(pwd)/moclojer.yml:/app/moclojer.yml \
  ghcr.io/moclojer/moclojer:latest

Manual Installation

1
bash < <(curl -s https://raw.githubusercontent.com/moclojer/moclojer/main/install.sh)

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# This mock register route: GET /hello/:username
- endpoint:
    # Note: the method could be omitted because GET is the default
    method: GET
    path: /hello/:username
    response:
      # Note: the status could be omitted because 200 is the default
      status: 200
      headers:
        Content-Type: application/json
      # Note: the body will receive the value passed in the url using the
      # :username placeholder
      body: >
        {
          "hello": "{{path-params.username}}!"
        }        

View on GitHub | Documentation