README
¶
gqldummy
GraphQL schema file from dummy data server. Powered by gofakeit.
Feed it any .graphql schema and get a working GraphQL endpoint that returns realistic fake data — no resolvers, no database, no setup.
Features
- Any GraphQL schema file to instant dummy API
- Smart field-name detection (e.g.
email→ email,createdAt→ datetime) - Query directives to control generated data (
@dummy_email,@dummy_int(min: 1, max: 100), etc.) - Built-in GraphiQL UI
- CORS enabled
- Supports Object, Enum, Union, Interface, InputObject, custom Scalar types
Install
go install github.com/Yamashou/gqldummy@latest
Quick Start
gqldummy schema.graphql
Server starts at http://localhost:8080/graphql with GraphiQL at http://localhost:8080/.
Usage
gqldummy <schema.graphql> [...] Start server (shorthand)
gqldummy serve [options] <schema.graphql> Start server
gqldummy directives Show available query directives
gqldummy help Show help
Options
| Option | Default | Description |
|---|---|---|
--port |
8080 |
Port to listen on |
--list-size |
3 |
Default number of items in list fields |
Examples
# Start on custom port with larger lists
gqldummy serve --port 3000 --list-size 5 schema.graphql
# Load multiple schema files
gqldummy serve schema/*.graphql
Query Directives
Add directives to fields in your GraphQL query to control dummy data generation. Without directives, gqldummy auto-detects appropriate data from field names and types.
Data Control
| Directive | Description | Example |
|---|---|---|
@dummy(type: "email") |
Specify data type by name | name @dummy(type: "email") |
@dummy_custom(value: "hello") |
Always return a fixed value | name @dummy_custom(value: "hello") |
@dummy_list_size(size: 5) |
Override list item count | posts @dummy_list_size(size: 5) { ... } |
@dummy_int(min: 0, max: 100) |
Random integer in range | age @dummy_int(min: 18, max: 65) |
@dummy_float(min: 0, max: 100) |
Random float in range | score @dummy_float(min: 0, max: 100) |
Shorthand Directives
| Directive | Output |
|---|---|
@dummy_name |
Full name |
@dummy_first_name |
First name |
@dummy_last_name |
Last name |
@dummy_email |
Email address |
@dummy_phone |
Phone number |
@dummy_username |
Username |
@dummy_url |
URL |
@dummy_uuid |
UUID v4 |
@dummy_city |
City name |
@dummy_state |
State name |
@dummy_country |
Country name |
@dummy_zip |
Zip / postal code |
@dummy_latitude |
Latitude |
@dummy_longitude |
Longitude |
@dummy_company |
Company name |
@dummy_job_title |
Job title |
@dummy_sentence |
Random sentence |
@dummy_paragraph |
Random paragraph |
@dummy_date |
Date (RFC3339) |
@dummy_image |
Image URL |
@dummy_color |
Hex color code |
@dummy_ip |
IPv4 address |
@dummy_price |
Price (1-1000) |
@dummy_currency |
Currency code |
@dummy_user_agent |
User-Agent string |
@dummy_bool |
Random boolean |
Query Example
query {
users @dummy_list_size(size: 5) {
id
name @dummy_name
email @dummy_email
age @dummy_int(min: 18, max: 65)
role @dummy(type: "job_title")
posts @dummy_list_size(size: 2) {
title @dummy_sentence
}
}
}
Smart Field Detection
gqldummy automatically generates appropriate data based on field names without any directives:
| Field Name | Generated Data |
|---|---|
id, *Id |
UUID |
email |
Email address |
name, fullName |
Full name |
firstName, first_name |
First name |
phone |
Phone number |
url, link, href |
URL |
avatar, image, photo |
Image URL |
title |
Short sentence |
description, body, bio |
Paragraph |
*At (e.g. createdAt) |
DateTime (RFC3339) |
age (Int) |
18-80 |
*Count |
0-100 |
License
MIT
Documentation
¶
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.