chimera-cli

Crates.iochimera-cli
lib.rschimera-cli
version0.6.9
created_at2025-06-27 07:16:58.732716+00
updated_at2025-07-24 11:28:54.171827+00
descriptionA Mock API for every need and more
homepagehttps://github.com/ams003010/chimera
repositoryhttps://github.com/ams003010/chimera
max_upload_size
id1728268
size157,861
Abhijith M S (AMS003010)

documentation

https://chimera-docs.vercel.app

README

banner

Chimera - The Only Mock API you will ever need โšก

Crates.io License: MIT Version

Chimera is a blazing-fast, configurable JSON server built with Axum. It allows you to serve JSON files as APIs with full CRUD support, sorting, pagination, simulated latency, and route-based retrieval. Ideal for prototyping, mock APIs, or rapid development.

Now with automatic data generation, null value simulation, long path support, form submission, and CORS control, Chimera helps you mock realistic and dynamic API responses effortlessly.

Perfect for:

  • Mock HTTP API for Frontend Development
  • Mock HTTP API for Mobile App Development
  • IoT Device Simulation
  • Prototyping for Microservices

Ingests data of format:

  • json
  • csv

Mock Protocols like:

  • HTTP
  • Websockets

Future support for:

  • Webhook Simulation (๐Ÿช)
  • GraphQL Mocking (โฌข)
  • gRPC Simulation (๐ŸŒ)
  • MQTT Broker Simulation (๐Ÿ”)

๐Ÿฒ Features

  • Serve JSON as an API โ€“ Load any JSON file and serve it as structured API endpoints.
  • Full CRUD Support โ€“ GET, POST, DELETE, PATCH, PUT supported on all routes.
  • Support for Nested Routes โ€“ Long paths like /api/v2/data are supported.
  • Auto Data Generation โ€“ Generate mock data automatically from schema-based definitions.
  • Null Value Simulation โ€“ Add controlled nulls to fields for realistic data modeling.
  • Route-based Data Retrieval โ€“ Fetch data by route and ID.
  • Sorting Support โ€“ Sort entries dynamically based on attributes.
  • Pagination Support โ€“ Limit the number of records per request.
  • Simulated Latency โ€“ Mimic real-world API delays for better testing.
  • Ultra-Fast Performance โ€“ Leveraging Rust and Axum for speed and efficiency.
  • Easy Configuration โ€“ Set up ports, file paths, latency, sorting, and pagination via CLI.
  • Form Submission โ€“ Supports POST form submissions at /submit-form.
  • CORS Control โ€“ Enable/disable CORS by specifying allowed domains in a chimera.cors file.
  • Quiet Mode โ€“ Disable logs with the --quiet flag.

๐Ÿฒ Installation

Install with Cargo

cargo install chimera-cli

On Windows

Download and run directly:

# Download the latest release
Invoke-WebRequest -Uri "https://github.com/AMS003010/Chimera/releases/latest/download/chimera-windows.exe.zip" -OutFile "chimera-windows.zip"

# Extract the zip file
Expand-Archive -Path "chimera-windows.zip" -DestinationPath "."

# Rename the binary
Rename-Item chimera-windows.exe chimera-cli.exe

# Run chimera
.\chimera-cli.exe --path data.json

On Linux

Using the precompiled binary:

# Download and extract the latest Linux binary
curl -sL https://github.com/AMS003010/Chimera/releases/latest/download/chimera-linux.zip -o chimera-linux.zip
unzip chimera-linux.zip
chmod +x chimera-linux
mv chimera-linux chimera-cli
./chimera-linux --path data.json

Using the Debian package (Ubuntu/Debian):

# Download the latest .deb package
curl -s https://api.github.com/repos/AMS003010/Chimera/releases/latest | jq -r '.assets[] | select(.name | endswith("_amd64.deb")) | .browser_download_url' | xargs wget

# Install the package
sudo dpkg -i chimera-cli_*_amd64.deb

# Run chimera (now available system-wide)
chimera-cli --path data.json

On macOS

# Download and extract the latest macOS binary
curl -sL https://github.com/AMS003010/Chimera/releases/latest/download/chimera-macos.zip -o chimera-macos.zip
unzip chimera-macos.zip
chmod +x chimera-macos
mv chimera-macos chimera-cli
./chimera-cli --path data.json

Build from Source

git clone https://github.com/AMS003010/Chimera.git
cd Chimera
cargo install --path .
chimera-cli --path data.json

๐Ÿฒ Usage (Websocket mode)

CLI Commands

Here's all the available CLI commands (Websocket mode)

chimera-cli.exe --path .\data.json websocket: Start the Chimera Websocket server with data from data.json at default port 8080

chimera-cli.exe --path .\data.csv websocket: Start the Chimera Websocket server with schema from data.csv at default port 8080

chimera-cli.exe --path .\data.json websocket --port 4000: Start the Chimera server at port 4000

