feat(deploy): add self-host compose file and document self-hosting

The repo had three Dockerfiles but nothing that ran them together, and the
README never mentioned self-hosting. The only deploy path was deploy/compose.yml,
which is bound to the production box: it pulls private ghcr images and hard-fails
on seven env vars including OAuth credentials, so nobody else could run it.

Every one of those vars already has a default in the service config; the
:?missing guards are a production-deploy check, not an application requirement.
This adds a root compose file that builds the three services from source and
needs only GITHUB_PAT and FETCHER_INTERNAL_TOKEN.

deploy/compose.yml is unchanged, so production is unaffected.

Verified by running it: all three images build, all five containers start, the
generator serves the SPA and /api/health, and edge answers /<username> with
upstream_ok true.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
This commit is contained in:
ShayManor
2026-08-23 10:33:26 -07:00
co-authored by Claude Opus 5
parent 107273a1c8
commit 27645048f1
4 changed files with 114 additions and 0 deletions
+27
View File
@@ -276,6 +276,33 @@ per account, so save it for when it matters.
---
## Self-hosting
The public instance at `gh-stats.com` is free and you do not need to run your
own. Self-host if you want your own rate limit, private repository data staying
on your hardware, or control over when cards rebuild.
You need Docker and a GitHub token. The token needs no scopes for public data;
it exists to raise your GitHub API rate limit.
```bash
git clone https://github.com/ShayManor/github-readme-stats
cd github-readme-stats
cp .env.example .env # put your token in GITHUB_PAT
docker compose up -d --build
```
Then open `http://localhost:5002` and embed from your own host:
```md
![stats](http://localhost:5002/api/YOUR_USERNAME)
```
Three services come up behind `docker compose`: `fetcher` talks to GitHub and
owns the token, `generator` renders the SVGs and serves the web UI on 5002, and
`edge` is a caching proxy on 5003 that serves cards at `/<username>`. Data lives
in `./data`. Set `GHSTATS_PORT` to move the web UI off 5002.
## FAQ
**Can I use a private GitHub account?**