Giter VIP home page Giter VIP logo

media-supergraph's Introduction

Apollo GraphOS for Media

This repo provides a demonstration supergraph for a media business containing media and users subgraphs. You can explore the schema and run queries against it in Apollo Studio. We encourage you to also use the schema as inspiration for your own media supergraph!

Getting Started

In order to get started, you must first install all required packages and ensure you are running the following versions:

Router version v1.22.0
Federation v2.4
Apollo Server v4
node v20

Once you have checked each of these versions, then install all dependencies:

npm i

locally run Subgraphs:

npm run dev

locally run Router:

npm run router

Locally run the subscriptions subgraph

npm run subscriptions

NOTE: If this is your first time running the project, make sure you have first downloaded the latest version of Router (v1.22.0+ for Subscriptiona support) using the following command:

curl -sSL https://router.apollo.dev/download/nix/latest | sh

View the Schema

This demo is published to the Apollo Solutions organization in Apollo Studio with the graph ID apollo-media-supergraph.

You can also view and share the public variant to run queries right from Explorer.

What's Inside

If you would like to run some sample operations, checkout the public Operation Collections in Explorer.

We also have a series of blog posts on media best practices that dive into different elements of this schema to illustrate how Apollo GraphOS helps power essential features of modern media applications:

  • Blogs currently in progress

GraphOS Features Demonstrated in Repo

Below is the list of GraphOS Specific features that are demonstrated in this repo:

  • @Defer
  • Subscriptions
  • Entity Interface

Subscriptions Consideration

This repo runs a monolithic express server for all subgraphs purely for demo purposes. However, in order to suport subscriptions we need to support web sockets from Router to Subgraph. Therefore we run a separate subgrpah server for the trending subgraph to demonstrate this feature.

You can actually curl this Subscriptions endpoint via Router as well via the following:

curl 'http://localhost:4000/' -v \
  -H 'accept: multipart/mixed; boundary="graphql"; subscriptionSpec=1.0, application/json' \
  -H 'content-type: application/json' \
  --data-raw '{"query":"subscription TrendingMedia { trendingMedia { id }}","operationName":"TrendingMedia"}'

Local Development

If you want to run this supergraph locally you can clone this GitHub repo and follow the instructions in DEV.md.

Disclaimer

The code in this repository is experimental and has been provided for reference purposes only. Community feedback is welcome but this project may not be supported in the same way that repositories in the official Apollo GraphQL GitHub organization are. If you need help you can file an issue on this repository, contact Apollo to talk to an expert, or create a ticket directly in Apollo Studio.

media-supergraph's People

Contributors

daljitsumman avatar dependabot[bot] avatar joedevine avatar kschrade avatar lennyburdette avatar mandiwise avatar smyrick avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.