---
# System prepended metadata

title: Integrating the Subgraph Notes (4/26/22)
tags: [' subgraph', v3]

---

---
tags: v3, subgraph
---

# Integrating the Subgraph Notes (4/26/22)

- Scaffolding from The Graph's generator

## Additions

`project.json`
- Currently all geared for local development, but the goal is to make more robust for our CLI
    - Can add specific deploys to targets in the `package.json`
    - Add more functionality as needed
- `docker-compose` added -- this is what runs locally
- `nx serve baal-subgraph` 
    - Checks if the ports in the `docker-compose` are open
    - 
        - If already running or if have a local Postgres running will need to kill it or Subgraph won't run
- Pre-Requisites:
    - Docker and Graph CLI are 
    - Lock in which version of the cli we're using so that we're using the same version to reduce issues (Keating demo'ing with most recent version)
- `nx build` 
    - Code gen
- `nx stop`
    - Kills docker compose
- `nx deploy`
    - Deploys subgraph after built
- `nx create`
    - Creates local subgraph
- `nx prepare`
- `@nrwl/workspace:run-commands` plugin -- let's you chain commands as strings and run random commands
    
## Workflow

- Do we want to support pushing up to Rinkeby hosted service?
- Make sure folks are comfortable with Docker
    - Minimum version of Docker that'll be needed to support the newer syntax for `docker compose` (instead of `docker-compose`)
- Add Rage Report for the Subgraph integration
- Point to Rinkeby via the Docker Compose -- no need to run local blockchain

## GraphQL Codegen

- Won't create the queries, but can generate types and helper code based on the schema
- Syncs types -- guarantees that we'll have the type safety in our code since these are generated
- Superfluid GQL Codegen:
    - https://github.com/superfluid-finance/protocol-monorepo/blob/2a94183e14f807d542ad385fd947e1b5d539fbe4/packages/sdk-core/package.json#L46
    - Generating several files within a directory
    - Introspect the schema and then writes the schema definition to a file
    - 