Lightweight server (rumor) for serving mock data via gRPC and HTTP/JSON APIs; backed by JSON files for storage.
Use rumor-fake to generate fake data from JSON-based schema (supports both simplified schema and standard JSON Schema formats).
rumor
go install github.com/jimschubert/rumor/cmd/rumor@latestrumor-fake
go install github.com/jimschubert/rumor/cmd/rumor-fake@latestOr build from source:
git clone https://github.com/jimschubert/rumor
cd rumor
make build build-fakeGenerate fake data using an embedded example schema (or bring your own):
./dist/rumor-fake users.schema.jsonThis creates db.json with 10 fake user records. The tool includes embedded examples (users.schema.json,
products.schema.json, addresses.schema.json) that can be referenced by name,
or you can provide a path to your own schema file.
You can generate multiple schemas into the same existing file.
Run ./dist/rumor-fake --help for more options.
Start the server:
./dist/rumorAccess your data at http://localhost:8080/api/users or via gRPC on port 9090.
Note
The gRPC server exposes reflection, so you can more easily discover usage via Postman (or other tools supporting gRPC reflection)
./dist/rumor --help
Usage: rumor [flags]
A simple gRPC/HTTP server for storing and retrieving JSON records, with a file-based JSON database.
Flags:
-h, --help Show context-sensitive help.
--db-path="db.json" Path to JSON database file
--grpc-address="localhost:9090" gRPC TCP listen address
--http-address="localhost:8080" HTTP/JSON listen address
-v, --version Print version informationExample:
./dist/rumor --db-path data.json --http-port 3000 --grpc-port 5000./dist/rumor-fake --help
Usage: rumor-fake <schema> [flags]
Generate fake data for the rumor server based on a schema definition.
Arguments:
<schema> Path to JSON schema file defining the data structure
Flags:
-h, --help Show context-sensitive help.
-c, --count=10 Number of records to generate
-r, --resource=STRING Resource name (defaults to schema filename without extension)
-o, --output="db.json" Output JSON database file
-v, --version Print version informationExample:
./dist/rumor-fake -c 50 users.schema.json -o /tmp/rumor-fake-demo.jsonBoth simplified and standard JSON Schema formats are supported with automatic detection.
Simplified format (users.schema.json):
{
"fields": {
"email": {"type": "email"},
"first_name": {"type": "first_name"},
"last_name": {"type": "last_name"},
"company": {"type": "company"},
"status": {"type": "string", "value": "active"}
}
}JSON Schema format:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"email": {"type": "string", "format": "email"},
"first_name": {"type": "string", "format": "first_name"},
"last_name": {"type": "string", "format": "last_name"},
"company": {"type": "string", "format": "company"},
"status": {"type": "string", "const": "active"}
}
}See internal/faker/doc.go for supported field types and formats.
You can try out a working demo with the provided example schemas:
make fake-demoThis will start the server:
- gRPC → tcp://localhost:9090
- REST → http://localhost:8080
The HTTP endpoints are automatically generated based on the resource name.
For example, if your schema is users.schema.json (or you ran make fake-demo above), the resource is users and the endpoints are:
# GET /api/{resource}
curl http://localhost:8080/api/users
# GET /api/{resource}/{id}
curl http://localhost:8080/api/users/1
# POST /api/{resource}
# note: data does not have to be the same format for each user!
curl -X POST http://localhost:8080/api/users \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","first_name":"Jane"}'
# PUT /api/{resource}/{id}
curl -X PUT http://localhost:8080/api/users/1 \
-H "Content-Type: application/json" \
-d '{"email":"updated@example.com"}'
# DELETE /api/{resource}/{id}
curl -X DELETE http://localhost:8080/api/users/1See the proto definitions in the repository for service contracts. Default gRPC port is 9090.
This project is licensed under Apache 2.0.