Back to Examples

Apibara

This page contains the Apibara documentation as a single document for consumption by LLMs.

Lines
5,565
Sections
88

Want your own llms.txt file?

Generate a professional, AI-friendly file for your website in minutes!

llms.txt Preview

This page contains the Apibara documentation as a single document for consumption by LLMs.

---
title: Apibara documentation
titleShort: Overview
description: "Welcome to the Apibara documentation. Find more information about the Apibara protocol."
priority: 1000
fullpage: true
---

<DocumentationIndex />


---
title: Installation
description: "Learn how to install and get started with Apibara."
diataxis: tutorial
updatedAt: 2025-06-11
---

# Installation

This tutorial shows how to setup an Apibara project from scratch. The goal is to
start indexing data as quickly as possible and to understand the basic structure
of a project. By the end of this tutorial, you will have a basic indexer that
streams data from two networks (Ethereum and Starknet).

## Installation

This tutorial starts with a fresh Typescript project. In the examples, we use
`pnpm` as the package manager, but you can use any package manager you prefer.

Let's start by creating the project. The `--language` flag specifies which language
to use to implement indexers, while the `--no-create-indexer` flag is used to
delay the creation of the indexer.

:::cli-command

```bash [Terminal]
mkdir my-indexer
cd my-indexer
pnpm dlx apibara@next init . --language="ts" --no-create-indexer
```

```
ℹ Initializing project in .
✔ Created  package.json
✔ Created  tsconfig.json
✔ Created  apibara.config.ts

✔ Project initialized successfully
```

:::

After that, you can install the dependencies.

```bash [Terminal]
pnpm install
```

## Apibara Config

Your indexers' configuration goes in the `apibara.config.ts` file. You can
leave the configuration as is for now.

```typescript [apibara.config.ts]
import { defineConfig } from "apibara/config";

export default defineConfig({
  runtimeConfig: {},
});
```

## API Key

The streams hosted by Apibara require an API key.

- [Sign up for a free account](https://app.apibara.com),
- Create an API key,
- Export the API key as the `DNA_TOKEN` environment variable.

## EVM Indexer

Let's create the first EVM indexer. All indexers must go in the `indexers`
directory and have a name that ends with `.indexer.ts` or `.indexer.js`.
The Apibara CLI will automatically detect the indexers in this directory and
make them available to the project.

You can use the `apibara add` command to add an indexer to your project. This
command does the following:

- gathers information about the chain you want to index.
- asks about your preferred storage solution.
- creates the indexer.
- adds dependencies to your `package.json`.

:::cli-command

```bash [Terminal]
Preview of Apibara's llms.txt file. View complete file (5,565 lines) →

Ready to create yours?

Generate a professional llms.txt file for your website in minutes with our AI-powered tool.

Generate Your llms.txt File