The Nina API makes available the Artist, Collector, Release, and Hub data from the Nina Protocol.
Public Endpoint: https://api.ninaprotocol.com/v1
/db
- ObjectionJs Postgres ORM/indexer
- ingests onchain data from the Nina Program into the Postgres DB/api
- Koa app that serves the data from the Postgres DB/docs
- OpenApi Specification for the API
The /db
folder contains migrations, models, and lifecycle scripts for the Postgres DB. It uses ObjectionJs as an ORM.
It exists as an npm package that can be installed into other projects via:
yarn add @nina-protocol/nina-db
It is used by the Indexer and API.
Note: When using as a package in an external project make sure to have the required environment variables set. See
.env.example
for details.
The Indexer consists of a Postgres Db and a Processor that periodically checks the on-chain Nina Program and ingests the updates. It does this in two loops:
- Changes to Release, Hub, HubRelease, HubPost (syncs every 1 min)
- Changes to Collectors (syncs every 1 hour)
Note: Updating Collector information requires a premium RPC connection in order to call
getProgramAccounts
on the Solana Token Program
- Copy contents of
.env.example
to.env
- this includes a defaultSOLANA_CLUSTER_URL
for Genysys Go's Public RPC which will be enough to handle (1.) above, but not (2.) - Setup a Postgres db and replace details in
.env
with your configuration yarn
yarn start:indexer
Note: The Indexer can be run as its own standalone process.
The API is a simple Koa app that connects to the Postgres Database populated by the indexer.
###Setup
- After setting up the Indexer as described above run the following which will set up on port 3004
yarn start:api
- The docs are built using Redocly and adhere to the OpenApi Specification'
- Docs can be visited at here
yarn docs
runs the documenation for local development
Need help? Ask a question in our Discord or open an issue.