{"id":34636761,"url":"https://github.com/0xarchit/github-profile-analyzer","last_synced_at":"2025-12-24T17:03:59.629Z","repository":{"id":306077337,"uuid":"1023801737","full_name":"0xarchit/github-profile-analyzer","owner":"0xarchit","description":"AI Powered Github Profile analyzer and reviewer tool. Gives review based on first 100 repos and only includes those forks in which user has contributions to avoid fake results","archived":false,"fork":false,"pushed_at":"2025-08-24T13:43:51.000Z","size":23,"stargazers_count":81,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T18:52:34.875Z","etag":null,"topics":["github","github-analysis","github-analyzer","github-profile","github-profile-analyzer","github-profile-card","github-profile-info"],"latest_commit_sha":null,"homepage":"https://git.0xcloud.workers.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xarchit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-07-21T18:02:53.000Z","updated_at":"2025-08-24T15:44:47.000Z","dependencies_parsed_at":"2025-07-23T15:22:55.453Z","dependency_job_id":null,"html_url":"https://github.com/0xarchit/github-profile-analyzer","commit_stats":null,"previous_names":["0xarchit/github-profile-analyzer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0xarchit/github-profile-analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xarchit%2Fgithub-profile-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xarchit%2Fgithub-profile-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xarchit%2Fgithub-profile-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xarchit%2Fgithub-profile-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xarchit","download_url":"https://codeload.github.com/0xarchit/github-profile-analyzer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xarchit%2Fgithub-profile-analyzer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28005408,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","github-analysis","github-analyzer","github-profile","github-profile-analyzer","github-profile-card","github-profile-info"],"created_at":"2025-12-24T17:02:33.396Z","updated_at":"2025-12-24T17:03:59.624Z","avatar_url":"https://github.com/0xarchit.png","language":"JavaScript","readme":"# GitHub Profile Analyzer\n\n\u003e AI Powered Github Profile analyzer and reviewer tool. Gives review based on first 100 repos and only includes those forks in which user has contributions to avoid fake results\n\nServerless GitHub profile analytics you can deploy in minutes. This project ships:\n\n- A single, production-ready Cloudflare Worker (`worker.js`) that powers the UI and APIs\n- Two demo Workers for standalone usage: `contri-graph.js` (SVG contribution heatmap) and `badge.js` (achievement badges)\n\nThis README documents every API, parameters, responses, configuration, and how the system works end-to-end.\n\n---\n\n## Contents\n\n- [Overview and architecture](#overview-and-architecture)\n- [Important Highlight](#important-highlights)\n- [Configuration (tokens, origins, env)](#configuration-tokens-origins-env)\n- [API reference: worker.js (all-in-one)](#api-reference-workerjs-all-in-one)\n- [API reference: contri-graph.js (demo)](#api-reference-contri-graphjs-demo)\n- [API reference: badge.js (demo)](#api-reference-badgejs-demo)\n- [Caching, rate limits, and security](#caching-rate-limits-and-security)\n- [Examples and embeds](#examples-and-embeds)\n- [Deploy with Cloudflare Workers](#deploy-with-cloudflare-workers)\n- [Troubleshooting](#troubleshooting)\n\n---\n\n## Overview and architecture\n\n`worker.js` handles:\n\n- GET `/` — serves a built-in Tailwind UI that calls the APIs\n- GET `/rate_limit` — aggregates GitHub REST API rate limits across multiple tokens\n- GET `/contributions?username=\u003cuser\u003e` — returns an SVG heatmap of public contributions\n- GET `/api?username=\u003cuser\u003e` — returns a unified JSON: profile, repos, authored forks, badges, and an AI analysis\n\nAdditionally, the UI embeds third‑party stat images (readme-stats, streaks, trophies) and provides print/save features. The Worker enforces CORS for sensitive endpoints and uses both CDN and browser caching to reduce API load.\n\nDemo Workers:\n\n- `contri-graph.js`: minimal, tokenized SVG generator for contribution heatmaps\n- `badge.js`: minimal badge resolver that returns unlocked GitHub achievements and their image URLs\n\n---\n\n## Important Highlights\n\n- **Local Storage Caching:** All API responses are cached in the browser's local storage for 1 hour, minimizing redundant requests and improving performance for repeat visits.\n- **Repository Limit:** Only the first 100 repositories (sorted by GitHub's default order) are processed for contribution and badge analysis, ensuring fast response times.\n- **Fork Filtering:** For forked repositories, only those in which the user has made at least one commit are included in the analysis. This ensures the stats and graphs reflect the user's actual contributions, not just forks with no activity.\n- **Permanent Page URLs:** Each analyzed profile can be accessed via a unique, shareable URL, allowing you to revisit or share the analysis page at any time.\n- **Download \u0026 Print to PDF:** The analysis page can be downloaded or saved as a PDF (using your browser's \"Print to PDF\" feature) for offline viewing or sharing.\n\n## Configuration\n\nOpen `worker.js` and customize:\n\n- `const githubTokens = [\"api_keys\"];`\n    - Array of one or more GitHub personal access tokens (classic or fine‑grained) with public repo read permissions.\n    - Used for REST and GraphQL calls; one is randomly chosen per request.\n\n- `const cerebrasKeys = [\"api_keys\"];`\n    - Array of Cerebras API keys, used to call `https://api.cerebras.ai/v1/chat/completions` for the AI section.\n    - If unavailable, the `/api` route will fail at the AI step. Provide a key or adjust the code to disable AI.\n\n- `const FRONTEND_ORIGIN = 'deployemnt_link';`\n    - Only requests where the Origin/Referer starts with this string are allowed for `/api` and `/contributions`.\n    - Example: `https://git.yourdomain.workers.dev` or `https://your-frontend.example.com`.\n\nOther noteworthy constants and behavior:\n\n- Badge slugs checked: pull-shark, starstruck, pair-extraordinaire, galaxy-brain, yolo, quickdraw, highlight, community, deep-diver, arctic-code-vault-contributor, public-sponsor, heart-on-your-sleeve, open-sourcerer\n- Achievements are validated via a cheap `HEAD` probe to `https://github.com/\u003cuser\u003e?tab=achievements\u0026achievement=\u003cslug\u003e`\n- Star gating: `/api` checks if the user has starred `0xarchit/github-profile-analyzer` and returns 403 otherwise. You can change this repo string inside `worker.js` if needed.\n\n---\n\n## API reference: worker.js (all-in-one)\n\nBase URL: your Cloudflare Worker URL (for development examples we’ll use `https://\u003cyour-worker\u003e.workers.dev`).\n\nSecurity and CORS:\n\n- `/api` and `/contributions` require the request Origin or Referer to start with `FRONTEND_ORIGIN`.\n- `/rate_limit` and `/` do not enforce this CORS check.\n\nCommon errors:\n\n- 403 Cross-origin requests are not allowed — Origin/Referer mismatch for protected routes\n- 403 You have not starred the repository — star-gating rule in `/api`\n- 429 GitHub API rate limit exceeded — aggregate remaining is 0 across selected token\n- 500 Worker error — unexpected runtime error\n\n### GET `/`\n\nServes the built-in UI. Supports `?username=\u003cuser\u003e` to pre-fill and auto-run.\n\n### GET `/rate_limit`\n\nAggregates GitHub rate-limit across all tokens defined in `githubTokens`.\n\nResponse 200 application/json:\n\n```\n{\n    \"rate\": { \"limit\": number, \"used\": number, \"remaining\": number }\n}\n```\n\nNotes:\n\n- Calls `https://api.github.com/rate_limit` once per token and sums fields from `data.rate`.\n\n### GET `/contributions?username=\u003cuser\u003e`\n\nReturns an SVG heatmap representing the user’s public contributions. Internally uses GitHub GraphQL API.\n\nParameters:\n\n- `username` (required): GitHub login\n\nBehavior:\n\n- Queries `contributionsCollection.contributionCalendar.weeks[].contributionDays[]`\n- Computes a max intensity, renders a 7×N grid (weeks×days)\n- Colors: `#2f3727` for zero; `rgba(0,255,0, alpha)` for \u003e0 with alpha scaled by intensity\n- CDN caching: `Cache-Control: public, max-age=3600` and saved in `caches.default` by URL\n\nResponses:\n\n- 200 image/svg+xml — SVG content\n- 400 application/json — `{ error: \"Username parameter is required\" }`\n- 403 application/json — CORS blocked (`FRONTEND_ORIGIN` mismatch)\n- 4xx/5xx application/json — GitHub API errors forwarded with message\n\nEmbed example (HTML):\n\n```html\n\u003cimg src=\"https://\u003cyour-worker\u003e.workers.dev/contributions?username=octocat\" alt=\"octocat contributions\"/\u003e\n```\n\n### GET `/api?username=\u003cuser\u003e`\n\nReturns a unified JSON combining public profile, repositories, authored forks, unlocked badges, and an AI analysis.\n\nParameters:\n\n- `username` (required)\n\nRequest pre-checks:\n\n- CORS: Origin/Referer must start with `FRONTEND_ORIGIN`\n- Rate limit: queries `https://api.github.com/rate_limit`; if `remaining` is 0 returns 429\n- Star gating: fetches `GET /users/\u003cuser\u003e/starred?per_page=1000\u0026page=1` and checks presence of `0xarchit/github-profile-analyzer`. If missing, returns 403 with `{ showPopup: true }` to instruct the UI to show a “Star this repo” prompt\n\nCollection logic:\n\n- Profile via `GET /users/\u003cuser\u003e`\n- Repositories via `GET /users/\u003cuser\u003e/repos?per_page=100\u0026page=1`\n    - Only first 100 repos considered\n    - Two buckets are returned:\n        - `original_repos`: non-forks\n        - `authored_forks`: forks where the user has at least one commit (checked with `GET /repos/\u003cuser\u003e/\u003crepo\u003e/commits?per_page=100` and matching `author.login === \u003cuser\u003e`)\n- Badges via achievement `HEAD` checks for known slugs\n- AI via Cerebras chat completions with a JSON-only system prompt; model `llama-4-scout-17b-16e-instruct`\n\nResponse 200 application/json (shape):\n\n```\n{\n    \"avatar\": string | null,\n    \"username\": string | null,\n    \"name\": string | null,\n    \"company\": string | null,\n    \"location\": string | null,\n    \"blog\": string | null,\n    \"bio\": string | null,\n    \"email\": string | null,\n    \"twitter\": string | null,\n    \"followers\": number,\n    \"following\": number,\n    \"public_repo_count\": number,\n    \"original_repos\": {\n        \"\u003crepoName\u003e\": {\n            \"description\": string | null,\n            \"stars\": number,\n            \"forks\": number,\n            \"issues\": number,\n            \"watchers\": number,\n            \"primary_lang\": string | null,\n            \"has_issues\": boolean,\n            \"has_projects\": boolean,\n            \"has_wiki\": boolean,\n            \"has_pages\": boolean,\n            \"has_downloads\": boolean,\n            \"has_discussions\": boolean,\n            \"license\": object,\n            \"topics\": string[]\n        },\n        ...\n    },\n    \"authored_forks\": { ...same shape as above... },\n    \"badges\": { \"\u003cslug\u003e\": \"\u003cimageUrl\u003e\", ... },\n\n    // AI section (from Cerebras)\n    \"score\": number,                 // 0..100\n    \"detailed_analysis\": string,\n    \"improvement_areas\": string[],\n    \"diagnostics\": string[],\n    \"project_ideas\": {\n        \"project_idea_1\": { \"title\": string, \"description\": string, \"tech stack\"?: string[], \"tech_stack\"?: string[] },\n        \"project_idea_2\": { ... },\n        \"project_idea_3\"?: { ... }\n    },\n    \"tag\"?: { \"tag_name\"?: string, \"description\"?: string, ... },\n    \"developer_type\"?: string\n}\n```\n\nError responses:\n\n- 400 `{ error: \"Username parameter is required\" }`\n- 403 `{ error: \"Cross-origin requests are not allowed\" }`\n- 403 `{ error: \"You have not starred the 0xarchit/github-profile-analyzer repository\", showPopup: true }`\n- 429 `{ error: \"GitHub API rate limit exceeded\" }`\n- 4xx/5xx `{ error: \"Failed to fetch ...\" }`\n\nNotes and limitations:\n\n- Commit check for authored forks examines up to 100 latest commits per repo; earlier commits may be missed\n- Only public data is analyzed; private repos and private contributions are invisible\n- If Cerebras call fails, the route returns an error; you may opt to try/catch and continue without AI\n\n---\n\n## API reference: contri-graph.js (demo)\n\nThis is a minimal Worker that returns an SVG heatmap. It expects you to set a single GitHub token inside the file.\n\nRoute: GET `/?username=\u003cuser\u003e`\n\nParameters:\n\n- `username` (required)\n\nBehavior and differences vs `worker.js`:\n\n- No CORS check\n- Requires `const token = \"\u003cYOUR_GITHUB_TOKEN\u003e\"` to be set\n- Returns SVG with the same visual logic (7×N grid, intensity scaling)\n\nResponses:\n\n- 200 image/svg+xml — heatmap\n- 400 `{ error: \"Username is required\" }`\n- 500 `{ error: \"GitHub token not configured\" }` or forwarded API errors\n\n---\n\n## API reference: badge.js (demo)\n\nThis is a minimal Worker that resolves GitHub achievement badges for a user.\n\nRoute: GET `/?username=\u003cuser\u003e`\n\nParameters:\n\n- `username` (required)\n\nBehavior:\n\n- Issues `HEAD` probes to each known achievement URL\n- If 200, includes the badge slug and its official image URL in the response\n\nResponse 200 application/json:\n\n```\n{\n    \"pull-shark\": \"https://...png\",\n    \"starstruck\": \"https://...png\",\n    ...\n}\n```\n\nErrors:\n\n- 500 `{ error: \"No username provided\" }` or network errors\n\n---\n\n## Caching, rate limits, and security\n\n- Cloudflare cache: `/contributions` responses cached for 1 hour (`Cache-Control: public, max-age=3600`) keyed by URL\n- Browser cache: the UI stores `/api` responses in `localStorage` for 1 hour per username key\n- Token rotation: each server call picks a random token from `githubTokens`\n- CORS: `/api` and `/contributions` enforce `FRONTEND_ORIGIN` via Origin/Referer check\n\n---\n\n## Examples and embeds\n\nPowerShell (Windows) examples:\n\n```\n# Rate limit\nirm \"https://\u003cyour-worker\u003e.workers.dev/rate_limit\" | ConvertTo-Json\n\n# Contributions SVG (save to file)\nirm \"https://\u003cyour-worker\u003e.workers.dev/contributions?username=octocat\" -OutFile contrib.svg\n\n# Unified analysis JSON\nirm \"https://\u003cyour-worker\u003e.workers.dev/api?username=octocat\" | ConvertTo-Json\n```\n\nHTML embed for heatmap:\n\n```html\n\u003cimg src=\"https://\u003cyour-worker\u003e.workers.dev/contributions?username=octocat\" alt=\"octocat contributions heatmap\" /\u003e\n```\n\n---\n\n## Deploy with Cloudflare Workers\n\n1) Add your tokens in `worker.js`:\n\n- `githubTokens`: at least one GitHub token\n- `cerebrasKeys`: one Cerebras key (or adjust code to skip AI)\n- `FRONTEND_ORIGIN`: your site origin that’s permitted to call the protected endpoints\n\n2) Deploy\n\n- Via dashboard: create a Worker, paste `worker.js`, deploy\n- Via Wrangler: create a project and set `main` to `worker.js`, then `wrangler deploy`\n\n3) (Optional) Bind D1 and deploy `count.js` separately if you want counters\n\n---\n\n## Troubleshooting\n\n- 403 Cross-origin requests are not allowed\n    - Ensure your request Origin/Referer starts with `FRONTEND_ORIGIN`\n\n- 403 You have not starred the repository\n    - Star `https://github.com/0xarchit/github-profile-analyzer`\n    - Or edit the repository name string inside `worker.js`\n\n- 429 GitHub API rate limit exceeded\n    - Add more tokens to `githubTokens` or wait for reset\n\n- Blank/low data\n    - Private repos and private contributions aren’t visible; only public data is analyzed\n    - Authored-forks detection checks only the last 100 commits per repo\n\n---\n\n## License\n\nSee [LICENSE](LICENSE).\n\n[Back to top](#github-profile-analyzer)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xarchit%2Fgithub-profile-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xarchit%2Fgithub-profile-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xarchit%2Fgithub-profile-analyzer/lists"}