midnight-indexer:indexer-architecture

Index Midnight blockchain data into PostgreSQL or SQLite and expose it via GraphQL.

37|9|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/devrelaicom/midnight-expert --skill midnight-indexer-indexer-architecture
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: midnight-indexer:indexer-architecture
Source: https://github.com/devrelaicom/midnight-expert/tree/main/plugins/midnight-indexer/skills/indexer-architecture
Command: npx skills add https://github.com/devrelaicom/midnight-expert --skill midnight-indexer-indexer-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a complete architecture and operational guide to index Midnight blockchain data, enabling teams to collect, store, and serve on-chain state and transactions for wallets and DApps.

Core Features & Use Cases

  • Component Overview: Describes chain-indexer, wallet-indexer, indexer-api, spo-indexer, indexer-common, and the indexer-standalone binary.
  • Deployment Modes: Explains standalone (SQLite) for local development and cloud (PostgreSQL + NATS) for production, plus scaling and failure-mode behavior.
  • Operational Guidance: Covers node WebSocket connectivity, database choices, NATS messaging subjects and defaults, telemetry options, and required environment variables such as APP__INFRA__SECRET.
  • Use Case: Run a local devnet indexer for quick contract iteration or deploy separate cloud services for high-availability production querying via GraphQL.

Quick Start

Start the indexer in standalone mode by setting APP__INFRA__NODE__URL to your node WebSocket, APP__INFRA__STORAGE__CNN_URL to a local SQLite path, ensure APP__INFRA__SECRET is set, and run the indexer-standalone binary.

Frequently Asked Questions about midnight-indexer:indexer-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I index Midnight blockchain data into a relational database?▼

You can index Midnight blockchain data by running an indexer that connects to a Midnight node over WebSocket, stores chain state and transactions in PostgreSQL or SQLite, and exposes everything through a GraphQL API for querying.

What is the best way to deploy a Midnight indexer for local development?▼

For local development, use standalone mode with SQLite by setting APP__INFRA__NODE__URL to your node WebSocket, APP__INFRA__STORAGE__CNN_URL to a local SQLite path, and running the indexer-standalone binary with APP__INFRA__SECRET configured.

Can I use PostgreSQL and NATS for a high-availability Midnight indexer deployment?▼

Yes, Midnight indexers support cloud mode for high-availability production deployments by using PostgreSQL for storage and NATS messaging to scale separate chain-indexer, wallet-indexer, spo-indexer, and indexer-api services across failure modes.

What environment variables do I need to run a Midnight indexer?▼

You must set APP__INFRA__SECRET and related APP__ environment variables, including APP__INFRA__NODE__URL for the WebSocket connection and APP__INFRA__STORAGE__CNN_URL for the database connection string.

Does the Midnight indexer support querying indexed on-chain data through GraphQL?▼

Yes, the Midnight indexer exposes indexed on-chain state and transactions through a GraphQL API, allowing wallets and DApps to query served blockchain data directly.

When should I use SQLite instead of PostgreSQL for Midnight blockchain indexing?▼

Use SQLite for Midnight blockchain indexing in standalone mode during local development or devnet testing, whereas PostgreSQL is intended for cloud production deployments requiring scaling and NATS messaging.