• Stars
    star
    355
  • Rank 119,764 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 9 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Artsy's GraphQL API

Metaphysics

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 CircleCI codecov

Getting Setup

To get yourself set up with all the project's dependencies:

git clone https://github.com/artsy/metaphysics
cd metaphysics

# Run the setup script
./scripts/setup.sh

This will pull the environment variables from aws into .env.shared. It will also overwrite .env with the values in .env.example. If you need to override any of these values or add new .env values place them in the .env file.

Development

With your dependencies set up, you can run Metaphysics by running:

yarn start

Which will start the server on http://localhost:3000

Be sure that memcached is no longer running before starting hokusai by running

brew services stop memcached

Recommended: You can run the commands inside the terminal in VS Code, then the debugger will be hooked up by default.

Setting up your local GraphiQL

We recommend the graphiql.app client for testing queries locally.

You will need to set up headers with both:

  • x-access-token - Open https://staging.artsy.net, sign in and evaluate sd.CURRENT_USER.accessToken in a dev console (CMD+Shift+C in Chrome).
  • x-user-id - As above, but sd.CURRENT_USER.id.

If you're new to GraphQL, you can checkout Artsy's GraphQL Workshop.

For GraphQL Endpoint, set it to http://localhost:3000/v2.

Note that /v2 is the default and /v1 has been fully deprecated and removed.

Introspection Setup

Getting docs for the schema on MP in your playground of choice (Postman, Insomnia, Altair, etc) is called introspection.

Introspection is available by default when developing.

Introspection on staging and production are for internal use only, so artsy devs can use it to make development for MP clients (eigen, force, etc) easier, but it is and should not be used by any of the clients or anyone else.

In order to set this up in your playground of choice (Postman, Insomnia, Altair, etc), you need to send the following header:

Authorization: Bearer <secret>

and replace <secret> with the value you get from hokusai using

hokusai staging env get INTROSPECT_TOKEN
hokusai production env get INTROSPECT_TOKEN

or the contents of Metaphysics INTROSPECT_TOKEN in 1Password.

Sample Queries

Once you have the GraphiQL client running against your local service, you can verify things are working by executing these queries:

Get your account information

{
  me {
    name
    email
  }
}

If any of these queries fail, it's probable that you misconfigured your x-access-token or x-user-id HTTP headers.

Docs

Docker and Kubernetes setup

This is deployed using Hokusai to manage Docker and Kubernetes. To replicate this:

  • Install Docker for Mac and Hokusai

    $ brew tap caskroom/cask && brew cask install docker
    $ pip install hokusai

    If you are using your system Python distribution, you may need to run this as:

    $ sudo pip install hokusai --ignore-installed
  • Configure Hokusai

    export AWS_ACCESS_KEY_ID={{ MY_AWS_ACCESS_KEY_ID }}
    export AWS_SECRET_ACCESS_KEY={{ MY_AWS_SECRET_ACCESS_KEY }}
    hokusai configure --kubectl-version {{ kubectl_version }} --s3-bucket {{ kubectl_config_s3_bucket }} --s3-key {{ kubectl_config_s3_key }}
    hokusai check

    Artsy staff should find follow the instructions in https://github.com/artsy/potential/blob/main/platform/Kubernetes.md#hokusai

  • Start the server

    hokusai dev start

Testing

  • Run tests in the Docker Compose test stack via Hokusai:

    hokusai test
  • Or, to run tests locally: npm test to run the entire suite npm run watch to spin up the test watcher

About Artsy

This project is the work of engineers at Artsy, the world's leading and largest online art marketplace and platform for discovering art. One of our core Engineering Principles is being Open Source by Default which means we strive to share as many details of our work as possible.

You can learn more about this work from our blog and by following @ArtsyOpenSource or explore our public data by checking out our API. If you're interested in a career at Artsy, read through our job postings!

More Repositories

1

eigen

The Art World in Your Pocket or Your Trendy Tech Company's Tote, Artsy's mobile app.
TypeScript
3,480
star
2

eidolon

The Artsy Auction Kiosk App.
Swift
2,711
star
3

fresnel

An SSR compatible approach to CSS media query based responsive layouts for React.
TypeScript
1,098
star
4

README

👋 - The documentation for being an Artsy Engineer
TypeScript
1,044
star
5

artsy.github.io

The Artsy Engineering Open-Source Developers Blog
SCSS
1,015
star
6

