An open API service indexing awesome lists of open source software.

https://github.com/ams003010/chimera

Chimera is a fast ⚑ Rust-based JSON server πŸ¦€ with sorting, filtering, and simulated latencyβ€”perfect for rapid API prototyping!
https://github.com/ams003010/chimera

actix-web api-rest clap-rs cli json-server mockapi rust

Last synced: 10 months ago
JSON representation

Chimera is a fast ⚑ Rust-based JSON server πŸ¦€ with sorting, filtering, and simulated latencyβ€”perfect for rapid API prototyping!

Awesome Lists containing this project

README

          

# Chimera - A Fast ⚑ & Powerful JSON Server built with Rust πŸ¦€

## πŸ”± Introduction

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

## πŸš€ Features

- **πŸ“‚ Serve JSON as an API** – Load any JSON file and serve it as structured API endpoints.
- **πŸ“Œ 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 Actix-web for speed and efficiency.
- **πŸ› οΈ Easy Configuration** – Set up ports, file paths, latency, sorting, and pagination via CLI.

## πŸ“¦ Installation

### On Windows

On Powershell (Run as Administer)
```
Invoke-WebRequest -Uri "https://github.com/AMS003010/Chimera/releases/download/v0.2.0/chimera-windows.exe" -OutFile "chimera.exe"
```

On Powershell (non-privileged)
```
.\chimera.exe --path data.json
```

### On Linux and Mac

```
curl -sL $(curl -s https://api.github.com/repos/AMS003010/chimera/releases/latest | jq -r '.assets[] | select(.name | test("chimera.*")) | .browser_download_url') -o chimera
chmod 777 chimera
./chimera --path data.json
```

## πŸ—οΈ Usage

### Start the Server

```sh
./chimera --path data.json
```

### Available Options

| Flag | Description |
|-----------------|--------------------------------------------------|
| `--path ` | Path to the JSON file (Required) |
| `--port ` | Specify the server port (Default: 8080) |
| `--latency ` | Simulated latency in milliseconds (Optional) |
| `--sort ` | Sort route data dynamically |
| `--page ` | Paginate GET responses (Default: 0 - No Limit) |

## πŸ“‘ API Endpoints

| Method | Endpoint | Description |
| -------- | --------------- | -------------------------------- |
| `GET` | `/ping` | Health check (`Pong πŸ“`) |
| `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 |

## πŸ“œ Example JSON File (`data.json`)

```json
{
"users": [
{ "id": 1, "name": "Alice", "age": 25 },
{ "id": 2, "name": "Bob", "age": 30 }
],
"posts": [
{ "id": 1, "title": "Rust is amazing!" }
]
}
```

## 🌟 Why Chimera?

- **Lightweight & Fast** – Runs efficiently with minimal resource usage.
- **Highly Configurable** – Tailor it to your needs with CLI flags.
- **Built for Developers** – Ideal for testing, prototyping, and mock API creation.

## πŸ“œ License

Chimera is licensed under the MIT License.

---

## πŸ‘¨β€πŸ’» Maintainers
This project is maintained by [@AMS003010](https://github.com/AMS003010).

---

## πŸ“œ License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

## πŸ’‘ Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.

---

## πŸ“© Contact
For any queries or issues, feel free to reach out via GitHub Issues.

Happy Coding! πŸš€