- Notifications
You must be signed in to change notification settings - Fork0
🦀 GitHub profile stats for readme generated on the fly
License
samgozman/github-statcrab
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
github-statcrab is a Rust-based web server that generates dynamic SVG cards displaying GitHub user statistics and programming language usage. It leverages the GitHub API to fetch user data and presents it in a visually appealing format to be embedded in README files or web pages.
Simple to install & use, easy to customize with various themes and layouts!
Table of contents
Displays the top programming languages used by a GitHub user in a visually appealing card format. You can insert it into your GitHub README with a simple markdown snippet.
Just replace<your-hosted-instance> with the URL of your hosted instance of thegithub-statcrab server andsamgozman with your GitHub username.
[](https://github.com/samgozman/github-statcrab)
[](https://github.com/samgozman/github-statcrab)
| Parameter | Description | Type | Required | Default | Example |
|---|---|---|---|---|---|
username | GitHub username | string | ✅ | - | samgozman |
layout | Card layout orientation | string | ❌ | vertical | horizontal,vertical |
max_languages | Maximum number of languages to display | number | ❌ | 8 | 5 |
size_weight | Weight factor for repository size in ranking | number | ❌ | 0.5 | 0.3 |
count_weight | Weight factor for file count in ranking | number | ❌ | 0.5 | 0.7 |
exclude_repo | Comma-separated list of repositories to exclude | string | ❌ | - | repo1,repo2,private-repo |
theme | Visual theme for the card | string | ❌ | light | dark,dracula,transparent-blue,monokai |
offset_x | Horizontal offset for card positioning | number | ❌ | 12 | 20 |
offset_y | Vertical offset for card positioning | number | ❌ | 12 | 15 |
hide_title | Hide the card title | boolean | ❌ | false | true |
hide_background | Hide the card background | boolean | ❌ | false | true |
hide_background_stroke | Hide the card background border | boolean | ❌ | false | true |
Can be used to show GitHub user statistics such as total stars, forks, commits, pull requests, issues, and more. You can insert it into your GitHub README with a simple markdown snippet:
[](https://github.com/samgozman/github-statcrab)
You should replace<your-hosted-instance> with the URL of your hosted instance of thegithub-statcrab server andsamgozman with your GitHub username.
| Parameter | Description | Type | Required | Default | Example |
|---|---|---|---|---|---|
username | GitHub username | string | ✅ | - | samgozman |
hide | Comma-separated list of stats to hide | string | ❌ | - | stars_count,commits_ytd_count |
theme | Visual theme for the card | string | ❌ | light | dark,dracula,monokai,transparent-blue |
offset_x | Horizontal offset for card positioning | number | ❌ | 12 | 20 |
offset_y | Vertical offset for card positioning | number | ❌ | 12 | 15 |
hide_title | Hide the card title | boolean | ❌ | false | true |
hide_background | Hide the card background | boolean | ❌ | false | true |
hide_background_stroke | Hide the card background border | boolean | ❌ | false | true |
Thehide parameter accepts a comma-separated list of the following values:
stars_count- Total stars received across all repositoriescommits_ytd_count- Total commits made this yearissues_count- Total issues openedpull_requests_count- Total pull requests createdmerge_requests_count- Total merge requests createdreviews_count- Total pull request reviews performedstarted_discussions_count- Total discussions startedanswered_discussions_count- Total discussions answered
Note: At least 2 statistics must remain visible on the card.
Thegithub-statcrab server supports multiple visual themes for the generated SVG cards. You can customize the appearance of the cards by using thetheme parameter in the API requests.
All available themes and their previews can be found in thethemes readme file.
Adding new themes to thegithub-statcrab is pretty easy. You don't even need to know Rust! You can just open a PR with a new CSS file in theassets/css/themes/ directory. Make sure to follow the existing theme structure and naming conventions. It's the easiest way to contribute!
Github Actions will automatically do the rest for you, including building thethemes readme file page with previews of all themes (yes, it's automated!).
This guide will help you set up and run thegithub-statcrab server.
Get a GitHub Personal Access Token:
- Go toGitHub Settings > Developer settings > Personal access tokens
- Generate new token (classic) with
repoanduserscopes
You will need this token to authenticate with the GitHub API.
You can easily deploy thegithub-statcrab server using template for Railway. Just click the button below to get started:
First of all you need to set up your environment variables. You can do this by creating a.env file in the root directory of the project. You can use the provided.env.example file as a template.
Copy the example environment file:
cp .env.example .env
Edit
.envand set your GitHub token:GITHUB_TOKEN=your_github_personal_access_token_here
(optional) add a test GitHub username for local e2e testing:
TEST_GITHUB_USERNAME=your_github_username
(optional) Set up Sentry for error tracking:You can also set optional Sentry configuration for error tracking.
SENTRY_DSN=your_sentry_dsn_hereSENTRY_ENVIRONMENT=development
(optional) Configure cache sizes:You can adjust the cache sizes for user stats and language stats in the
.envfile.# Maximum memory capacity for GitHub API response cache in MiB (default: 32)CACHE_MAX_CAPACITY_MB=32# TTL for user stats cache in seconds (default: 900 = 15 minutes)CACHE_USER_STATS_TTL_SECONDS=900# TTL for user languages cache in seconds (default: 3600 = 1 hour)CACHE_USER_LANGUAGES_TTL_SECONDS=3600
(optional) Restrict API access to specific users:You can limit which GitHub usernames are allowed to use the API by setting an allowlist in the
.envfile.# Comma-separated list of GitHub usernames allowed to use the API# Leave empty or unset to allow all users (default: empty)ALLOWED_USERNAMES=user1,user2,user3
You can run the server using Docker. Make sure to replaceyour_github_personal_access_token_here with your actual GitHub Personal Access Token.
docker pull ghcr.io/samgozman/github-statcrab/server:latest docker run -p 3000:3000 --env-file .env ghcr.io/samgozman/github-statcrab/server:latest
To run the server locally, ensure you have Rust and Cargo installed. You can install them fromrustup.rs.
The server automatically loads environment variables from the.env file:
make run
The server will start onhttp://0.0.0.0:3000 and will automatically read your GitHub token from the.env file.
Run the tests with:
maketestSpecial thanks to@anuraghazra and his amazinggithub-readme-stats for the inspiration!
About
🦀 GitHub profile stats for readme generated on the fly
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.