emission

⚠️ Deprecated repo, moved to artsy/eigen ➡️ React Native Components
TypeScript
621
star
7

force

The Artsy.net website
TypeScript
550
star
8

reaction

Artsy's publishing components
TypeScript
355
star
9

Emergence

TV. Shows.
Swift
353
star
10

garner

A set of Rack middleware and cache helpers that implement various caching strategies.
Ruby
347
star
11

scroll-frame

Retain your scroll position between pages using an iframe. Especially helpful for infinite scrolling views.
JavaScript
312
star
12

ezel

A boilerplate for Backbone projects that share code server/client, render server/client, and scale through modular architecture.
JavaScript
294
star
13

Swift-at-Artsy

Repo for the notes for Swift at Artsy
Swift
284
star
14

energy-legacy

LEGACY - Artsy Folio, The Partner iPhone / iPad app.
Objective-C
209
star
15

palette

Artsy's design system
TypeScript
203
star
16

react-redux-controller

Library for creating a controller layer to link React and Redux, on top of react-redux.
JavaScript
97
star
17

hokusai

Artsy's Docker / Kubernetes CLI and Workflow
Python
87
star
18

positron

Positron is Artsy Writer or the editorial tool and API for Artsy.
TypeScript
85
star
19

day-schedule-selector

A jQuery plugin to render a weekly schedule and allow selecting time slots in each day.
JavaScript
85
star
20

mobile

Mobile Team TODO
84
star
21

benv

Stub a browser environment in node.js and headlessly test your client-side code.
JavaScript
72
star
22

flare

Artsy iPhone Launch Marketing Page
CoffeeScript
63
star
23

team-navigator

An internal HR product for Artsy's team
JavaScript
62
star
24

sharify

Easily share data between Browserify modules meant to run on the server and client.
JavaScript
61
star
25

x-react-native

Conference Details for Artsy x React Native
TypeScript
49
star
26

backbone-super-sync

Isomorphic Backbone.sync adapter using superagent.
JavaScript
47
star
27

jenkins-backup-s3

A collection of scripts to backup Jenkins configuration to S3, as well as manage and restore those backups
Python
46
star
28

graphql-slack-updater

A weekly Travis task that sends our GraphQL updates to Slack
Ruby
40
star
29

meta

Artsy on Artsy.
39
star
30

Specs

The Artsy CocoaPods Specs
Ruby
37
star
31

doppler

Artsy.net developer website.
Ruby
37
star
32

detect-responsive-traits

Determine responsive traits to only server-side render markup truly needed.
TypeScript
36
star
33

gris

Gris is a framework for building hypermedia API services using Grape, Roar and ActiveRecord
Ruby
35
star
34

artsy-2013

The 2013.artsy.net static site using Node.js for some preprocessors.
CoffeeScript
33
star
35

the-art-genome-project

Gene names and definitions
JavaScript
33
star
36

elderfield

The Artsy Alexa (Echo) skill.
JavaScript
33
star
37

peril-settings

Artsy's peril settings
TypeScript
30
star
38

2014.artsy.net

CoffeeScript
25
star
39

artsy-ruby-client

Artsy API Ruby Client
Ruby
25
star
40

express-reloadable

Automatically hot-swap Express server code without the restart
JavaScript
25
star
41

Artsy-Authentication

Cocoa libraries dealing with Authentication for Artsy. Yawn, boring
Objective-C
22
star
42

dupe-report

A tool for reporting new webpack bundle duplicates to github and slack
TypeScript
21
star
43

Artsy-UILabels

This is our Artsy styled UILabel subclasses.
Objective-C
20
star
44

Artsy-OSSUIFonts

Open source variants of the Artsy fonts, wrapped as a CocoaPod
Beef
18
star
45

Mitosis

Artsy Chat Bot for Facebook Messenger
JavaScript
17
star
46

atomic-store

Atomic event store for Scala/Akka
Scala
17
star
47

momentum

Shared utilities for managing and deploying OpsWorks apps at Artsy. [DEPRECATED]
Ruby
15
star
48

orbs

CircleCI orbs used at Artsy
Shell
15
star
49

lint-changed

Lint files that have changed since master
TypeScript
14
star
50

artsy-eigen-web-association

A tiny app that serves the apple-app-site-association required for iOS Handoff related features.
JavaScript
14
star
51

javascriptures

