Skip to content

Commit 3655975

Browse files
Merge branch 'main' into fix/dashboard-widget-error-boundaries
2 parents bb254e3 + 40ea375 commit 3655975

234 files changed

Lines changed: 14099 additions & 3665 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -------------------------------------------------------
22
# Supabase
33
# Project Settings → API → Project URL
4-
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
4+
NEXT_PUBLIC_SUPABASE_URL=https://<project-ref>.supabase.co
55

66
# Project Settings → API → anon / public key
77
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
@@ -17,6 +17,11 @@ SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
1717
# Wrong value causes OAuth callback URL mismatch → error=github on sign-in.
1818
NEXTAUTH_URL=http://localhost:3000
1919

20+
# Public app URL (optional — only needed if your deployment platform sets
21+
# NEXTAUTH_URL to something other than the canonical public origin).
22+
# Must not have a trailing slash.
23+
# NEXT_PUBLIC_APP_URL=https://devtrack-delta.vercel.app
24+
2025
# Generate with: openssl rand -base64 32
2126
NEXTAUTH_SECRET=your_nextauth_secret
2227

@@ -61,7 +66,7 @@ UPSTASH_REDIS_REST_TOKEN=your_upstash_redis_rest_token
6166
# Groq API Key (optional — enables AI-generated weekly summaries in the
6267
# AI Mentor widget using Llama-3).
6368
# console.groq.com → API Keys
64-
GROQ_API_KEY=gsk_...
69+
GROQ_API_KEY=your_groq_api_key
6570

6671
# -------------------------------------------------------
6772
# Leaderboard Configuration
@@ -70,4 +75,3 @@ GROQ_API_KEY=gsk_...
7075
# Higher values = faster builds but more resource usage
7176
# WARNING: Do not exceed 100 without load testing — risks memory exhaustion
7277
LEADERBOARD_USER_CONCURRENCY=5
73-

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"extends": ["next/core-web-vitals"]
3-
}
3+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ out/
1212
# Environment files — NEVER commit these
1313
.env
1414
.env.local
15+
.env.local*
1516
.env.production
1617
.env.*.local
1718

ARCHITECTURE.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Architecture
2+
3+
## 1. High-Level Architecture
4+
5+
Browser -> Next.js App (Vercel)
6+
|-- /app/page.tsx Landing page
7+
|-- /app/dashboard/page.tsx Dashboard (auth-guarded)
8+
+-- /app/api/
9+
|-- auth/[...nextauth]/ GitHub OAuth
10+
|-- metrics/contributions/ Commit activity
11+
|-- metrics/prs/ PR analytics
12+
|-- metrics/streak/ Commit streak
13+
|-- metrics/repos/ Top repositories
14+
+-- goals/ Supabase weekly goals
15+
16+
## 2. Folder Structure
17+
18+
devtrack/
19+
|-- src/
20+
| |-- app/
21+
| | |-- api/
22+
| | | |-- auth/[...nextauth]/ # GitHub OAuth
23+
| | | |-- metrics/contributions/ # GET commit activity
24+
| | | |-- metrics/prs/ # GET PR analytics
25+
| | | |-- metrics/streak/ # GET commit streak
26+
| | | |-- metrics/repos/ # GET top repositories
27+
| | | +-- goals/ # GET + POST weekly goals
28+
| | |-- dashboard/page.tsx # Main dashboard
29+
| | +-- page.tsx # Landing page
30+
| |-- components/
31+
| | |-- ContributionGraph.tsx
32+
| | |-- PRMetrics.tsx
33+
| | |-- GoalTracker.tsx
34+
| | |-- StreakTracker.tsx
35+
| | |-- TopRepos.tsx
36+
| | +-- DashboardHeader.tsx
37+
| +-- lib/
38+
| |-- auth.ts # NextAuth config
39+
| +-- supabase.ts # Supabase admin client
40+
|-- supabase/schema.sql
41+
+-- .github/workflows/ci.yml
42+
43+
## 3. Data Flow
44+
45+
User visits /dashboard
46+
-> NextAuth checks session
47+
-> no session: redirect to /
48+
-> session ok: render dashboard
49+
50+
Each component fetches its own API route:
51+
ContributionGraph -> GET /api/metrics/contributions -> GitHub GraphQL -> Recharts
52+
StreakTracker -> GET /api/metrics/streak
53+
PRMetrics -> GET /api/metrics/prs
54+
TopRepos -> GET /api/metrics/repos
55+
GoalTracker -> GET/POST /api/goals (Supabase)
56+
57+
## 4. State Management
58+
59+
No global state library is used.
60+
- Each widget manages its own data via useEffect + fetch
61+
- Loading/error states are local useState per component
62+
- Auth state comes from NextAuth.js SessionProvider (React context)
63+
- Goal state is re-fetched after every POST
64+
65+
## 5. Key Components
66+
67+
| Component | Responsibility |
68+
|---|---|
69+
| ContributionGraph.tsx | Commit activity bar chart, time range selector |
70+
| StreakTracker.tsx | Current streak, longest streak, active days |
71+
| PRMetrics.tsx | Avg review time, merge rate, open/closed PR counts |
72+
| TopRepos.tsx | Repositories ranked by commit activity |
73+
| GoalTracker.tsx | Weekly goals via Supabase, progress bars |
74+
| DashboardHeader.tsx | User avatar, name, sign-out button |
75+
| lib/auth.ts | NextAuth config, Supabase user upsert on login |
76+
| lib/supabase.ts | Supabase admin client for server-side operations |
77+
78+
## 6. Environment Variables
79+
80+
| Variable | Purpose |
81+
|---|---|
82+
| NEXT_PUBLIC_SUPABASE_URL | Supabase project URL |
83+
| NEXT_PUBLIC_SUPABASE_ANON_KEY | Supabase anon key |
84+
| SUPABASE_SERVICE_ROLE_KEY | Server-only key, bypasses RLS |
85+
| NEXTAUTH_URL | Full app URL |
86+
| NEXTAUTH_SECRET | Random secret for NextAuth JWTs |
87+
| GITHUB_ID | GitHub OAuth App Client ID |
88+
| GITHUB_SECRET | GitHub OAuth App Client Secret |
89+
90+
See .env.example for a ready-to-fill template.

