An open API service indexing awesome lists of open source software.

https://github.com/yashab-cyber/gitrank

Real-time GitHub ranking badge generator - Generate dynamic SVG badges that show your GitHub ranking based on stars, forks, followers, or commits!
https://github.com/yashab-cyber/gitrank

coder developer git github

Last synced: 6 days ago
JSON representation

Real-time GitHub ranking badge generator - Generate dynamic SVG badges that show your GitHub ranking based on stars, forks, followers, or commits!

Awesome Lists containing this project

README

          

# GitRank Live - Hacker Edition โšก

![GitRank Live](https://img.shields.io/badge/GitRank-Live-00ff7f?style=for-the-badge&logo=github&logoColor=white)
[![License](https://img.shields.io/badge/license-MIT-cyan.svg?style=for-the-badge)](LICENSE)
[![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg?style=for-the-badge&logo=node.js)](https://nodejs.org)

### ๐ŸŽจ **Real-time GitHub ranking badges with hacker-style design**

*Generate dynamic SVG badges that show your GitHub ranking with neon colors, rounded corners, and the iconic Octocat*

---

## ๐Ÿ”ฅ **What's New in Hacker Edition**

- **๐ŸŽจ Dark Theme**: Sleek hacker-style badges with neon green/cyan accents
- **โ˜€๏ธ Light Theme**: Clean light mode for versatile usage
- **๐Ÿ”ง JSON API**: RESTful endpoint for developers to fetch raw ranking data
- **โšก Enhanced Design**: Rounded corners, GitHub Octocat icon, improved typography
- **๐Ÿ’ป Monospace Fonts**: Terminal-friendly font stack for that authentic hacker look

---

## ๐Ÿš€ **Quick Start**

### ๐Ÿ† **Embed Your GitHub Rank**

```markdown

![GitHub Stars](https://gitrank.zehrasec.com/api/badge?user=yourusername&metric=stars&theme=dark)
![GitHub Followers](https://gitrank.zehrasec.com/api/badge?user=yourusername&metric=followers&style=for-the-badge&theme=dark)

![GitHub Stars](https://gitrank.zehrasec.com/api/badge?user=yourusername&metric=stars&theme=light)
![GitHub Commits](https://gitrank.zehrasec.com/api/badge?user=yourusername&metric=commits&style=for-the-badge&theme=light)
```

### ๐ŸŽจ **Badge Styles Showcase**

| Style | Dark Theme | Light Theme |
|-------|------------|-------------|
| **flat** | `?style=flat&theme=dark` | `?style=flat&theme=light` |
| **flat-square** | `?style=flat-square&theme=dark` | `?style=flat-square&theme=light` |
| **for-the-badge** | `?style=for-the-badge&theme=dark` | `?style=for-the-badge&theme=light` |
| **plastic** | `?style=plastic&theme=dark` | `?style=plastic&theme=light` |

---

## ๐Ÿ”Œ **Developer API**

### ๐Ÿ“Š **JSON Endpoint**
Get raw ranking data for your applications:

```bash
# Badge Generation (SVG)
curl "https://gitrank.zehrasec.com/api/badge?user=USERNAME&metric=stars&theme=dark"

# Raw Data (JSON)
curl "https://gitrank.zehrasec.com/api/rank?user=USERNAME&metric=stars"

# User Stats
curl "https://gitrank.zehrasec.com/api/stats/USERNAME"

# System Health
curl "https://gitrank.zehrasec.com/health"
```

```json
{
"user": {
"login": "octocat",
"name": "The Octocat",
"avatar_url": "https://github.com/images/error/octocat_happy.gif"
},
"metric": {
"name": "stars",
"value": 8123,
"formatted": "8.1K"
},
"ranking": {
"percentile": 95,
"description": "Top 5%",
"tier": "expert",
"badge_color": "#ff8500"
},
"benchmarks": {
"next_tier": {
"name": "Top 1%",
"value": 10000,
"needed": 1877
}
},
"all_metrics": {
"stars": 8123,
"forks": 2543,
"followers": 4567,
"commits": 1234
}
}
```

### ๐Ÿ› ๏ธ **API Endpoints**

| Endpoint | Description | Response |
|----------|-------------|-----------|
| `GET /api/badge` | Generate SVG badge | `image/svg+xml` |
| `GET /api/rank` | Get ranking data | `application/json` |
| `GET /api/stats/:user` | Get user statistics | `application/json` |
| `GET /health` | Health check | `application/json` |

---

## โš™๏ธ **Parameters**

### ๐ŸŽฏ **Badge Generation**
```
GET /api/badge?user={username}&metric={metric}&style={style}&theme={theme}
```

| Parameter | Required | Options | Default | Description |
|-----------|----------|---------|---------|-------------|
| `user` | โœ… | Any GitHub username | - | Target GitHub user |
| `metric` | โŒ | `stars`, `forks`, `followers`, `commits` | `stars` | Ranking metric |
| `style` | โŒ | `flat`, `flat-square`, `for-the-badge`, `plastic` | `flat` | Badge style |
| `theme` | โŒ | `dark`, `light` | `dark` | Color theme |
| `country` | โŒ | Country name | - | Regional ranking |

### ๐Ÿ“Š **JSON API**
```
GET /api/rank?user={username}&metric={metric}
```

---

## ๐ŸŽจ **Design Features**

### ๐ŸŒ™ **Dark Theme (Hacker Style)**
- **Background**: Deep space black (`#0d1117`)
- **Accents**: Neon green (`#00ff7f`) and cyan (`#00ffff`)
- **Typography**: Monospace fonts for terminal aesthetic
- **Effects**: Subtle glowing borders and text shadows

### โ˜€๏ธ **Light Theme**
- **Background**: Clean white (`#ffffff`)
- **Accents**: GitHub blue (`#0969da`)
- **Typography**: Same monospace fonts for consistency
- **Effects**: Subtle shadows and clean borders

### ๐ŸŽฏ **Visual Elements**
- **๐Ÿ™ Octocat Icon**: Positioned on the left side of each badge
- **๐Ÿ“Š Metric Display**: Clear metric name and ranking
- **๐Ÿ”ข Value Formatting**: Smart number formatting (1.2K, 5.6M)
- **๐Ÿ† Tier Colors**: Color-coded ranking tiers

---

## ๐Ÿ† **Ranking System**

| Tier | Percentile | Color (Dark) | Color (Light) | Requirements |
|------|------------|--------------|---------------|--------------|
| **Top 1%** | 99th | ![#ff0080](https://via.placeholder.com/15/ff0080/000000?text=+) Neon Pink | ![#d1242f](https://via.placeholder.com/15/d1242f/000000?text=+) Red | โญ10K+ stars, ๐Ÿ‘ฅ5K+ followers |
| **Top 5%** | 95th | ![#ff4500](https://via.placeholder.com/15/ff4500/000000?text=+) Neon Orange | ![#fb8500](https://via.placeholder.com/15/fb8500/000000?text=+) Orange | โญ2K+ stars, ๐Ÿ‘ฅ1K+ followers |
| **Top 10%** | 90th | ![#00ffff](https://via.placeholder.com/15/00ffff/000000?text=+) Cyan | ![#0969da](https://via.placeholder.com/15/0969da/000000?text=+) Blue | โญ500+ stars, ๐Ÿ‘ฅ300+ followers |
| **Top 25%** | 75th | ![#00ff7f](https://via.placeholder.com/15/00ff7f/000000?text=+) Neon Green | ![#1a7f37](https://via.placeholder.com/15/1a7f37/000000?text=+) Green | โญ100+ stars, ๐Ÿ‘ฅ50+ followers |
| **Top 50%** | 50th | ![#9370db](https://via.placeholder.com/15/9370db/000000?text=+) Purple | ![#8250df](https://via.placeholder.com/15/8250df/000000?text=+) Purple | โญ20+ stars, ๐Ÿ‘ฅ10+ followers |

---

## ๐Ÿš€ **Installation & Deployment**

### ๐Ÿ’ป **Local Development**
```bash
# Clone the repository
git clone https://github.com/yashab-cyber/gitrank.git
cd gitrank

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Add your GitHub token (optional but recommended)

# Start development server
npm run dev
```

### ๐Ÿณ **Docker**
```bash
# Build and run
docker build -t gitrank .
docker run -p 3000:3000 --env-file .env gitrank

# Or use Docker Compose
docker-compose up
```

### โ˜๏ธ **Cloud Deployment**

#### **Vercel** (Recommended)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/yashab-cyber/gitrank)

#### **Railway**
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template?template=https://github.com/yashab-cyber/gitrank)

#### **Render**
1. Connect your GitHub repository
2. Set build command: `npm install`
3. Set start command: `npm start`
4. Add environment variables

---

## ๐Ÿ“– **Usage Examples**

### ๐Ÿ  **Personal Profile README**
```markdown

# Hi there! I'm [Your Name] ๐Ÿ‘‹

## ๐Ÿ† My GitHub Rankings

![Stars](https://gitrank.zehrasec.com/api/badge?user=yourusername&metric=stars&style=for-the-badge&theme=dark)
![Followers](https://gitrank.zehrasec.com/api/badge?user=yourusername&metric=followers&style=for-the-badge&theme=dark)
![Commits](https://gitrank.zehrasec.com/api/badge?user=yourusername&metric=commits&style=for-the-badge&theme=dark)

*Real-time rankings updated every 12 hours*


```

### ๐Ÿข **Repository Badges**
```markdown
## ๐Ÿ‘จโ€๐Ÿ’ป Maintainer Stats

[![Maintainer Stars](https://gitrank.zehrasec.com/api/badge?user=maintainer&metric=stars&theme=light)](https://github.com/maintainer)
[![Maintainer Followers](https://gitrank.zehrasec.com/api/badge?user=maintainer&metric=followers&theme=light)](https://github.com/maintainer)
```

### ๐ŸŒ **HTML Integration**
```html


GitHub Stars Ranking
GitHub Forks Ranking

```

---

## ๐Ÿ”ง **Configuration**

### ๐Ÿ” **Environment Variables**
```bash
# Required
PORT=3000 # Server port
NODE_ENV=production # Environment

# Optional (Recommended)
GITHUB_TOKEN=your_token # Personal access token for higher rate limits
CACHE_TTL=43200 # Cache duration (12 hours)
RATE_LIMIT_WINDOW=3600000 # Rate limit window (1 hour)
RATE_LIMIT_MAX=1000 # Max requests per window
```

### โšก **Performance**
- **Caching**: 12-hour intelligent caching reduces API calls by 95%
- **Rate Limiting**: 1000 requests/hour per IP
- **CDN Ready**: Perfect for global deployment with edge caching
- **Response Time**: Sub-500ms response times with caching

---

## ๐Ÿงช **Testing**

```bash
# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run specific tests
npm test tests/ranking.test.js
```

---

## ๐Ÿค **Contributing**

We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

1. **Fork** the repository
2. **Create** a feature branch: `git checkout -b feature/amazing-feature`
3. **Commit** your changes: `git commit -m 'Add amazing feature'`
4. **Push** to the branch: `git push origin feature/amazing-feature`
5. **Open** a Pull Request

---

## ๐Ÿ“Š **API Rate Limits**

| Authentication | Requests/Hour | GitHub API Limit |
|----------------|---------------|------------------|
| **No Token** | 60 | GitHub's IP-based limit |
| **With Token** | 5,000 | GitHub's authenticated limit |
| **Cached Responses** | Unlimited | Served from cache |

---

## ๐ŸŒŸ **Showcase**

### ๐ŸŽฏ **Live Examples**

![Example Stars Dark](https://gitrank.zehrasec.com/api/badge?user=octocat&metric=stars&style=for-the-badge&theme=dark)
![Example Followers Dark](https://gitrank.zehrasec.com/api/badge?user=octocat&metric=followers&style=for-the-badge&theme=dark)


![Example Stars Light](https://gitrank.zehrasec.com/api/badge?user=octocat&metric=stars&style=for-the-badge&theme=light)
![Example Followers Light](https://gitrank.zehrasec.com/api/badge?user=octocat&metric=followers&style=for-the-badge&theme=light)

---

## ๐Ÿ“„ **License**

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## ๐Ÿ™ **Acknowledgments**

- **GitHub** for the excellent API and Octocat mascot
- **Open Source Community** for inspiration and feedback
- **Terminal Culture** for the hacker aesthetic inspiration
- **Contributors** who make this project better

---

## ๐Ÿ“ž **Support & Community**

### ๐ŸŒŸ **Star this repo if it helped you!**

[![GitHub stars](https://img.shields.io/github/stars/yashab-cyber/gitrank?style=social)](https://github.com/yashab-cyber/gitrank/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/yashab-cyber/gitrank?style=social)](https://github.com/yashab-cyber/gitrank/network/members)

**[๐Ÿ’ฌ Discussions](https://github.com/yashab-cyber/gitrank/discussions) โ€ข [๐Ÿ› Issues](https://github.com/yashab-cyber/gitrank/issues) โ€ข [โœจ Feature Requests](https://github.com/yashab-cyber/gitrank/discussions)**

---

**Made with โšก by hackers, for hackers**

*Keep coding, keep ranking* ๐Ÿš€