A production-grade indexing stack for Safrochain. It ingests on-chain data with Callisto, stores it in PostgreSQL, and serves it through our customized NestJS REST API. Callisto is used strictly to sync blockchain data into PostgreSQL; the API queries PostgreSQL directly.
- Go indexer (
callisto_project/): Parses blocks, transactions, messages, and module data; persists into PostgreSQL. - Database schemas (
callisto_project/database/schema/): SQL schemas for core Cosmos/Safrochain modules. - REST API (
safrochain_api_indexeur/): Customized NestJS service for curated endpoints and business logic over PostgreSQL.
Set up PostgreSQL, run the Callisto indexer to sync chain data into the database, then start the API.
- Go 1.21+
- Node.js 18+
- PostgreSQL 12+
- Chain config and genesis:
callisto/config.yaml,callisto/genesis.json - Database connection is configured by the indexer and API environment variables (see below).
From callisto_project/:
go mod download
go build ./cmd/callisto
# one-time project initialization (creates config in the data dir)
./callisto init
# start indexing (uses config produced by init)
./callisto startMigrations and utilities are available under callisto_project/cmd/migrate and within callisto_project/database/.
From safrochain_api_indexeur/:
npm install
npm run start:devAPI base URL: http://localhost:3000/api/v1 — Swagger docs at http://localhost:3000/docs.
Environment variables are read by both the indexer and the API. Typical settings include:
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=safrochain_indexdb
DB_USER=safrochain_indexuser
DB_PASSWORD=change-me
# API
APP_PORT=3000
API_PREFIX=api/v1
# Swagger
SWAGGER_TITLE=SafroChain API
SWAGGER_DESCRIPTION=Professional blockchain indexer API for SafroChain
SWAGGER_VERSION=1.0.0
SWAGGER_PATH=docsSee safrochain_api_indexeur/env.example for a complete example.
Indexer configuration is initialized via ./callisto init (see callisto/config.yaml and callisto/genesis.json for chain defaults).
.
├── callisto/ # Chain config and genesis
├── callisto_project/ # Callisto-based indexer and DB layer
└── safrochain_api_indexeur/ # NestJS REST API (customized)
# Build and run indexer (from callisto_project/)
go build ./cmd/callisto && ./callisto start
# Start API (from safrochain_api_indexeur/)
npm run start:dev- Fork the repository
- Create a feature branch
- Implement changes with tests where possible
- Open a pull request with a clear description and rationale
If you discover a security issue, please report it responsibly via a private channel. Avoid filing public issues with sensitive details.
This project is licensed under the Apache License, Version 2.0. See LICENSE for details.
Built using Callisto components. Thanks to the Callisto team.