{"id":25556410,"url":"https://github.com/mohdyahyamahmodi/github-tracker","last_synced_at":"2026-05-06T03:34:38.092Z","repository":{"id":278317328,"uuid":"935133171","full_name":"MohdYahyaMahmodi/GitHub-Tracker","owner":"MohdYahyaMahmodi","description":"Customizable profile view counter for GitHub profiles \u0026 repositories. Create stylish SVG badges to track real-time view statistics on your README files. Built with Vercel serverless functions and MongoDB.","archived":false,"fork":false,"pushed_at":"2025-02-19T05:17:16.000Z","size":25176,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T06:24:07.669Z","etag":null,"topics":["github-readme","mongodb","profile-counter","serverless","svg-badges","vercel","view-counter"],"latest_commit_sha":null,"homepage":"https://ghtb-counter.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MohdYahyaMahmodi.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-19T00:40:01.000Z","updated_at":"2025-02-19T05:17:39.000Z","dependencies_parsed_at":"2025-02-19T06:34:20.654Z","dependency_job_id":null,"html_url":"https://github.com/MohdYahyaMahmodi/GitHub-Tracker","commit_stats":null,"previous_names":["mohdyahyamahmodi/github-tracker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MohdYahyaMahmodi%2FGitHub-Tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MohdYahyaMahmodi%2FGitHub-Tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MohdYahyaMahmodi%2FGitHub-Tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MohdYahyaMahmodi%2FGitHub-Tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MohdYahyaMahmodi","download_url":"https://codeload.github.com/MohdYahyaMahmodi/GitHub-Tracker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239852917,"owners_count":19707778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-readme","mongodb","profile-counter","serverless","svg-badges","vercel","view-counter"],"created_at":"2025-02-20T14:26:34.627Z","updated_at":"2025-10-11T05:12:11.042Z","avatar_url":"https://github.com/MohdYahyaMahmodi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Tracker\n\n[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n![Vercel](https://img.shields.io/badge/vercel-%23000000.svg?style=flat\u0026logo=vercel\u0026logoColor=white)\n![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=flat\u0026logo=mongodb\u0026logoColor=white)\n![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=flat\u0026logo=javascript\u0026logoColor=%23F7DF1E)\n\n![Views](https://ghtb-counter.vercel.app/api/counter?username=GitHub-Tracker\u0026label=Views\u0026color=000000\u0026labelColor=000000\u0026labelBgColor=ffffff\u0026countColor=ffffff\u0026style=flat)\n\nA customizable, real-time profile view counter for your GitHub profiles and repositories. Add stylish badges to track and display visitor counts on your README files.\n\n## 🌟 Features\n\n- **Real-time Tracking**: Count profile and repository views as they happen\n- **Fully Customizable**: Change colors, labels, and badge styles\n- **Multiple Badge Styles**: Choose from flat, plastic, or for-the-badge styles\n- **MongoDB Integration**: Reliable storage with MongoDB Atlas\n- **Serverless Architecture**: Powered by Vercel for maximum performance\n\n## 📊 Demo\n\nCreate your own badge at [https://ghtb-counter.vercel.app](https://ghtb-counter.vercel.app)\n\n## 📋 Table of Contents\n\n- [How It Works](#-how-it-works)\n- [Installation](#-installation)\n  - [Prerequisites](#prerequisites)\n  - [Environment Variables](#environment-variables)\n  - [Deployment](#deployment)\n- [API Reference](#-api-reference)\n  - [Counter Endpoint](#counter-endpoint)\n  - [Stats Endpoint](#stats-endpoint)\n  - [Analytics Endpoint](#analytics-endpoint)\n  - [Bulk Update Endpoint](#bulk-update-endpoint)\n- [Badge Customization](#-badge-customization)\n- [Contributing](#-contributing)\n- [License](#-license)\n\n## 🔍 How It Works\n\n1. **Badge Generation**: When someone views your GitHub profile/repo with the badge embedded, a request is sent to our API\n2. **View Counting**: The API processes the request, authenticates it, and increments your view counter in MongoDB\n3. **SVG Rendering**: A customized SVG badge is generated and returned, displaying your current view count\n4. **Caching**: Connection pooling and MongoDB caching prevent serverless cold starts\n\nThe system uses MongoDB to store view counts and metadata, with Vercel serverless functions handling the API endpoints.\n\n## 🚀 Installation\n\n### Prerequisites\n\n- [Node.js](https://nodejs.org/) (v14 or newer)\n- [Vercel CLI](https://vercel.com/cli)\n- [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) account\n\n### Environment Variables\n\nThe application requires the following environment variables:\n\n| Variable | Description |\n|----------|-------------|\n| `MONGODB_URI` | MongoDB connection string |\n| `API_KEY` | Secret key for accessing analytics endpoints |\n\n### Deployment\n\n1. **Clone the repository**\n\n```bash\ngit clone https://github.com/MohdYahyaMahmodi/GitHub-Tracker\ncd GitHub-Tracker\n```\n\n2. **Install dependencies**\n\n```bash\nnpm install\n```\n\n3. **Set up MongoDB Atlas**\n   - Create a free [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) account\n   - Create a new cluster\n   - Create a database named `profile-counter`\n   - Create a user with read/write access to the database\n   - Get your connection string from Atlas dashboard\n\n4. **Deploy to Vercel**\n\n```bash\nvercel --prod --env MONGODB_URI=\"mongodb+srv://username:password@your-cluster.mongodb.net/profile-counter?retryWrites=true\u0026w=majority\" --env API_KEY=\"your-secret-api-key\"\n```\n\nReplace the connection string and API key with your actual values.\n\n5. **Verify deployment**\n\nVisit your Vercel deployment URL to confirm everything is working.\n\n## 📝 API Reference\n\n### Counter Endpoint\n\n```\nGET /api/counter\n```\n\nGenerates and returns an SVG badge while incrementing the view counter.\n\n**Query Parameters:**\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `username` | string | **Required**. GitHub username or repository |\n| `label` | string | Label text (default: \"Profile Views\") |\n| `color` | string | Count background color (hex without #) |\n| `labelColor` | string | Label text color (hex without #) |\n| `labelBgColor` | string | Label background color (hex without #) |\n| `countColor` | string | Count text color (hex without #) |\n| `style` | string | Badge style: flat, plastic, or for-the-badge |\n| `noCount` | boolean | If true, view is not counted (for preview) |\n\n**Example:**\n```\n/api/counter?username=MohdYahyaMahmodi\u0026label=Profile%20Views\u0026color=6366f1\u0026style=flat\n```\n\n### Stats Endpoint\n\n```\nGET /api/stats\n```\n\nReturns current view count and last updated time for a username.\n\n**Query Parameters:**\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `username` | string | **Required**. GitHub username or repository |\n\n**Response:**\n```json\n{\n  \"username\": \"MohdYahyaMahmodi\",\n  \"count\": 1234,\n  \"lastUpdated\": \"2025-02-15T12:34:56.789Z\"\n}\n```\n\n### Analytics Endpoint\n\n```\nGET /api/analytics\n```\n\nReturns detailed analytics for a username (requires API key).\n\n**Headers:**\n- `X-API-Key`: Your API key\n\n**Query Parameters:**\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `username` | string | **Required**. GitHub username or repository |\n| `days` | number | Number of days of data to return (default: 30) |\n\n**Response:**\n```json\n{\n  \"username\": \"MohdYahyaMahmodi\",\n  \"totalCount\": 1234,\n  \"lastUpdated\": \"2025-02-15T12:34:56.789Z\",\n  \"dailyViews\": [\n    {\"_id\": \"2025-02-01\", \"count\": 42},\n    {\"_id\": \"2025-02-02\", \"count\": 37}\n  ],\n  \"topReferrers\": [\n    {\"_id\": \"github.com\", \"count\": 853},\n    {\"_id\": \"google.com\", \"count\": 215}\n  ]\n}\n```\n\n### Bulk Update Endpoint\n\n```\nPOST /api/bulk-update\n```\n\nPerforms multiple view count updates (for testing purposes).\n\n**Request Body:**\n```json\n{\n  \"username\": \"MohdYahyaMahmodi\",\n  \"updateCount\": 10,\n  \"delay\": 300\n}\n```\n\n## 🎨 Badge Customization\n\nYou can customize your badge in several ways:\n\n### Style Options\n\n| Style | Example |\n|-------|---------|\n| `flat` | ![Flat](https://img.shields.io/badge/style-flat-blue?style=flat) |\n| `plastic` | ![Plastic](https://img.shields.io/badge/style-plastic-blue?style=plastic) |\n| `for-the-badge` | ![For The Badge](https://img.shields.io/badge/STYLE-FOR_THE_BADGE-blue?style=for-the-badge) |\n\n### Color Options\n\nYou can specify colors using hex codes (without #) or named colors:\n- blue\n- green\n- red\n- yellow\n- orange\n- purple\n- black\n- gray\n\n### Markdown Implementation\n\nAdd this to your GitHub README.md:\n\n```markdown\n![Profile Views](https://ghtb-counter.vercel.app/api/counter?username=yourusername\u0026label=Profile%20Views\u0026color=6366f1\u0026style=flat)\n```\n\n### HTML Implementation\n\n```html\n\u003cimg src=\"https://ghtb-counter.vercel.app/api/counter?username=yourusername\u0026label=Profile%20Views\u0026color=6366f1\u0026style=flat\" alt=\"Profile Views\" /\u003e\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## 📁 Project Structure\n\n```\nGitHub-Tracker/\n├── api/\n│   ├── counter.js       # Main counter endpoint\n│   ├── stats.js         # Stats retrieval endpoint\n│   ├── analytics.js     # Detailed analytics endpoint\n│   └── bulk-update.js   # Bulk update endpoint for testing\n├── public/\n│   ├── index.html       # Main web interface\n│   ├── styles.css       # Styling for web interface\n│   ├── script.js        # Frontend JavaScript\n│   └── favicon.ico      # Site favicon\n├── package.json         # Project dependencies\n├── vercel.json          # Vercel configuration\n└── README.md            # Project documentation\n```\n\n## 🔧 Troubleshooting\n\n### Common Issues\n\n**MongoDB Connection Errors**\n- Verify your IP address is whitelisted in MongoDB Atlas\n- Confirm connection string format is correct\n- Ensure database user has appropriate permissions\n\n**Badge Not Updating**\n- GitHub caches images. Add a query parameter like `?t=123` to force refresh\n- Check console for any API errors\n- Verify username is correctly specified\n\n**Deployment Issues**\n- Ensure all environment variables are properly set\n- Check Vercel deployment logs for errors\n- Verify Node.js version compatibility\n\nFor more help, please open an issue on the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohdyahyamahmodi%2Fgithub-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohdyahyamahmodi%2Fgithub-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohdyahyamahmodi%2Fgithub-tracker/lists"}