npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

solana-indexer

v0.1.2

Published

Simple, powerful Solana blockchain indexer

Downloads

10

Readme

solana-indexers

A powerful and flexible indexer for Solana blockchain data. Configure what you want to index, add custom processing logic, and store data in your preferred database.

Features

  • Simple Configuration - Get started with minimal setup
  • Flexible Storage - Support for JSON files, MongoDB, PostgreSQL, or custom adapters
  • Custom Processing - Transform and filter data before storage
  • Multiple Index Types - Index accounts, transactions, or program activity
  • TypeScript Support - Full type safety and IntelliSense

Installation

npm install solana-indexers

Optional Dependencies

Install based on your storage needs:

# For MongoDB storage
npm install mongodb

# For PostgreSQL storage
npm install pg

Quick Start

import { SolanaIndexer, JSONStorage } from 'solana-indexers';

// Initialize storage
const storage = new JSONStorage('./blockchain-data.json');

// Configure indexer
const indexer = new SolanaIndexer(
  {
    env: 'mainnet',
    type: 'transaction',
    accounts: ['TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'],
    pollInterval: 5000,
  },
  storage
);

// Start indexing
await indexer.start();

// Query indexed data
const transactions = await indexer.query({});
console.log(`Indexed ${transactions.length} transactions`);

// Stop indexer
await indexer.stop();

Configuration

Indexer Types

Account Indexer

Monitor specific accounts for state changes:

{
  env: 'mainnet',
  type: 'account',
  accounts: [
    'So11111111111111111111111111111111111111112',
    'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
  ],
  pollInterval: 10000
}

Transaction Indexer

Index transactions for specific accounts:

{
  env: 'devnet',
  type: 'transaction',
  accounts: ['YourAccountPublicKey'],
  pollInterval: 5000,
  batchSize: 50
}

Program Indexer

Index all transactions for a specific program:

{
  env: 'mainnet',
  type: 'program',
  programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
  pollInterval: 15000
}

Storage Adapters

JSON Storage

File-based storage for simple use cases:

import { JSONStorage } from 'solana-indexers';

const storage = new JSONStorage('./data/solana-data.json');

MongoDB Storage

import { MongoStorage } from 'solana-indexers';

const storage = new MongoStorage(
  'mongodb://localhost:27017',
  'myDatabase',
  'myCollection'
);

PostgreSQL Storage

import { PostgresStorage } from 'solana-indexers';

const storage = new PostgresStorage(
  'postgresql://user:password@localhost:5432/mydb'
);

Custom Processing

Transform or filter data before storage using processors:

import { DataProcessor } from 'solana-indexers';

// Filter transactions by fee amount
const highValueFilter: DataProcessor = async (data, context) => {
  if ('signature' in data && data.fee > 10000) {
    return data;
  }
  return null; // Skip low-value transactions
};

// Enrich data with metadata
const enricher: DataProcessor = async (data, context) => {
  return {
    ...data,
    data: {
      ...data.data,
      processedAt: new Date(),
      network: context.config.env
    }
  };
};

// Add processors to indexer
indexer.addProcessor(highValueFilter);
indexer.addProcessor(enricher);

Querying Data

// Retrieve all indexed data
const all = await indexer.query({});

// Filter by properties
const successful = await indexer.query({ success: true });

// MongoDB-style queries (when using MongoStorage)
const recent = await indexer.query({
  timestamp: { $gte: new Date('2024-01-01') }
});

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | env | 'mainnet' \| 'devnet' \| 'testnet' \| 'localnet' | Required | Solana network environment | | type | 'account' \| 'transaction' \| 'program' | Required | Type of data to index | | rpcUrl | string | Auto-detected | Custom RPC endpoint URL | | pollInterval | number | 5000 | Polling interval in milliseconds | | batchSize | number | 100 | Maximum items per batch | | accounts | string[] | - | Account addresses to monitor | | programId | string | - | Program ID for program indexer |

Development

# Install dependencies
pnpm install

# Build the project
pnpm build

# Development mode with watch
pnpm dev

# Run tests
pnpm test

Roadmap

  • WebSocket support for real-time indexing
  • Built-in analytics and metrics
  • Additional storage adapters (SQLite, Redis)
  • Advanced query builder
  • Index migration tools
  • Performance optimizations

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

MIT