An api written in Go to get various statistics about Bluesky. Powered by jaz.bsky.social's bsky stats. https://scroll.blue/stats
  • Go 98.5%
  • Dockerfile 1.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Kyle Dickey d9855a1cb6 fix ping
2024-11-18 04:33:33 +00:00
.github Create FUNDING.yml 2024-11-14 21:29:55 -07:00
config basic api done 2024-11-15 03:44:27 +00:00
internal fix ping 2024-11-18 04:33:33 +00:00
.air.toml add air 2024-11-15 03:19:09 +00:00
.env.example add env.example 2024-11-15 04:32:21 +00:00
.gitignore add env.example 2024-11-15 04:32:21 +00:00
Dockerfile add docker 2024-11-15 03:54:47 +00:00
go.mod migrate to gin 2024-11-18 04:26:54 +00:00
go.sum migrate to gin 2024-11-18 04:26:54 +00:00
LICENSE Initial commit 2024-11-14 20:12:23 -07:00
main.go migrate to gin 2024-11-18 04:26:54 +00:00
README.md Update README.md 2024-11-14 21:25:20 -07:00

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.