English πΊπΈ | FranΓ§ais π«π· | EspaΓ±ol πͺπΈ
A developer utility REST API for the Stellar blockchain β built with Express.js and the official Stellar SDK.
StellarKit API wraps the Stellar Horizon API into clean, developer-friendly REST endpoints. It helps developers building on Stellar quickly access fee estimates, account data, transaction history, network status, and asset metadata β without having to read through raw Horizon responses.
- π Network Status β Latest ledger info, base fee, protocol version
- πΈ Fee Estimation β Economy / Standard / Priority fee tiers for any operation count
- π€ Account Info β Balances (XLM + all assets), signers, thresholds, spendable balance
- π Transaction History β Paginated transactions and operations per account
- πͺ Asset Metadata β Stats for any Stellar asset, plus multi-issuer search
- π‘οΈ Production-ready β Rate limiting, helmet security headers, centralised error handling
- β Tested β Jest test suite with coverage
- Node.js >= 18
- npm >= 9
git clone https://github.com/stellarkit-lab-devtools/stellarkit-api.git
cd stellarkit-api
npm install
cp .env.example .envEdit .env:
STELLAR_NETWORK=testnet # or "mainnet"
PORT=3000# Development (auto-reload)
npm run dev
# Production
npm startThe API will be available at http://localhost:3000.
Returns the full list of available endpoints.
Service health check.
Response:
{
"success": true,
"data": {
"status": "ok",
"service": "StellarKit API",
"version": "1.0.0",
"network": "testnet"
}
}Returns the latest ledger info, fees, and protocol version.
Response:
{
"success": true,
"data": {
"network": "testnet",
"latestLedger": {
"sequence": 123456,
"closedAt": "2024-07-01T12:00:00Z",
"transactionCount": 42,
"operationCount": 89
},
"fees": {
"baseFeeInStroops": 100,
"baseFeeInXLM": "0.0000100"
},
"protocol": { "version": 21 }
}
}Returns Economy / Standard / Priority fee tiers based on live network stats.
Query params:
| Param | Type | Default | Description |
|---|---|---|---|
operations |
number | 1 |
Number of operations in your transaction |
Example:
GET /fee-estimate?operations=3
Response:
{
"success": true,
"data": {
"operationCount": 3,
"perOperation": {
"economy": { "stroops": 100, "xlm": "0.0000100" },
"standard": { "stroops": 200, "xlm": "0.0000200" },
"priority": { "stroops": 500, "xlm": "0.0000500" }
},
"totalFee": {
"economy": { "stroops": 300, "xlm": "0.0000300" },
"standard": { "stroops": 600, "xlm": "0.0000600" },
"priority": { "stroops": 1500, "xlm": "0.0001500" }
}
}
}Returns full account details for a Stellar public key.
Example:
GET /account/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN
Response:
{
"success": true,
"data": {
"accountId": "GAAZI4...",
"sequence": "12345678",
"xlm": {
"balance": "100.0000000",
"minimumBalance": "1.0000000",
"spendableBalance": "99.0000000"
},
"assets": [...],
"signers": [...],
"flags": {...}
}
}Returns paginated transaction history for an account.
Query params:
| Param | Type | Default | Description |
|---|---|---|---|
limit |
number | 10 |
Number of results (max 200) |
order |
string | desc |
asc or desc |
cursor |
string | β | Pagination cursor from previous response |
Returns paginated operation history for an account. Same query params as above.
Returns metadata and statistics for a specific Stellar asset.
Example:
GET /asset/USDC/GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
Searches for all assets with a given code across all issuers.
Example:
GET /asset/search?code=USDC
Establishes a live, real-time WebSocket connection to stream Stellar ledger updates. As new ledgers are closed on the Stellar blockchain, the API receives them via the Stellar Horizon SDK subscription, parses them, and immediately broadcasts them to connected WebSocket clients.
const ws = new WebSocket('ws://localhost:3000/stream/ledgers');
ws.onopen = () => {
console.log('Connected to StellarKit ledger stream!');
};
ws.onmessage = (event) => {
const ledger = JSON.parse(event.data);
console.log('New ledger closed:', ledger);
// Example output:
// {
// "sequence": 51234567,
// "closedAt": "2026-05-26T20:15:00Z",
// "baseFee": 100,
// "transactionCount": 54
// }
};
ws.onerror = (error) => {
console.error('WebSocket error:', error);
};
ws.onclose = () => {
console.log('WebSocket connection closed.');
};npm testTests use Jest + Supertest. Coverage report is generated at coverage/.
Contributions are very welcome! This project participates in the Stellar Wave Program on Drips β you can earn rewards for solving open issues.
To contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feat/your-feature - Commit your changes:
git commit -m "feat: add your feature" - Push and open a Pull Request
Please read CONTRIBUTING.md before submitting.
stellarkit-api/
βββ scripts/
β βββ ws-client-demo.js # Runnable CLI demo for real-time ledger stream
βββ src/
β βββ config/
β β βββ stellar.js # Stellar SDK + Horizon setup
β βββ middleware/
β β βββ errorHandler.js # Centralised error formatting
β β βββ rateLimiter.js # Rate limiting
β βββ routes/
β β βββ account.js # /account endpoints
β β βββ asset.js # /asset endpoints
β β βββ feeEstimate.js # /fee-estimate endpoint
β β βββ networkStatus.js # /network-status endpoint
β β βββ transactions.js # /transactions endpoints
β βββ utils/
β β βββ response.js # Response helpers
β β βββ validators.js # Input validation helpers
β βββ index.js # App entry point
β βββ websocket.js # WebSocket stream handler
βββ tests/
β βββ api.test.js
β βββ websocket.test.js # WebSocket stream integration tests
βββ .env.example
βββ package.json
βββ README.md
- Stellar Developers Portal
- Stellar JavaScript SDK
- Horizon API Reference
- Stellar Discord
- Stellar Wave Program