chimera-cli.exe --path .\data.json websocket --sort products desc id: Sort records in /products route by id in desc order

chimera-cli.exe --path .\data.json websocket --page 3: Start server with the records paginated with a factor 3

chimera-cli.exe --path .\schema.json websocket -X: Enable automatic data generation using schema from schema.json

chimera-cli.exe --path .\data.json websocket --cors: Enable CORS and allow only domains from chimera.cors file

chimera-cli.exe --path --quiet .\data.json websocket: Disable runtime logs

[!NOTE] Use multiple arguments together for more diverse control

API Endpoints

Endpoint Description
/{route} Establish a connection

Messages

Message format Behaviour
* (any text) text Echo back the message
{"action": "connections"} json Get all active connections
{"action": "refresh"} json Get data

๐Ÿ”ง Auto Data Generation

With the -X flag, Chimera can generate data on the fly using a schema JSON structure like:

{
    "routes": [
        {
            "path":"api/v2/data",
            "no_of_entries": 2,
            "schema": {
                "id": "id",
                "created_on": "date",
                "mssg": "lorem"
            },
            "null_percentage": 0
        },
        {
            "path":"products",
            "no_of_entries": 700,
            "schema": {
                "id": "id",
                "rsnd": "integer",
                "name": "name",
                "probability": "boolean",
                "date": "datetime",
                "desc": "lorem"
            },
            "null_percentage": 0
        },
        {
            "path":"api/products",
            "no_of_entries": 70,
            "schema": {
                "id": "id",
                "rsnd": "integer",
                "name": "name",
                "probability": "boolean",
                "date": "datetime",
                "desc": "lorem"
            },
            "null_percentage": 0
        }
    ]
}

Pass this JSON file as an argument to --path

  • path: Name of the route

  • no_of_entries: Number of mock entries to generate

  • schema: Define fields and their data type

    • name: Random name
    • id: Random number
    • integer: Random number
    • date: Date in DD-MM-YYYY format
    • datetime: Date in DD-MM-YYYYTHH:MM:SS format
    • lorem: Random text
    • string: Random word
    • boolean: Random boolean value
  • null_percentage: Percentage of fields and rows to be randomly set as null

๐Ÿ“œ Example Data CSV File (data.csv)

path,no_of_entries,null_percentage,schema
api/v2/data,200,0,"{""id"":""id"",""created_on"":""date"",""mssg"":""lorem""}"
products,700,90,"{""id"":""id"",""rsnd"":""integer"",""name"":""name"",""probability"":""boolean"",""date"":""datetime"",""desc"":""lorem""}"
api/products,300,0,"{""id"":""id"",""rsnd"":""integer"",""name"":""name"",""probability"":""boolean"",""date"":""datetime"",""desc"":""lorem""}"

๐Ÿ“œ Example Data JSON File (data.json)

{
    "data":[
        {
            "id":1,
            "created_on":"25-03-24",
            "mssg":"Why spiders? Why couldnโ€™t it be โ€˜follow the butterfliesโ€™?"
        },
        {
            "id":2,
            "created_on":"02-11-24",
            "mssg":"He can run faster than Severus Snape confronted with shampoo."
        }
    ],
    "api/products": [
        {
            "id":80,
            "name": "veritaserum"
        },
        {
            "id":40,
            "name": "polyjuice potion"
        },
        {
            "id":60,
            "name": "felix felicis"
        }
    ]
}

๐Ÿ“œ Example Schema JSON File (schema.json)

{
    "routes": [
        {
            "path":"api/v2/data",
            "no_of_entries": 2,
            "schema": {
                "id": "id",
                "created_on": "date",
                "mssg": "lorem"
            },
            "null_percentage": 0
        },
        {
            "path":"products",
            "no_of_entries": 700,
            "schema": {
                "id": "id",
                "rsnd": "integer",
                "name": "name",
                "probability": "boolean",
                "date": "datetime",
                "desc": "lorem"
            },
            "null_percentage": 0
        },
        {
            "path":"api/products",
            "no_of_entries": 70,
            "schema": {
                "id": "id",
                "rsnd": "integer",
                "name": "name",
                "probability": "boolean",
                "date": "datetime",
                "desc": "lorem"
            },
            "null_percentage": 0
        }
    ]
}

๐Ÿฒ Usage (HTTP mode)

CLI Commands

Here's all the available CLI commands (HTTP mode)

chimera-cli.exe --path .\data.json http: Start the Chimera HTTP server with data from data.json at default port 8080

chimera-cli.exe --path .\data.csv http: Start the Chimera HTTP server with schema from data.csv at default port 8080

chimera-cli.exe --path .\data.json http --port 4000: Start the Chimera server at port 4000

chimera-cli.exe --path .\data.json http --sort products desc id: Sort records in /products route by id in desc order

