A real-time Matrix-style terminal badge that displays GitHub profile visits and live Toronto weather data!
- ๐ฅ Real-time Visit Counter - True visit tracking using Vercel KV (Redis)
- ๐ค๏ธ Live Weather Data - Current Toronto temperature and conditions via OpenWeatherMap
- ๐ Matrix Terminal Aesthetic - Authentic green terminal with blinking cursor
- โก Lightning Fast - Serverless architecture with < 50ms response times
- ๐ก๏ธ Bulletproof Reliability - Smart fallbacks ensure badge always works
- ๐ฏ Zero Dependencies - Self-contained system with no external tracking
- ๐ Global CDN - Fast loading worldwide via Vercel Edge Network
GitHub Profile โ README loads badge โ Vercel Function โ KV Database + Weather API โ SVG Response
- Someone visits your GitHub profile
- README loads the SVG badge from Vercel endpoint
- Serverless function executes incrementing visit counter in Redis
- Weather API called for live Toronto conditions
- SVG generated with real-time data in Matrix terminal style
- Badge displays updated visit count and weather
- ๐ Backend: Node.js serverless functions (Vercel)
- ๐ Database: Vercel KV (Redis) - for visit counter
- ๐ก๏ธ Weather: OpenWeatherMap API - real-time data
- ๐จ Frontend: Dynamic SVG generation with CSS animations
- โ๏ธ Deployment: Vercel with global edge distribution
- ๐ Integration: Shared function architecture (badge.js + stats.js)
github-profile-counter/
โโโ api/
โ โโโ badge.js # SVG badge generator
โ โโโ stats.js # JSON stats endpoint
โ โโโ lib/
โ โโโ stats-data.js # Shared logic (KV counter + weather)
โโโ package.json # Dependencies (@vercel/kv)
โโโ README.md # Documentation
git clone https://github.com/bh1090/githubProfileCounter
cd githubProfileCounter
npm install# Install Vercel CLI (if you don't have it)
npm i -g vercel
# Deploy your project
vercel
# Deploy to production
vercel --prod- Go to your Vercel Dashboard
- Select your deployed project
- Navigate to Storage tab
- Click "Browse Marketplace"
- Choose Upstash โ Redis
- Create database and connect to your project
- Get free API key from OpenWeatherMap
- In Vercel dashboard, go to Settings โ Environment Variables
- Add:
WEATHER_API_KEY=your_api_key_here
Replace your-deployment-url with your actual Vercel deployment URL:
In api/lib/stats-data.js:
// Update these values
username: 'your-github-username',
location: 'Your-City',
// And in the weather API call
const url = `https://api.openweathermap.org/data/2.5/weather?q=Your-City,Country&appid=${WEATHER_API_KEY}&units=metric`;Edit the SVG in api/badge.js to change:
- Colors (terminal-text, terminal-border classes)
- Text content and positioning
- Badge dimensions and layout
- Animations and effects
Returns the Matrix-style terminal SVG badge
- Method: GET
- Response: SVG image
- Caching: No cache for real-time updates
Returns raw stats data for debugging/integration
- Method: GET
- Response: JSON with visits, weather, debug info
- Example:
{
"username": "bh1090",
"visits": 127,
"weather": { "temp": 22, "description": "Clear", "icon": "01d" },
"location": "Toronto",
"timestamp": "2025-07-27T14:30:00.000Z",
"debug": { "visitCounterWorking": true, "weatherWorking": true }
}- Vercel KV (Redis) - Primary counter storage
- Atomic Operations -
kv.incr()ensures accurate counts - Smart Fallback - Mathematical counter if KV unavailable
- Real-time Updates - Every badge load increments counter
- Live Data - Fetched from OpenWeatherMap on each request
- 8-second Timeout - Prevents hanging requests
- Graceful Degradation - Fallback weather if API fails
- Global Locations - Easily configurable for any city
- Shared Function Architecture - DRY principle across endpoints
- Serverless Cold Start - < 100ms typical response time
- Error Handling - Comprehensive try-catch blocks
- Efficient SVG - Minimal file size with CSS animations
- Multiple City Support - Weather for different locations based on visitor IP
- GitHub Stats Integration - Show repository count, stars, followers
- Coding Activity - Display recent commit activity and streaks
- Theme Variants - Additional color schemes (cyberpunk, retro, terminal green)
- Interactive Elements - Click events for more detailed stats
- Analytics Dashboard - Web interface to view detailed visit analytics
- Custom Animations - More terminal effects (typing, scrolling text)
- Visitor Geography - Show visitor locations on a mini map
- Social Links - Display latest Twitter/LinkedIn activity
- Technology Stack Display - Show preferred programming languages
- Real-time Chat - Matrix-style message system for visitors
- Mini Terminal Game - Interactive terminal games embedded in badge
- Code Snippet Display - Show recent commits or code snippets
- Time Zone Support - Display multiple time zones
- Visitor Comments - Allow visitors to leave terminal-style messages
- Achievement System - Unlock badges based on visit milestones
- API Rate Limiting - Intelligent caching and rate limiting
- Multi-language Support - Internationalization for global users
- Edge Caching Strategy - Smart caching for better performance
- Database Optimization - Multiple KV stores for different data types
- Monitoring & Alerts - Health checks and uptime monitoring
- A/B Testing Framework - Test different badge designs
- Configuration Dashboard - Web UI for easy customization
- Webhook Integration - Connect with GitHub, Twitter, etc.
- Dark/Light Mode - Automatic theme switching
- Mobile Optimization - Responsive design for mobile GitHub viewing
Badge not updating?
- Check Vercel deployment status
- Verify KV database connection
- Clear browser cache
Weather not showing?
- Confirm
WEATHER_API_KEYenvironment variable is set - Check OpenWeatherMap API quota
- Verify city name spelling in API call
Visit counter stuck?
- Check Vercel KV database status
- Review function logs in Vercel dashboard
- Fallback counter should still work
Visit /api/stats directly to see raw JSON data and debug information.
MIT License - feel free to fork, modify, and use for your own projects!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
If you found this project helpful, please give it a star! โญ
Made with ๐ by bh1090 | Powered by Vercel & Redis "username": "bh1090", "visits": 1247, "weather": { "temp": 18, "description": "Cloudy" }, "location": "Toronto" }
## ๐ค Contributing
Feel free to fork this project and make it your own! Some ideas:
- Add more weather details
- Implement different visual themes
- Add caching for better performance
- Support for multiple cities
- Dark/light mode toggle
## ๐ License
MIT License - feel free to use this for your own profile!
## ๐ Links
- [Live Demo](https://github-profile-counter.vercel.app/api/badge)
- [API Stats](https://github-profile-counter.vercel.app/api/stats)
- [My GitHub Profile](https://github.com/bh1090)
---
โญ If you found this useful, please star the repo!