Edit: FakerQL is no longer. I recommend you check Apollo Server Mocking.
What?
FakerQL is great for frontend developers building GraphQL powered apps or GitHub demos. If you’re learning Apollo Client, FakerQL gives you the following Types you can query;
Post
Product
User
Todo
There are also various mutations available that provide fake responses used in everyday development;
register
login
updateUser
createTodo
The login
and register
mutations return a JWT which is great for applications that require authentication.
Why?
The project started a video series teaching others how to use Apollo Server to build GraphQL servers but I soon decided to grab a domain and deploy it.
Visit fakerql.com to see it in action!
How?
You can send requests to https://fakerql.com/graphql
via a library like graphql-request, via schema stitching, the hosted GraphiQL or plain old REST.
Below is an example using graphql-request
that calls for a list of 25 products and a User by id
, both completely faked results.
import { request } from 'graphql-request';
const query = `{
products: allProducts(count: 25) {
id
name
price
}
user: User(id: "wk0z1j1tzj7xc0116is3ckdrx") {
id
firstName
lastName
email
avatar
}
}`;
request('https://fakerql.com/graphql', query).then(data => console.log(data));
Going forward
The application is completely available on GitHub. You can submit a PR for any additional queries/mutations that are useful.
I hope this project helps other’s getting started with Apollo + GraphQL and removes the worry of building an actual GraphQL server.