{"id":24904615,"url":"https://github.com/nilaysavant/jsonox","last_synced_at":"2025-06-30T00:05:39.665Z","repository":{"id":62441417,"uuid":"330950441","full_name":"nilaysavant/jsonox","owner":"nilaysavant","description":"CLI based JSON server + store for mocking REST APIs","archived":false,"fork":false,"pushed_at":"2021-01-27T03:36:52.000Z","size":59,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T00:23:02.551Z","etag":null,"topics":["actix","actix-web","cli-app","json","json-api","json-server","json-store","mock-server","rest","rest-api","restful-api","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilaysavant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-19T10:58:08.000Z","updated_at":"2025-01-27T09:20:13.000Z","dependencies_parsed_at":"2022-11-01T22:02:06.360Z","dependency_job_id":null,"html_url":"https://github.com/nilaysavant/jsonox","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nilaysavant/jsonox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilaysavant%2Fjsonox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilaysavant%2Fjsonox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilaysavant%2Fjsonox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilaysavant%2Fjsonox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilaysavant","download_url":"https://codeload.github.com/nilaysavant/jsonox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilaysavant%2Fjsonox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262685690,"owners_count":23348451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actix","actix-web","cli-app","json","json-api","json-server","json-store","mock-server","rest","rest-api","restful-api","rust","rust-lang"],"created_at":"2025-02-01T23:26:58.001Z","updated_at":"2025-06-30T00:05:39.630Z","avatar_url":"https://github.com/nilaysavant.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonox 🛰 ![Build Release](https://github.com/nilaysavant/jsonox/workflows/Build%20Release/badge.svg?branch=v0.2.0)\n\nCLI based RESTful JSON server + store written in Rust.\n\n## Features 🚀\n\n- Setup **API endpoints** on **any route** by simply **POST**ing `JSON` to that route.\n- Endpoints support **GET** for fetching and **DELETE** for deleting stored JSON along with **POST** or **PUT**.\n- **JSON** data is stored as `*.json` files under the `jsonox_data` dir.\n- View all **active endpoints** on the root (`/`) path.\n\n**[DISCLAIMER: This program is designed for development purposes. Use in production at your own risk!]**\n\n## Installation 🔧\n\nYou can install in 3 ways: Using pre-compiled binary, from Crate or by manually building from source using rust tool-chain. Give necessary executable permissions for the binary and if building from source.\n\n### Pre-compiled Binary\n\n- Download binary for your platform from the latest [release](https://github.com/nilaysavant/jsonox/releases).\n\n  | Binary               | Platform                                                   |\n  | -------------------- | ---------------------------------------------------------- |\n  | jsonox-linux-amd64   | 64-bit Linux (Ubuntu, Debian etc)                          |\n  | jsonox-macos-amd64   | 64-bit Mac OS                                              |\n  | jsonox-win-amd64.exe | 64-bit Windows 7+                                          |\n  | jsonox-linux-armv7   | ARMv7 Linux: Raspberry PI, Debian, Ubuntu                  |\n  | jsonox-linux-armv6   | (Untested!) ARMv6 Linux: Raspberry PI Zero, Debian, Ubuntu |\n\n### Install from [Crate](https://crates.io/crates/jsonox)\n\n- Use cargo install:\n\n  ```bash\n  cargo install jsonox\n  ```\n\n### Or Build From Source\n\n- Clone the repository and run:\n\n  ```bash\n  cargo build --lock --release\n  ```\n\n- Compiled binary will be located at `target/release/jsonox`\n\n### Initial Setup (when installing from binary/source)\n\n- Set executable permission:\n\n  ```bash\n  chmod +x jsonox\n  ```\n\n- Copy binary inside your `$PATH` directory (optional):\n\n  ```bash\n  cp jsonox ~/.local/bin/ #for linux\n  ```\n\n## Usage 📡\n\nRun the server via the **CLI**, then setup **REST API endpoints** or use in [Read Only mode](#read-only-mode).\n\n### Command line (CLI)\n\nNote: In the following examples you may need to use `./jsonox` if using local binary.\n\n- Simple server with logging:\n\n  ```bash\n  jsonox\n  ```\n\n  - Runs at:\n    - http://localhost:8080/\n    - http://127.0.0.1:8080/\n    - http://0.0.0.0:8080/\n\n- Specify custom bind address:\n\n  ```bash\n  jsonox -b localhost:7000\n  ```\n\n  - Use `-b` or `--bind-addr`\n  - Address format: `\u003cIP:PORT\u003e`\n\n- Disable logging:\n\n  ```bash\n  jsonox --quiet\n  ```\n\n  - Use `-q` or `--quiet` for quiet mode.\n\n- Use **ReadOnly** mode:\n\n  ```bash\n  jsonox --read-only\n  ```\n\n  - Use `-r` or `--read-only` for [read-only mode](#read-only-mode).\n\n- View help and guide:\n\n  ```bash\n  jsonox --help\n  ```\n\n  - Use `-h` or `--help` for help.\n\n### REST API (normal mode)\n\nConstruct **REST API** endpoints on **arbitrary routes** in the following way(s):\n\n- **POST** or **PUT** the following to `/pets/cat`:\n\n  ```json\n  { \"cute\": true }\n  ```\n\n- Then **GET** at `/pets/cat` will receive:\n\n  ```json\n  { \"cute\": true }\n  ```\n\n- Similarly you can **DELETE** data stored at `/pets/cat`, this will also receive:\n\n  ```json\n  { \"cute\": true }\n  ```\n\n- The above requests will setup files under `./jsonox_data` with the following structure:\n\n  ```bash\n  - pets/\n    - cat/\n      - index.json\n  ```\n\n- `GET` on root endpoint `/` will display all active endpoints:\n\n  ```json\n  { \"active_paths\": [\"pets/cat\"] }\n  ```\n\nYou can also setup your own API by creating files under `./jsonox_data` in the structure similar as above:\n\n```bash\n- pets/\n  - dog/\n    - index.json\n  - cat/\n    - index.json\n  - index.json\n- toys/\n  - doll/\n    - index.json\n```\n\n- Then `GET` on `/` will show active endpoints:\n\n  ```json\n  { \"active_paths\": [\"pets\", \"pets/cat\", \"pets/dog\", \"toys/doll\"] }\n  ```\n\n- You can then do **GET**,**POST**, **PUT** and **DELETE** similarly, on the endpoint paths above.\n\nNOTE: **POST** and **PUT** are **interchangeable** and **work exactly the same in this mode**. This is due to the paths referred to being explicitly specific. To allow for different responses in case of POST and PUT, please consider using the [Read Only mode](#read-only-mode).\n\n### Read Only Mode\n\nIn this mode, jsonox _only reads the json files stored_ and **does NOT create/delete** them in case of **POST/DELETE** unlike in the normal mode explained above. This is useful when you **only need to simulate API responses** and when your back-end does not strictly follow the REST standards. You can also record the `./jsonox_data` in your version control to store your API response structures as it won't change based on the simulations/testing in this mode.\n\n- Start by creating files in `./jsonox_data`:\n\n  ```bash\n  - pets/\n    - dog/\n      - get.json\n      - post.json\n    - cat/\n      - get.json\n    - get.json\n    - delete.json\n  - toys/\n    - doll/\n      - get.json\n      - post.json\n      - put.json\n      - delete.json\n  ```\n\n  - In **Read Only** mode we create files like `get.json`, `post.json`, `put.json`, and `delete.json`, instead of `index.json`.\n  - `get.json` will contain the **response body** for **GET** requests to that path. Similarly `post.json`, `put.json`, and `delete.json` will contain the **response body** for **POST**, **PUT**, and **DELETE** requests to that path respectively.\n  - Thus as per above structure:\n    - `/pets` will have **GET** and **DELETE** only.\n    - `/pets/cat` will have **GET** only.\n    - `/pets/dog` will have **GET** and **POST** only.\n    - `/toys/doll` will have **GET**, **POST**, **PUT** and **DELETE**.\n\n- The files and paths created by you will not be deleted even if you do a **DELETE** on a path.\n- If you change modes in between, and do a **DELETE** in **normal mode**, this will _only delete `index.json` files at the respective paths_ and NOT delete the other `get.json`, `post.json` etc files created by you.\n\n- Similar to normal mode `GET` on `/` will show active endpoints:\n\n  ```json\n  { \"active_paths\": [\"pets\", \"pets/cat\", \"pets/dog\", \"toys/doll\"] }\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilaysavant%2Fjsonox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilaysavant%2Fjsonox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilaysavant%2Fjsonox/lists"}