Getting started / Quickstart

Quickstart

From zero to your first indexed table — follow along in your terminal.

~2 min4 commandsno key to read
1

Install the CLI

One global binary — works with bun, npm, or pnpm.

terminal
$ bun add -g @secondlayer/cli
2

Authenticate

Opens your browser to sign in. Reads are public; deploying needs a key.

terminal
$ sl auth login
3

Deploy a subgraph

Secondlayer backfills history, then keeps the table live as new blocks arrive.

terminal
$ sl subgraphs deploy ./subgraph.config.ts
4

Query it

Live over REST immediately — no auth required to read.

terminal
$ curl https://api.secondlayer.tools/api/subgraphs/sbtc-flows/transfers -G -d "_limit=10"
That’s a live table.

Next: write your first handler, or wire up push delivery.