An extensible Docker image and Bun.js app to create a standalone mock of a GraphQL Schema.
There are two ways to use this package
- As a docker image, under
skillsharedocker/apollo-true-mock:latest
- Directly through Bun
bun install
bun index.ts
All configuration is done through loaded files with paths customizable via ENV variables:
Note: ${currDir}
represents the current directory the script executes in, for docker this is /home/bun/app
- (Required) The type definitions for your schema. You can provide this in two ways:
- Providing an introspection endpoint using the env var
ATM_INTROSPECTION_ENDPOINT
. On startup we will userover
to grab the schema from that endpoint. - Providing the schema file directly. By default, we look for this file in
${currDir}/schema.graphql
. However, this is customizable via the env varATM_TYPE_DEFS_PATH
- Providing an introspection endpoint using the env var
- (Optional) custom type mocks. All types will automatically receive a default mock (scalar types will receive mocks based on their type. See more information here). By default, we load the default export from
${currDir}/custom-mocks.ts
. However, this is customizable via the env varATM_CUSTOM_MOCKS_PATH
A full working docker-compose example can be found in ./example