Getting started / Quickstart

Quickstart

From zero to your first indexed table. Follow along in your terminal.

~2 min5 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

Magic-link sign-in: enter your email, then the 6-digit code from your inbox. Reads are public; deploying needs auth.

terminal
$ sl login
3

Create from a template

Scaffolds a one-file subgraph (schema, triggers, and handler), ready to edit or deploy as-is.

terminal
$ sl subgraphs create my-balances --template sip-010-balances
4

Deploy it

Indexes forward from the chain tip and keeps the table live as new blocks arrive; paid plans backfill full history.

terminal
$ sl subgraphs deploy subgraphs/my-balances.ts
5

Query it

Live on /v1 immediately; managed deploys are public, no auth to read.

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

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