Analyze GitHub repositories with beautiful visualizations. View language breakdowns, commit history, code frequency, contributors, and generate embeddable stats widgets for your README.
- Repository Statistics: Total lines of code, additions, deletions, stars, forks, and more
- Language Breakdown: Visual breakdown of all programming languages used with percentages
- Commit History: Detailed commit log with author info, changes, and timestamps
- Code Frequency Chart: Interactive visualization of code changes over time
- Contributors List: Top contributors with their contribution stats
- Embeddable Widgets: Generate SVG images for your README to showcase repo stats
- User Dashboard: Authenticated users get a personal dashboard with their repositories and quick-analyze
- Dynamic Repo Pages: Dedicated
/repo/[owner]/[name]pages for deep-linking to any analysis - GitHub OAuth: Sign in to access private repositories and higher API limits
- GraphQL Optimization: Commits fetched via a single GraphQL call instead of 51+ REST calls
- Zod Validation: All API inputs validated with Zod schemas for safety and clear error messages
- SEO Optimized: Static OG images, robots.txt, sitemap.xml, JSON-LD structured data, and per-page metadata
- Privacy First: No credentials stored - all auth happens directly with GitHub
RepoLens generates beautiful SVG widgets you can embed directly in your GitHub README. Available widgets:
Shows total lines, lines added, lines removed, and commit count.
Shows stars, forks, watchers, and open issues.
Displays the top programming languages used in the repository.
All widgets support a theme parameter:
?theme=dark(default) - Dark background?theme=light- Light background
Widgets are cached for 1 hour on CDN to ensure fast loading and reduce API usage.
Your data is never stored. This application:
- Uses GitHub OAuth for secure authentication
- Never saves login credentials or access tokens to any database
- Tokens exist only in your browser session
- All API calls go directly to GitHub
- Sign out anytime to revoke access
- Node.js 18.17 or later
- A GitHub account
- A GitHub OAuth App (instructions below)
- Go to GitHub Developer Settings
- Click "OAuth Apps" then "New OAuth App"
- Fill in the details:
- Application name: RepoLens (or your preferred name)
- Homepage URL:
http://localhost:3000(for development) - Authorization callback URL:
http://localhost:3000/api/auth/callback/github
- Click "Register application"
- Copy the Client ID
- Click "Generate a new client secret" and copy the Client Secret
git clone https://github.com/Technical-1/RepoLens.git
cd repolens
npm installCreate a .env.local file in the root directory:
AUTH_GITHUB_ID=your_github_client_id
AUTH_GITHUB_SECRET=your_github_client_secret
AUTH_SECRET=your_random_secret_hereGenerate AUTH_SECRET with:
openssl rand -base64 32npm run devOpen http://localhost:3000 in your browser.
You can deploy RepoLens to any hosting service that supports Next.js, including Vercel, Netlify, Railway, Render, or your own server.
Example: Deploying to Vercel
- Push your code to GitHub
- Import the project in Vercel Dashboard
- Add environment variables:
AUTH_GITHUB_IDAUTH_GITHUB_SECRETAUTH_SECRET
- Update your GitHub OAuth App callback URL to:
https://your-domain.com/api/auth/callback/github
| Category | Technology |
|---|---|
| Framework | Next.js 15.3 with App Router |
| UI Library | React 19 |
| Authentication | Auth.js v5 (NextAuth) |
| GitHub API | @octokit/rest + GitHub GraphQL |
| Validation | Zod 4 |
| Styling | Tailwind CSS 3.4 |
| Charts | Recharts |
| Icons | Lucide React |
| Language | TypeScript 5.7 |
| Image Generation | next/og (Satori) for embeds; static PNGs for OG/favicons |
| Authentication | Rate Limit | Caching |
|---|---|---|
| Unauthenticated | 60 requests/hour | 10-minute server cache |
| Authenticated (OAuth) | 5,000 requests/hour | No server cache |
| Embed Widgets | Uses unauthenticated | 1-hour CDN cache |
Sign in with GitHub to get higher rate limits for analyzing large repositories.
Caching Strategy:
- Unauthenticated requests are cached server-side for 10 minutes to reduce API pressure
- Embed widgets are cached at the CDN edge for 1 hour
- User repository lists are cached client-side for 5 minutes
- Code frequency polling uses exponential backoff (3s, 6s, 12s, 24s, 48s) to avoid rate limits
repolens/
├── src/
│ ├── app/
│ │ ├── (public)/
│ │ │ └── page.tsx # Public repo search page
│ │ ├── dashboard/
│ │ │ ├── layout.tsx # Auth-protected layout
│ │ │ └── page.tsx # User dashboard with repos
│ │ ├── repo/[owner]/[name]/
│ │ │ ├── page.tsx # Server component with generateMetadata + JSON-LD
│ │ │ └── RepoPageClient.tsx # Client component for repo stats UI
│ │ ├── api/
│ │ │ ├── auth/[...nextauth]/route.ts # Auth handlers
│ │ │ ├── embed/
│ │ │ │ ├── stats/route.tsx # Stats widget image
│ │ │ │ ├── languages/route.tsx # Languages widget image
│ │ │ │ └── code-stats/route.tsx # Code stats widget image
│ │ │ ├── repo/
│ │ │ │ ├── route.ts # Main repo analysis
│ │ │ │ └── stats/route.ts # Stats polling endpoint
│ │ │ └── user/repos/route.ts # User repos endpoint
│ │ ├── robots.ts # robots.txt generation
│ │ ├── sitemap.ts # sitemap.xml generation
│ │ ├── globals.css
│ │ └── layout.tsx # Root layout with SessionProvider + JSON-LD
│ ├── components/
│ │ ├── index.ts # Barrel exports
│ │ ├── layout/
│ │ │ ├── Header.tsx
│ │ │ └── Footer.tsx
│ │ ├── ui/
│ │ │ ├── Card.tsx # Reusable card component system
│ │ │ ├── LoadingSkeleton.tsx # Loading states and skeletons
│ │ │ ├── RepoInput.tsx
│ │ │ └── PrivacyNotice.tsx
│ │ ├── features/
│ │ │ ├── stats/
│ │ │ │ ├── StatsOverview.tsx
│ │ │ │ ├── LanguageBreakdown.tsx
│ │ │ │ └── CodeFrequencyChart.tsx
│ │ │ ├── commits/
│ │ │ │ └── CommitHistory.tsx
│ │ │ ├── contributors/
│ │ │ │ └── ContributorsList.tsx
│ │ │ └── repos/
│ │ │ └── UserReposList.tsx
│ │ ├── embed/
│ │ │ └── EmbedShare.tsx
│ │ └── effects/
│ │ └── ParticleBackground.tsx
│ ├── lib/
│ │ ├── github.ts # GitHub API (REST + GraphQL)
│ │ ├── cache.ts # TTL-based in-memory cache
│ │ ├── embed-utils.tsx # Embed widget generation helpers
│ │ ├── structured-data.ts # JSON-LD schema generators
│ │ ├── format.ts # Number/date formatting
│ │ └── validations.ts # Zod schemas for API inputs
│ ├── types/
│ │ ├── index.ts # Shared TypeScript types
│ │ └── next-auth.d.ts # NextAuth type extensions
│ └── auth.ts # NextAuth configuration
├── tailwind.config.ts
├── next.config.ts
├── package.json
└── vercel.json
- Large repos: GitHub's statistics API can struggle with repos over 10,000 commits (GraphQL fallback handles most cases)
- Rate limiting: Heavy use may hit GitHub API limits (sign in for higher limits)
- Stats computation: Some statistics may take time to compute for new/updated repos
- Embed widgets: Only works for public repositories
Contributions are welcome! Please feel free to submit a Pull Request.
This project is available for personal use only. Commercial use is not permitted without explicit permission.
Built with Next.js 15 and the GitHub API