/metaphysics

Artsy's GraphQL API

Primary LanguageJavaScriptMIT LicenseMIT

Metaphysics CircleCI

Metaphysics is a GraphQL-compliant API that wraps various Artsy APIs. You can try it here against our staging API.

It is built on express, express-graphql, and graphql. With graphiql providing a sandbox to work with.

It is currently used in production all over the place in Artsy.net, and the Artsy iOS App

Meta

Getting Setup

Read and run setup script:

$ cat bin/setup
$ bin/setup

Set up your .env file based on our example .env.test (the variables you must change for development are separated at the bottom). For Artsy staff, grab the config from 1Password.

To start up a development server, clone this repo and run:

yarn install
npm run dev

Setting up your local GraphiQL

You will need to set up headers with both:

  • x-access-token - Get your client ID and secret, use this command to generate a token.
  • x-user-id - Go to the users admin and find your user account ID.

If you need to generate a token, this command will create one for you. Add it to your .bash_rc.private and update the values between < and >.

alias generate-access-token='curl "https://stagingapi.artsy.net/oauth2/access_token?client_id=><client id>&client_secret=<client secret>&grant_type=credentials&email=<your email>&password=<your password>&scope=offline_access"'

Testing

npm test to run the entire suite npm run watch to spin up the test watcher

Docs

Deployment

PRs merged to master are deployed to staging via Circle.

We then use the heroku pipelines to deploy to production when happy with staging.

Add the staging instance as a git remote named staging:

git remote add staging git@heroku.com:artsy-metaphysics-staging.git

Then promote using the command:

$ heroku pipelines:promote -r staging