BADGE_API.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,7 @@ For issues or feature requests related to badges:
172172
![DevTrack Streak](https://devtrack.app/api/badge/streak?user=octocat)
173173
](https://devtrack.app/u/octocat)
174174
```
175+
176+
177+
### GSSoC Badge API Rate Limiting
178+
- Badge requests are restricted to 100 per minute per IP.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5252
---
5353

5454
[0.1.0]: https://github.com/Priyanshu-byte-coder/devtrack/releases/tag/v0.1.0
55+
56+
57+
### GSSoC Semantic Versioning Policy
58+
- Bumps follow minor or patch levels strictly.
59+
- Major updates require prior architecture approval.

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,8 @@ For guides on self-hosting DevTrack or deploying it manually, please check the [
213213
---
214214

215215
Thank you for helping make DevTrack better! Happy coding! 🚀
216+
217+
218+
### GSSoC Git Commit & Branching Conventions
219+
- Prefix commits with chore:, feat:, or fix:.
220+
- Keep PRs small and focused on existing files.

DEVELOPMENT.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,7 @@ You hit the 30 requests/minute search API limit. Wait 1 minute. In production th
373373
## Questions?
374374

375375
Open a [GitHub Discussion](https://github.com/Priyanshu-byte-coder/devtrack/discussions) — not an issue.
376+
377+
378+
### Husky Hooks Troubleshooting Guide
379+
- If prettier-check fails in sandboxed environments, run git commit with --no-verify.

SECURITY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,8 @@ DevTrack uses Supabase with Row Level Security on all user-data tables.
7070
- All RLS policies match against `auth.uid()`
7171
- `supabaseAdmin` (service role key) is server-side only, never exposed to clients
7272
- The anon key has no direct table access by default
73+
74+
75+
### GSSoC API Logging Redaction Standards
76+
- Never log authorization tokens or passwords.
77+
- Redact sensitive data before production logs persist.

docs/architecture.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,7 @@ Can provide coding activity metrics.
111111
2. API fetches GitHub activity
112112
3. Metrics are processed and stored in Supabase
113113
4. Dashboard components fetch and render analytics
114+
115+
116+
### Database Connection Pooling Guide
117+
- Configure pg pool size limits in development to prevent memory spikes.

0 commit comments

Comments
 (0)