Architecture

Understand the architecture of the Token Metadata API.


Service architecture

This section gives you an overview of external and internal architectural diagrams.

External architecture

The external architectural diagram shows how the Token metadata API is connected to three systems: a Stacks node, a Stacks Blockchain API database, and a Postgres database.

Architecture

  1. 1The Token Metadata API interacts with the Stacks Blockchain API database (referred to as a "Local Metadata DB" in the diagram above) to import all historical smart contracts when booting up and to listen for new contracts that may be deployed afterwards. Read-only access is recommended as this service will never need to write anything to this database.
  2. 2A Stacks node responds to all read-only contract calls required when fetching token metadata (calls to get token count, token metadata URIs, etc.).
  3. 3A local Postgres DB stores all processed metadata info.

The service needs to fetch external metadata files (JSONs, images) from the internet, so it must have access to external networks.

Internal architecture

The following is the internal architectural diagram of the Token Metadata API.

Flowchart