Data Stack
Graph

CIC Graph

Central CIC Stack Postgres store specifically for indexing:

  • Transactional data from the chain
  • Custodial user data (PII, custodial client data)
  • Voucher data (backers, certifications, e.t.c.)
  • VPAs (Virtual Payment Addresses)
  • Marketplace data (proposed)

Relationships, check constraints and referential integrity are built in at the Postgres level. However, CIC Graph is meant to be complemented by secondary backend services to provide CRUD and any other important functionality around it.

Primarily Hasura is supported as a GraphQL proxy backend in front of it. Additionally, other 3rd party proxies such as Supabase and PostgREST are expected to work on top of the Postgres schema defined in migrations.

Hasura Development

Prerequisites

Hasura expects a metadata definition consistent with the underlying Postgres schema.

For ease of testing and development, a Docker image which bakes in the migrations and metadata files is provided (Dockerfile). The dev folder also contains a docker-compose.yaml file to quickly get started.

Below is an example of how to add a table and sync the git repo with the changes.

Adding a new table

  1. Bring up the containers in dev with docker-compose up -d.
  2. Start the Hasura Console with hasura console --admin-secret "admin" --endpoint http://localhost:8080.
  3. In the migrations folder, run tern new $MIGRATION_NAME and write the migration file.
  4. Run the migration with tern migrate in the migrations folder.
  5. Track the changes on the Hasura Console (Data tab)
  6. Run hasura metadata export --admin-secret "admin" --endpoint http://localhost:8080 to sync the metadata.
  7. Git commit.