#rest #api-mocking #json #storage #seconds #storage-file

app mocks

Mock REST APIs from JSON with zero coding within seconds

16 releases (10 stable)

1.0.9 Sep 7, 2025
1.0.5 Jul 31, 2025
0.4.6 Jul 9, 2025
0.3.7 Oct 18, 2024

#37 in HTTP server

Download history 2/week @ 2025-08-29 112/week @ 2025-09-05 12/week @ 2025-09-12 5/week @ 2025-09-19 12/week @ 2025-09-26 4/week @ 2025-10-03

2,370 downloads per month

MIT license

150KB
3K SLoC

mocks

Crates.io msrv 1.80.1 codecov Ask DeepWiki License

Mock REST APIs from JSON with zero coding within seconds.

Complete Documentation - For detailed usage, advanced features, and examples.

Install

Homebrew

If you're a macOS Homebrew user, then you can install mocks from homebrew-tap.

brew install mocks-rs/tap/mocks

Cargo

If you're a Rust programmer, mocks can be installed with cargo.

cargo install mocks

npm

If you're a Node.js user, you can install mocks globally with npm.

npm install -g mocks

Alternatively, you can run mocks without installing using npx.

npx @mocks-rs/mocks init storage.json
npx @mocks-rs/mocks run storage.json

Usage

Initialize a storage file

Create a JSON file using the init command:

mocks init storage.json

This creates a storage.json file with sample data. Use the --empty option to create an empty structure:

mocks init --empty storage.json

Run a REST API server

Start the mock server using your JSON file:

mocks run storage.json

Example JSON structure:

{
  "posts": [
    { "id": "01J7BAKH37HPG116ZRRFKHBDGB", "title": "first post", "views": 100 },
    { "id": "01J7BAKH37GE8B688PT4RC7TP4", "title": "second post", "views": 10 }
  ],
  "profile": { "id": "01J7BAQE1GMD78FN3J0FJCNS8T", "name": "mocks" }
}

This automatically creates REST endpoints:

curl http://localhost:3000/posts
curl http://localhost:3000/posts/01J7BAKH37HPG116ZRRFKHBDGB
curl http://localhost:3000/profile

Documentation

For detailed information about available routes, query parameters, advanced configuration, and more features, visit the complete documentation.

For development information, see DEVELOPMENT.md.

LICENSE

This project is licensed under the MIT license.

Dependencies

~11–25MB
~247K SLoC