github.com/dickeyy/bsky-stats-api

An api written in Go to get various statistics about Bluesky. Powered by jaz.bsky.social's bsky stats.


License
MIT
Install
go get github.com/dickeyy/bsky-stats-api

Documentation

bsky stats API

An API written in Go (1.23) to get various statistics about Bluesky, powered by jaz.bsky.social's bsky stats.

Derived from espeon/bcounter-backend.

Ths API esentially just wraps the parent API, adds some growth rate calculations, and caches the results for continuous fetching.

GitHub Sponsors Uptime Robot status GitHub Issues or Pull Requests

Usage

This API is free to use, but it is also extremely easy to self-host. If you can, please self-host this API as it will save on resources for my server.

Endpoint: GET https://bsky-stats.scroll.blue Returns:

{
	"total_users": 123456,
	"total_posts": 123456,
	"total_follows": 123456,
	"total_likes": 123456,
	"users_growth_rate_per_second": 0.123456,
	"last_update_time": "2023-01-01T00:00:00Z",
	"next_update_time": "2023-01-01T00:00:00Z"
}

The API will attempt to serve cached data if it is available. Cached data is invalidated every 60 seconds, so hitting the API over and over will not return new data unless the update time has passed.

Self-hosting

You can self-host this API via Docker (see Dockerfile) or build it from source.

The Docker file does not provide any reverse proxying, so you will need to do that on your own.

See .env.example for a list of environment variables you can set.

Docker

docker build -t bsky-stats-api .
docker run -p 8080:8080 bsky-stats-api

Build from source

go build -o bsky-stats-api .
./bsky-stats-api

Development

If you want to run this API locally, you will need to set the following environment variables:

export ENV=dev
export PORT=8080

Then run the API:

go run main.go

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Credits

License

Licensed under the MIT License. See LICENSE for details.