Back to Common Questions

Common Questions / Pipelines and databases

How do I serve blockchain data over GraphQL without running an API server?

Updated

Enable the GraphQL layer on a Hosted Sink. It deploys a managed, read-only GraphQL API and browser console over the Postgres or ClickHouse database your sink writes into. It is powered by Hasura and enabled with a single checkbox, at creation or any time afterwards.

What do I get?

  • Automatic schema. Every table and view in the sink's target schema becomes a GraphQL query field. New tables the sink creates later are picked up, and so are views you add.
  • Read-only. Requests run with a database role that has SELECT and nothing else. No mutation fields are generated, and the sink stays the only writer.
  • A browser console. Explore the schema, build queries, and save any query as a REST endpoint under /api/rest. It signs in with your existing portal session.
  • Both databases. Postgres and ClickHouse.
  • No coupling to the pipeline. It is a separate deployment, so turning it on or off never touches the sink.

How do requests authenticate?

With an API key from your organization on The Graph Market, in an X-Api-Key header:

curl https://<your-sink-endpoint>/v1/graphql \
  -H "X-Api-Key: <your-api-key>" \
  -d '{"query":"{ __typename }"}'

A subgraph query key is a different credential and will not work; create a new key in the portal.

How do I turn it on?

New sink: at the GraphQL API step of the New Sink wizard, select Expose a GraphQL API over this database. Existing sink: open its detail page, click Edit, and enable it on the GraphQL tab. Once it reports Deployed, the endpoint and console link appear in the sink's GraphQL panel. The GraphQL layer guide has the details.

Is this a replacement for a subgraph?

It covers the query side that subgraph users are used to — the GraphQL protocol, a browsable console, and REST endpoints — while the indexing runs on Substreams with parallel backfills and more output options. See how to migrate from a subgraph to Substreams.


Frequently asked questions

Who hosts the database? You do. StreamingFast runs the sink process and, optionally, the GraphQL layer; the database is yours (your own instance, or Supabase, Neon, ClickHouse Cloud and similar).

Can clients write through it? No.

Can I add it to a sink that is already running? Yes, without interrupting the pipeline.


Set one up at thegraph.market.

Related: What are Hosted Sinks? · How do I get blockchain data into Postgres? · Subgraph vs API — which should you use?