REST API indexer for the Invoice Liquidity Network smart contracts. Indexes Horizon events from a Stellar network and exposes them via HTTP.
- Node.js 20+
- npm 10+
cd indexer
npm install
npm run devThe indexer will start on http://localhost:3000 and create a local SQLite database at ./data/indexer.db.
# Run tests
npm test
# Run tests with coverage report
npm run test:coverage
# Run tests in watch mode
npm run test:watchThe Dockerfile uses a multi-stage build to optimize image size:
docker build -t iln/indexer:latest .Image size is optimized to be under 200MB through:
- Alpine Linux base image (lightweight)
- Multi-stage build (production deps only in runtime)
- npm prune to remove dev dependencies
To run the full stack including Stellar, indexer, and notifications:
docker compose up -dThis will:
- Start Stellar quickstart on port 8000
- Start the indexer on port 3000 with a local SQLite database
- Start the notifications service on port 3001 with PostgreSQL
Check health status:
docker compose logs -f indexer | grep "health\|error"Stop all services:
docker compose downPORT- Server port (default: 3000)HORIZON_URL- Stellar Horizon URL (default: http://localhost:8000)CONTRACT_IDorILN_CONTRACT_ID- ILN contract address used for Horizon event ingestionDB_PATH- SQLite database file path (default: ./data/indexer.db)LOG_LEVEL- Logging level (default: info)API_KEYS- Optional comma-separated list ofX-API-Keyvalues that bypass the public rate limit
The health endpoint is available at:
GET /health
Returns { status: 'ok' } when the service is ready.
GET /invoices- List all invoices (filter, sort, paginate)GET /invoices/:id- Single invoice with its event logGET /stats- Global statisticsGET /stats/history- Daily stats time seriesGET /reputation/:address- Reputation score and historyGET /leaderboard- Top contributorsGET /events- Account activity feedGET /health- Health check
See the REST API Reference for the complete specification: query parameters, request/response schemas, error codes, authentication, and a curl example for every endpoint.
- Use a managed Postgres or SQLite backup for the database
- Configure appropriate log retention
- Set up monitoring on the
/healthendpoint - Use environment variables for all configuration
- Run with a proper process manager (systemd, PM2, Docker, etc.)