#brk #server #on-chain #cryptocurrency #brk-query

brk_server

A crate that serves Bitcoin data and swappable front-ends, built on top of brk_indexer, brk_computer and brk_query

25 releases

Uses new Rust 2024

new 0.0.27 Apr 18, 2025
0.0.26 Apr 18, 2025
0.0.11 Mar 31, 2025
0.0.2 Feb 27, 2025

#834 in Magic Beans

Download history 172/week @ 2025-02-21 531/week @ 2025-02-28 185/week @ 2025-03-07 180/week @ 2025-03-14 81/week @ 2025-03-21 234/week @ 2025-03-28 1031/week @ 2025-04-04 333/week @ 2025-04-11

1,734 downloads per month
Used in 2 crates

MIT license

460KB
12K SLoC

BRK Server

GitHub Repo stars kibo.money License Version Documentation Size Dependency status Discord Nostr Bluesky X

A crate that serves Bitcoin data and swappable front-ends, built on top of brk_indexer, brk_computer and brk_query.

The file handler, will serve the website specified by the user if any, which can be no website, kibo.money or custom (which is a blank folder for people to experiment). If a website is specified and the server is ran outside of the brk project and thus can't find the requested website, it will download the whole project with the correct version from Github and store it in .brk to be able to serve to website. This is due to the crate size limit on crates.io and the various shenanigans that need to be done to have a website in a crate.

The API uses brk_query and so inherites all of its features including formats.

Endpoints

API

GET /api/vecs/indexes

A list of all possible vec indexes and their accepted variants

GET /api/vecs/ids

A list of all possible vec ids

GET /api/vecs/id-to-indexes

A list of all possible vec ids and their supported vec indexes

GET /api/vecs/index-to-ids

A list of all possible vec indexes and their supported vec ids

GET /api/query

This endpoint retrieves data based on the specified vector index and values.

Parameters:

Parameter Type Required Description
index VecIndex Yes The vector index to query.
values VecId[] Yes A comma or space-separated list of vector IDs to retrieve.
from unsigned int No The starting index for pagination (default is 0).
to unsigned int No The ending index for pagination (default is the total number of results).
format string No The format of the response. Options include json, csv, tsv, or md (default is json).

Examples:

GET /api/query?index=date&values=ohlc
GET /api/query?index=week&values=ohlc,block-interval-average&from=0&to=20&format=md

Meta

GET /version

The version of the server and thus BRK.

Files

GET /*

Catch all.

When no pattern is found, the server will look for a match inside the folder of the chosen website, if any.

Dependencies

~62MB
~1M SLoC