Skip to main content

A simple, reloadable API mock server with JWT support

Project description

🧪 MiniMocker

A lightweight, no-code mock API server with hot reload and mock JWT validation — perfect for local development, integration testing, and API simulation.


🚀 Features

  • 🔁 Hot-reloads when mock_config.json changes
  • 🔐 Mock JWT token validation (Authorization: Bearer ...)
  • ⏱ Simulate network delay
  • 🧩 Serve any REST endpoint with static or dynamic responses
  • ⚡ Simple CLI to launch in seconds
  • 📦 Package-ready for PyPI (pip install minimocker)

📦 Installation

pip install minimocker

🧑‍💻 Usage

🟢 Start Mock Server

minimocker examples/mock_config.json --port 8080

🔁 Live Reload

Any changes to the config file will auto-reload the routes without restarting the server.

🛠 Configuration Example

{
  "jwt_secret": "mysecret",
  "routes": [
    {
      "path": "/api/user",
      "method": "GET",
      "auth": true,
      "response": {
        "status": 200,
        "body": {
          "name": "Alice",
          "email": "alice@example.com"
        },
        "delay": 300
      }
    }
  ]
}

Supported Fields

Field Description
path URL route
method HTTP method (GET, POST, etc.)
auth true to require Bearer token
status HTTP response code
body JSON response
delay Artificial delay in milliseconds
jwt_secret Secret key to validate incoming JWT tokens

🔐 JWT Validation

  • If a route has "auth": true, requests must include a valid JWT in the Authorization header.

  • Uses HS256 algorithm.

  • Example header:

Authorization: Bearer <your-jwt-token>

Generate a token at jwt.io with the secret you provide in mock_config.json.

👥 Contributing

Contributions are welcome! Ideas for dynamic templating, mock headers, and request-based routing are on the roadmap.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minimocker-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minimocker-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file minimocker-0.1.0.tar.gz.

File metadata

  • Download URL: minimocker-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for minimocker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 deea089865fa69b78caab24b1ac5b8a4cfdab5a132ca9aa847e0c537338b62ea
MD5 29456649eb9a6ccc62ce5b4fddb5dd6d
BLAKE2b-256 a629134b80fdd07e41417ce18e441dcddf40e510f3dd5e37850d1c1e91df0879

See more details on using hashes here.

File details

Details for the file minimocker-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: minimocker-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for minimocker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ae8863dfdfb515eb9358758b80c862252fb21e49ddee7a3c77756f84b816d7a
MD5 a7ed6dc929e2cb9a8fab1dfee2efba4d
BLAKE2b-256 e75fc5056a3a773c6d09b51aadda8a0290959a5748c56a0eec8c8eae2b84c3b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page