---
title: "Deploy GitHub Readme Stats"
description: "Get dynamically generated GitHub stats on your READMEs!"
category: "Other"
url: https://railway.com/deploy/github-readme-stats
---

# Deploy GitHub Readme Stats

Get dynamically generated GitHub stats on your READMEs!

**[Deploy GitHub Readme Stats on Railway](https://railway.com/template/github-readme-stats)**

- **Creator:** decoge
- **Category:** Other
- **Total deploys:** 16

## Template content

### github-readme-stats-selfhosted

- **Image:** ghcr.io/utkuozdemir/github-readme-stats-selfhosted:latest
- **Public domain:** Yes

## Documentation

# Deploy and Host GitHub Readme Stats on Railway

GitHub Readme Stats is a popular open-source tool that dynamically generates customizable SVG cards displaying your GitHub profile statistics, such as total stars, commits, pull requests, contributions, top languages, and more. Embed these eye-catching cards directly into your README for an impressive, always-up-to-date profile showcase.

![](https://github-readme-stats-selfhosted-production.up.railway.app/api?username=anuraghazra)

![](https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png)

## About Hosting GitHub Readme Stats

This Railway template deploys a self-hosted instance of GitHub Readme Stats using a lightweight Docker image that automatically fetches the latest code from the original repository on startup. The container runs a Node.js server exposing endpoints to generate stats cards via simple URL queries (e.g., `/api?username=yourname`). To operate reliably, you'll need to provide a GitHub Personal Access Token (PAT) to bypass public API rate limits, and strongly consider whitelisting usernames to prevent abuse on your public endpoint. The setup is stateless by design—no persistent volumes needed on /repo—for smooth deploys and restarts. Once live, access your instance at the Railway-provided domain for private or shared stats generation.

## Common Use Cases
- Personal GitHub profile enhancement with custom, up-to-date stats cards in your README
- Private self-hosted stats for organizations or teams avoiding public rate limits
- Embedding dynamic stats in personal websites, portfolios, or documentation

## Dependencies for GitHub Readme Stats Hosting

You can configure the container using the following environment variables:

| Variable                  | Description                                                                 | Default                  |
|---------------------------|-----------------------------------------------------------------------------|--------------------------|
| PAT_1                     | **Required.** Your GitHub Personal Access Token. You can add PAT_2, PAT_3, etc., to increase your rate limit. | None                     |
| WHITELIST                 | **Strongly Recommended.** Comma-separated list of usernames allowed to use the instance. Set this to your own username to prevent abuse. | null (Open to everyone)  |
| GITHUB_README_STATS_REPO  | The git repository URL to clone.                                            | https://github.com/anuraghazra/github-readme-stats.git |
| GITHUB_README_STATS_REF   | The branch, tag, or commit hash to use.                                     | master                   |
| FIX_AUDIT                 | Run npm audit fix before starting the server.                               | true                     |
| PORT                      | The internal port the Node server listens on.                               | 9000                     |

### Creating a Personal Access Token (PAT)

For deploying your own instance of GitHub Readme Stats, you will need to create a GitHub Personal Access Token (PAT). Below are the steps to create one and the scopes you need to select for both classic and fine-grained tokens.

Selecting the right scopes for your token is important in case you want to display private contributions on your cards.

#### Classic token

* Go to [Account -> Settings -> Developer Settings -> Personal access tokens -> Tokens (classic)](https://github.com/settings/tokens) .
* Click on Generate new token -> Generate new token (classic) .
* Scopes to select:
  * repo
  * read:user
* Click on Generate token and copy it.

#### Fine-grained token

* Go to [Account -> Settings -> Developer Settings -> Personal access tokens -> Fine-grained tokens](https://github.com/settings/tokens) .
* Click on Generate new token -> Generate new token .
* Select an expiration date
* Select All repositories
* Scopes to select in Repository permissions:
  * Commit statuses: read-only
  * Contents: read-only
  * Issues: read-only
  * Metadata: read-only
  * Pull requests: read-only
* Click on Generate token and copy it.

- Strongly recommended: Username whitelist to restrict access and prevent abuse

### Deployment Dependencies
- Docker image: [ghcr.io/utkuozdemir/github-readme-stats-selfhosted](https://github.com/utkuozdemir/github-readme-stats-selfhosted)
- Original project: [anuraghazra/github-readme-stats](https://github.com/anuraghazra/github-readme-stats)

### Implementation Details
In Railway, after deploying the template:
- Add environment variable `PAT_1` with your GitHub PAT (created following the steps above)
- Add `WHITELIST` with comma-separated usernames (e.g., your GitHub username)
- Optional: Set `GITHUB_README_STATS_REF` to a specific tag (e.g., `v6.0.0`) for stability instead of `master`
- Railway automatically sets `PORT`, so the app will listen on it—no need to override unless custom
- Test: Visit `https://your-service.up.railway.app/api?username=anuraghazra`

## Why Deploy GitHub Readme Stats on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying GitHub Readme Stats on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/github-readme-stats
