Skip to content

mechanismHQ/satsnamesapi

 
 

Repository files navigation

Sats Names API

Documentation

This repo is the codebase for the Sats Names API, which is available at api.sats.id.

Local Development

Install dependencies:

pnpm install

Create a .env file with DATABASE_URL pointing to a Postgres database URL. You'll need to have Postgres installed and running on your machine.

DATABASE_URL="postgresql://localhost:5432/sats-api-dev"

Setup the DB migrations with:

pnpm prisma migrate dev

Finally, run the server with:

pnpm dev

Hosting the API

Running a hosted version of the API requires a Postgres instance available at the DATABASE_URL environment variable.

A Dockerfile is provided, which can be used to easily deploy the project.

Project architecture

A few notes about the tech stack of the Sats Names API:

  • All code is in TypeScript
  • Fastify as the server framework
  • Prisma as the database ORM

Included in the codebase is a small "worker" architecture, which is used to constantly stay in sync with the Ordinals network. When running the server, a scheduled job is configured to sync with any newly minted Ordinals.

To run the server without running the worker, set the environment variable RUN_SYNC to "false". This allows for running a typical worker/server setup.

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.9%
  • Other 1.1%