Cardano has several different sources for metadata:
- off-chain registry
- NFT metadata
- royalty tokens for NFTs
- Drafts on-chain token metadata in the future with special encoding
The server exposes a graphql API. The schema is available here.
Syncing the assets db from scratch on mainnet (and potentially preprod) can be quite time-consuming. To help with getting servers quicker up to speed, there are 2 scripts:
scripts/restore.sh dump_XXX.sql.gz
The app is using postgres as a database server. For migrations it uses @slonik/migrator
internally (which uses umzug
in the background). To run migrations in production run:
node migrate up
before anything else.
Offchain metadata are fetched from directly from github and is periodically checked
for any addition entries. Github has very strict rate limiting on their API.
It's recommended to first use the scripts/loadOffchain.ts
script to fill the DB with
assets by cloning the offchain repository.
There are currently aggregator solutions that allow fetching metadata:
- blockfrost - require a separate subscription with no self-host options
- koios - built on top of db-sync and postgrest
- offchain-metadata-sever - which only handles the off-chain part
The aim of this project was to provide a relatively lighter-weight solution, only focusing on tokens on Cardano.