Demo projects for javascripture sessions
JavaScript
14
star
52

estella

Make your Ruby objects searchable with Elasticsearch.
Ruby
13
star
53

echo

Eigen's floating administration lab up in the clouds
Shell
13
star
54

graphql-workshop

A workshop for understanding GraphQL by exploring Metaphysics
13
star
55

Artsy-UIColors

Consolidated UIColors used in the Artsy iOS Apps
Ruby
12
star
56

emission-nebula

Handles weekly deploys of Emission to TestFlight
Ruby
12
star
57

cohesion

Artsy's analytics schema
TypeScript
12
star
58

yeoman-generator-artsy

A Yeoman generate for Artsy CLI apps
JavaScript
11
star
59

stitch

Helps your Component and Template dependencies peacefully coexist
JavaScript
11
star
60

renovate-config

Shared renovate configurations
JavaScript
11
star
61

vscode-artsy

A VS Code extension for the Artsy Tech Stacks
11
star
62

money_helper

A simple module to assist in formatting unambiguous prices and price ranges in international currencies
Ruby
11
star
63

artsy-passport

Wires up the common auth handlers for Artsy's node based apps using http://passportjs.org.
JavaScript
10
star
64

aprb

[Deprecated] Artsy public radio notifications in Slack.
Elixir
10
star
65

next

Tools an utilites for Next.js by Artsy
JavaScript
10
star
66

eigen-artefacts

CocoaPods dependencies used in Eigen.
C++
10
star
67

Artsy-UIButtons

Artsy's UIButton subclasses
Objective-C
10
star
68

codemods

Various codemods used around Artsy
TypeScript
10
star
69

relay-workshop

Home for Artsy's Relay peer learning tutorials
TypeScript
9
star
70

studio

TypeScript
9
star
71

palette-zeplin-extension

See Artsy's palette components inside Zeplin directly
JavaScript
9
star
72

artsy.github.io-gatsby

re-write Engineering Blog
TypeScript
8
star
73

biesenbach

The Artsy Google Home application.
JavaScript
8
star
74

microgravity-deprecated

The Artsy.net mobile website:
CoffeeScript
8
star
75

palette-mobile

Artsy's Design System on Mobile
TypeScript
8
star
76

Aerodramus

An Objective-C API for interacting with artsy/echo
Objective-C
8
star
77

aprd

Artsy's Real-time Slack Notification Service (aka Artsy Public Radio)
Elixir
8
star
78

artsy-backbone-mixins

A library of Backbone mixins that DRY up some common domain logic and Artsy API rabbit holes.
JavaScript
8
star
79

energy

Artsy Folio, The Partner iPhone / iPad app.
TypeScript
7
star
80

backbone-cache-sync

Server-side Backbone.sync adapter that caches requests using Redis.
JavaScript
7
star
81

kaws

API for collections, our SEO optimized marketing landing pages
TypeScript
7
star
82

horizon

Visual representations of release pipelines
Ruby
7
star
83

guides

The Engineers Guide to the Artsy Universe
7
star
84

hack-playdate-gallery

Lua
7
star
85

forque

A home for modern admin UIs; successor to Torque
TypeScript
7
star
86

APR

Artsy Private Radio
Elixir
7
star
87

browserify-dev-middleware

Middleware to compile browserify files on request for development purpose.
JavaScript
7
star
88

artsy-xapp

Tiny lib to fetch and refresh an xapp token from Artsy
JavaScript
7
star
89

auto-config

Artsy's shared auto release config
6
star
90

volley

Datadog StatsD ingestion for client-side data
TypeScript
6
star
91

rosalind

Admin app for batch operations on genomes
JavaScript
6
star
92

bucket-assets

Uploads a folder of static assets to an s3 bucket with convenient defaults.
JavaScript
6
star
93

extraction

UI components shared between Eigen and Emission.
Objective-C
6
star
94

to-title-case

Capitalizes your titles as per The Chicago Manual of Style
TypeScript
6
star
95

miasma

Smoke tests for Artsy, and possible successor to Vapor
JavaScript
6
star
96

update-repo

JS library for updating other repositories
TypeScript
6
star
97

cli

TypeScript
6
star
98

convection

Rails application for consignments
Ruby
5
star
99

performance-monitor

TypeScript
5
star
100

graphql-page_cursors

Add page cursors to your Rails GQL schema
Ruby
5
star