chimera-cli.exe --path .\data.json http --page 3: Start server with the records paginated with a factor 3

chimera-cli.exe --path .\data.json http --latency 100: Simulate latency of 100 ms

chimera-cli.exe --path .\schema.json http -X: Enable automatic data generation using schema from schema.json

chimera-cli.exe --path .\data.json http --cors: Enable CORS and allow only domains from chimera.cors file

chimera-cli.exe --path --quiet .\data.json http: Disable runtime logs

[!NOTE] Use multiple arguments together for more diverse control

CORS Configuration

To enable CORS, create a file named chimera.cors in the same directory as the binary with allowed domain(s):

http://localhost:3000
https://example.com
https://api.example.com
https://*.example.org
http://127.0.0.1:8080

API Endpoints

Method Endpoint Description
GET / Health check
GET /{route} Retrieve all data under a route
GET /{route}/{id} Retrieve a specific record by ID
POST /{route} Add a record under a route
DELETE /{route} Delete all records under a route
DELETE /{route}/{id} Delete a specific record by ID
PUT /{route}/{id} Replace a specific record by ID
PATCH /{route}/{id} Partially update a specific record by ID
POST /submit-form Handle form submissions (URL-encoded)

๐Ÿ”ง Auto Data Generation

With the -X flag, Chimera can generate data on the fly using a schema JSON structure like:

{
    "routes": [
        {
            "path":"api/v2/data",
            "no_of_entries": 2,
            "schema": {
                "id": "id",
                "created_on": "date",
                "mssg": "lorem"
            },
            "null_percentage": 0
        },
        {
            "path":"products",
            "no_of_entries": 700,
            "schema": {
                "id": "id",
                "rsnd": "integer",
                "name": "name",
                "probability": "boolean",
                "date": "datetime",
                "desc": "lorem"
            },
            "null_percentage": 0
        },
        {
            "path":"api/products",
            "no_of_entries": 70,
            "schema": {
                "id": "id",
                "rsnd": "integer",
                "name": "name",
                "probability": "boolean",
                "date": "datetime",
                "desc": "lorem"
            },
            "null_percentage": 0
        }
    ]
}

Pass this JSON file as an argument to --path

  • path: Name of the route

  • no_of_entries: Number of mock entries to generate

  • schema: Define fields and their data type

    • name: Random name
    • id: Random number
    • integer: Random number
    • date: Date in DD-MM-YYYY format
    • datetime: Date in DD-MM-YYYYTHH:MM:SS format
    • lorem: Random text
    • string: Random word
    • boolean: Random boolean value
  • null_percentage: Percentage of fields and rows to be randomly set as null

๐Ÿ“œ Example Data CSV File (data.csv)

path,no_of_entries,null_percentage,schema
api/v2/data,200,0,"{""id"":""id"",""created_on"":""date"",""mssg"":""lorem""}"
products,700,90,"{""id"":""id"",""rsnd"":""integer"",""name"":""name"",""probability"":""boolean"",""date"":""datetime"",""desc"":""lorem""}"
api/products,300,0,"{""id"":""id"",""rsnd"":""integer"",""name"":""name"",""probability"":""boolean"",""date"":""datetime"",""desc"":""lorem""}"

๐Ÿ“œ Example Data JSON File (data.json)

{
    "data":[
        {
            "id":1,
            "created_on":"25-03-24",
            "mssg":"Why spiders? Why couldnโ€™t it be โ€˜follow the butterfliesโ€™?"
        },
        {
            "id":2,
            "created_on":"02-11-24",
            "mssg":"He can run faster than Severus Snape confronted with shampoo."
        }
    ],
    "api/products": [
        {
            "id":80,
            "name": "veritaserum"
        },
        {
            "id":40,
            "name": "polyjuice potion"
        },
        {
            "id":60,
            "name": "felix felicis"
        }
    ]
}

๐Ÿ“œ Example Schema JSON File (schema.json)

{
    "routes": [
        {
            "path":"api/v2/data",
            "no_of_entries": 2,
            "schema": {
                "id": "id",
                "created_on": "date",
                "mssg": "lorem"
            },
            "null_percentage": 0
        },
        {
            "path":"products",
            "no_of_entries": 700,
            "schema": {
                "id": "id",
                "rsnd": "integer",
                "name": "name",
                "probability": "boolean",
                "date": "datetime",
                "desc": "lorem"
            },
            "null_percentage": 0
        },
        {
            "path":"api/products",
            "no_of_entries": 70,
            "schema": {
                "id": "id",
                "rsnd": "integer",
                "name": "name",
                "probability": "boolean",
                "date": "datetime",
                "desc": "lorem"
            },
            "null_percentage": 0
        }
    ]
}

๐Ÿฒ Maintainers

This project is maintained by @AMS003010.

๐Ÿฒ License

This project is licensed under the MIT License. See the LICENSE file for details.

Commit count: 0

cargo fmt