Getting Started


Using Typescript with Apibara

You can use Typescript with Apibara to implement fully type-safe indexers. This means you can take advantage of modern Typescript libraries such as Zod, Starknet.js, and Viem.

Getting started#

You can import types from the @apibara/indexer package. Since the Apibara runtime is based on Deno, you need to import the package from a CDN such as Skypack or Please refer to the Deno documentation to learn more about importing NPM packages in Deno.

The following example shows how to use the @apibara/indexer package to type the exported configuration and transformer function.

import type { Config } from "";
import type {
} from "";
import type { Console } from "";
export const config: Config<Starknet, Console> = {
streamUrl: "",
network: "starknet",
filter: {
header: {},
startingBlock: 800_000,
sinkType: "console",
sinkOptions: {},
export default function transform(block: Block) {
// transform data here.

You can learn more about the package types and modules in the package repository.

Edit on GitHub