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
- Docker and Docker Compose (latest)
- tern (opens in a new tab)
- hasura CLI (opens in a new tab)
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
- Bring up the containers in
dev
withdocker-compose up -d
. - Start the Hasura Console with
hasura console --admin-secret "admin" --endpoint http://localhost:8080
. - In the
migrations
folder, runtern new $MIGRATION_NAME
and write the migration file. - Run the migration with
tern migrate
in themigrations
folder. - Track the changes on the Hasura Console (Data tab)
- Run
hasura metadata export --admin-secret "admin" --endpoint http://localhost:8080
to sync the metadata. - Git commit.