stellarium-ts is the TypeScript implementation of a Stellarium node. You embed it in a Fastify server, register the resources that live in your process, and optionally bootstrap peers and resources from a node that is already running.
Prerequisites
- Node.js 20+
- Fastify 5, which you create and pass to the node
- RequestScript, the language your resources and requests use
1
Install the packages
2
Generate signing keys
Nodes sign the data they publish to peers with an Ed25519 key pair. Generate one:
3
Create a .env file
Importing See Configuration for every variable.
StellariumNode loads dotenv, so a .env file in the working directory is applied automatically..env
4
Register a resource and start
A resource is a host object scripts can call.
path and name form its fully qualified name (com.example.Weather). Each function declares RequestScript parameter and return types, and exec runs in your process.Call register before start. start creates the SQLite database, mounts the HTTP API under /v1, and listens.server.ts
5
Run a request
Send a RequestScript
request to your node’s /v1/run endpoint, authenticated with your API_KEY:Response
Next steps
Join a network
Bootstrap from an existing node with
startingPeer.Charge for a resource
Add a payment manifest to a function.
HTTP API
Every route a node exposes.
Run a local network
Operator, escrow program, and two nodes on localnet.