D
D
Documentation
Search…
Litentry Graph

Repository

GitHub - litentry/litentry-graph: A collection of JS applications to extract, store and retrieve on chain data
GitHub

Overview

Litentry Graph uses Yarn Workspaces. It has the GraphQL server as the main application and the subschemas are packages in the subschemas directory. Remote schemas are stitched together with the subschemas in the GraphQL server application.

Getting Started

1
git clone [email protected]:litentry/litentry-graph.git
2
cd litentry-graph
3
yarn
4
yarn start
Copied!
To run with production config add .env to litentry-graph/graphql-server and set STAGE=production

Adding Remote Schemas

Go into graphql-server/src/config/development.ts and graphql-server/src/config/production.ts and add a new object with the URL and the name of the schema. Everything else is automatic.

Adding Subschemas

  • Create a new package in the subschemas directory
  • Give it a name & version in package.json
  • Add it as a dependency in graphql-server/package.json
  • Import the schema in graphql-server/src/index.ts
  • Wrap it to give it a prefix (see code below)
  • Add it too the subschemas array at the bottom of the makeAggregatedSchema method
1
const wrappedSchema = wrapSchema({
2
schema: importedSchema,
3
transforms: [
4
new RenameTypes((name) => `PrefixName${capitalize(name)}`),
5
new RenameRootFields((_, name) => `PrefixName${capitalize(name)}`),
6
],
7
});
Copied!