This project now uses Upstash Redis as a free database for storing GitHub profile view counts.
- Go to https://console.upstash.com/
- Sign up for a free account
- Create a new Redis database
- In your Upstash console, find your Redis database
- Copy the
UPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKEN - These are your database connection credentials
Create a .env.local file in your project root:
UPSTASH_REDIS_REST_URL=your_redis_rest_url_here
UPSTASH_REDIS_REST_TOKEN=your_redis_rest_token_here- 10,000 requests per day (perfect for personal projects)
- 256 MB storage (more than enough for view counts)
- Global edge locations for fast response times
- GET
/api/[username]: Increments view count and returns SVG badge - Redis Key Format:
profile_views:{username} - Automatic Fallback: If Redis fails, falls back to manual increment
- Error Handling: Graceful degradation with console logging
✅ Scalable: Handles multiple concurrent requests
✅ Reliable: No file corruption or I/O issues
✅ Fast: Redis is extremely fast for simple key-value operations
✅ Free: Generous free tier for personal projects
✅ Global: Works from any deployment location
After setup, test your API:
curl "http://localhost:3000/api/yourusername"This should return an SVG badge with incremented view count.