Skip to content

sah1l/devcred

Repository files navigation

DevCred Logo

DevCred

Unified Developer Contribution Tracker

Aggregate and showcase your contributions from GitHub, GitLab, Bitbucket, and Azure DevOps in one place. Generate beautiful embeddable widgets for your profile README, portfolio, or resume.

CI License: MIT TypeScript Next.js

View Live Demo


Why DevCred?

Most developers contribute across multiple platforms. Your GitHub profile only tells part of the story. DevCred solves this by:

  • Aggregating contributions from GitHub, GitLab, Bitbucket, and Azure DevOps
  • Visualizing your combined activity in beautiful heatmaps and stats cards
  • Generating embeddable SVG widgets for your GitHub README, portfolio, or resume
  • Respecting privacy - uses OAuth (no PATs), stores only aggregate counts

Features

Multi-Platform Support

Connect all your developer accounts in one place:

Platform API Used Data Collected
GitHub GraphQL API Commits, PRs, Issues, Reviews
GitLab Events API Commits, MRs, Issues
Bitbucket REST API Commits, PRs
Azure DevOps REST API Commits, PRs

Embeddable Widgets

Contribution Heatmap

![DevCred Heatmap](https://devcred.io/api/widget/sah1l/heatmap.svg)

Stats Card

![DevCred Stats](https://devcred.io/api/widget/sah1l/stats.svg)

JSON API

curl https://devcred.io/api/v1/users/sah1l/contributions
{
  "username": "johndoe",
  "total_contributions": 1337,
  "platforms": {
    "github": { "commits": 800, "pullRequests": 50, "issues": 20, "reviews": 30 },
    "gitlab": { "commits": 400, "pullRequests": 30, "issues": 7, "reviews": 0 }
  },
  "calendar": [
    { "date": "2024-01-01", "count": 5, "level": 2 }
  ]
}

Widget Customization

Parameter Options Default Description
theme light, dark, github dark Color theme
labels true, false true Show day/month labels
icons true, false true Show icons (stats only)

Examples:

<!-- Dark theme (default) -->
![Heatmap](https://devcred.io/api/widget/username/heatmap.svg)

<!-- Light theme -->
![Heatmap](https://devcred.io/api/widget/username/heatmap.svg?theme=light)

<!-- GitHub style, no labels -->
![Heatmap](https://devcred.io/api/widget/username/heatmap.svg?theme=github&labels=false)

Quick Start

Prerequisites

  • Node.js 18+
  • PostgreSQL database (or Supabase)
  • OAuth apps on GitHub, GitLab, Google

Installation

# Clone the repository
git clone https://github.com/sah1l/devcred.git
cd devcred

# Install dependencies
npm install

# Copy environment variables
cp .env.example .env

# Generate encryption key and add to .env
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"

# Push database schema
npm run db:push

# Start development server
npm run dev

Open http://localhost:3000 to see the app.


OAuth Setup

GitHub

  1. Go to GitHub Developer Settings
  2. Click "New OAuth App"
  3. Set Authorization callback URL: http://localhost:3000/api/auth/callback/github
  4. Copy Client ID → AUTH_GITHUB_ID
  5. Generate Client Secret → AUTH_GITHUB_SECRET

GitLab

  1. Go to GitLab Applications
  2. Create new application with read_api scope
  3. Set Redirect URI: http://localhost:3000/api/auth/callback/gitlab
  4. Copy Application ID → AUTH_GITLAB_ID
  5. Copy Secret → AUTH_GITLAB_SECRET

Google (for login)

  1. Go to Google Cloud Console
  2. Create OAuth 2.0 Client ID (Web application)
  3. Add Authorized redirect URI: http://localhost:3000/api/auth/callback/google
  4. Copy Client ID → AUTH_GOOGLE_ID
  5. Copy Client Secret → AUTH_GOOGLE_SECRET

Tech Stack

Category Technology
Framework Next.js 16 (App Router)
Language TypeScript 5
Database PostgreSQL / Supabase
ORM Drizzle ORM
Auth Auth.js v5 (NextAuth)
Styling Tailwind CSS 4
Icons Lucide React
Deployment Vercel

Project Structure

devcred/
├── src/
│   ├── app/                    # Next.js App Router
│   │   ├── (auth)/            # Auth pages (login)
│   │   ├── (dashboard)/       # Protected dashboard
│   │   ├── [username]/        # Public profile pages
│   │   └── api/               # API routes
│   │       ├── auth/          # NextAuth handlers
│   │       ├── cron/          # Background sync jobs
│   │       ├── sync/          # Manual sync endpoint
│   │       ├── v1/            # Public JSON API
│   │       └── widget/        # SVG widget endpoints
│   ├── components/            # React components
│   ├── lib/
│   │   ├── auth/              # Auth configuration
│   │   ├── crypto/            # Token encryption (AES-256-GCM)
│   │   ├── db/                # Database schema & client
│   │   ├── fetchers/          # Platform-specific API fetchers
│   │   ├── services/          # Business logic (sync)
│   │   ├── types/             # TypeScript types
│   │   └── widgets/           # SVG generators
│   └── middleware.ts          # Auth middleware
├── drizzle/                   # Database migrations
├── docs/                      # Documentation
├── public/                    # Static assets
├── .github/workflows/         # GitHub Actions
└── .env.example               # Environment template

Scripts

Command Description
npm run dev Start development server with Turbopack
npm run build Build for production
npm run start Start production server
npm run lint Run ESLint
npm run db:generate Generate Drizzle migrations
npm run db:push Push schema to database
npm run db:migrate Run migrations
npm run db:studio Open Drizzle Studio GUI

Deployment

Vercel (Recommended)

Deploy with Vercel

  1. Click the deploy button
  2. Add all environment variables from .env.example
  3. Deploy!

Cron Setup (Vercel):

Add to vercel.json:

{
  "crons": [
    {
      "path": "/api/cron/daily",
      "schedule": "0 2 * * *"
    }
  ]
}

Self-Hosted

# Build
npm run build

# Start with PM2
pm2 start npm --name "devcred" -- start

# Set up cron job
0 2 * * * curl -H "Authorization: Bearer $CRON_SECRET" https://your-domain.com/api/cron/daily

API Reference

Widget Endpoints

Endpoint Description
GET /api/widget/{username}/heatmap.svg Contribution heatmap SVG
GET /api/widget/{username}/stats.svg Stats card SVG

JSON API

Endpoint Description
GET /api/v1/users/{username}/contributions User contributions data

Query Parameters:

  • from - Start date (YYYY-MM-DD), default: 1 year ago
  • to - End date (YYYY-MM-DD), default: today

Roadmap

  • GitHub integration (GraphQL)
  • GitLab integration (Events API)
  • Bitbucket integration (REST API)
  • Azure DevOps integration (REST API)
  • SVG heatmap widget
  • SVG stats card widget
  • JSON API
  • Public profile pages
  • Token encryption (AES-256-GCM)
  • Daily background sync
  • Custom widget themes
  • Streak tracking & badges
  • Team/organization dashboards
  • Weekly email summaries
  • GitHub Action for README auto-update
  • Webhook support for real-time updates

Contributing

We love contributions! Please read our Contributing Guide to get started.

Quick Contributing Steps

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run tests and linting: npm run lint
  5. Commit with a descriptive message: git commit -m 'feat: add amazing feature'
  6. Push to your branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Security

  • OAuth tokens are encrypted at rest using AES-256-GCM
  • Only aggregate contribution counts are stored (no code, no commit messages)
  • Tokens are decrypted only when syncing data
  • See SECURITY.md for reporting vulnerabilities

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments


If you find DevCred useful, please consider giving it a ⭐

Made with ❤️ by developers, for developers

Report Bug · Request Feature · Discussions

About

Aggregate and showcase your contributions from GitHub, GitLab, Bitbucket, and Azure DevOps in one place. Generate beautiful embeddable widgets for your profile README, portfolio, or resume.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors