logo
0
2
Login

CommitCool Chart Service

This FastAPI service renders cumulative CNB Star/Fork histories as SVG or PNG charts.

Data source

All data is pulled from the official CNB API:
https://api.cnb.cool/{repo}/-/{resource}?filter_type=all
where {resource} is either stars or forks.

Required environment

VariablePurpose
CNB_API_TOKENBearer token for the CNB API
CNB_API_BASE_URL (optional)Override the API host (defaults to https://api.cnb.cool)
REDIS_URL (optional)Enables Redis-backed caching; falls back to in-memory cache
CACHE_TTL_SECONDS (optional)Cache time-to-live in seconds (default 86400)

You can place these in a .env file— the app loads it automatically via python-dotenv.

How to run

pip install -r requirements.txt python main.py # reload enabled by default

Set UVICORN_RELOAD=0 to disable hot reload.

Endpoints:

  • /stars/{repo} → star history chart; pass multiple repos (up to 6) separated by commas to render a comparison (e.g. /stars/cnb/feedback,cnb/cool/git-clone-yyds).
  • /forks/{repo} → fork history chart
  • /issues/{repo} → issue history chart
  • /healthz → health check

Each supports query options:

  • image_format=svg|png
  • theme=light|dark (default light)
  • accumulation=cumulative|net (default cumulative); net plots the monthly growth instead of the running total
  • Issues endpoint also accepts state=open, state=closed, state=open,closed (default all), state=both (renders open & closed lines together), and authors=user1,user2

Docker

docker build -t commitcool . docker run --env-file .env -p 8000:8000 commitcool

Then call http://localhost:8000/stars/cnb/feedback.

About

No description, topics, or website provided.
Language
Python99.4%
Dockerfile0.6%