A lightweight Express.js + MongoDB service that tracks and displays the number of visitors to your GitHub profile via an embeddable SVG badge. When someone loads your GitHub profile README containing the badge, the service logs the view and updates the counter in real-time.
- 📊 View Counting — Tracks total profile views per GitHub username.
- 🌍 Geo Detection — Identifies visitor country using
geoip-lite. - 🕵️ Smart Filtering — Detects and logs only requests coming from GitHub’s CDN or profile pages.
- 🖼️ SVG Badge — Returns a live, cache-free image showing the view count.
- 💾 MongoDB Storage — Saves all visits for analytics and stats.
- ⚙️ Environment Config — Securely loads settings (DB URI) from
.env.
- Each time someone loads your profile README, GitHub fetches your badge from the
/api/trackendpoint. - The server checks if the request came from GitHub (via headers and user-agent).
- If valid, it logs the visitor’s IP (and country if possible) to MongoDB.
- The endpoint then returns an SVG image showing your total views.
Add one of these to your GitHub profile README.md:


Follow these steps to run the GitHub Profile View Tracker locally or on a hosting platform like Vercel, Render, or Railway.
git clone https://github.com/emiedonmokumo/gitview.git
cd gitviewnpm installor
yarn install- Create a free MongoDB cluster at MongoDB Atlas.
- Get your connection string (URI) and replace
<password>with your database user password. - Create a database named
gitviewand a collection namedviews.
- Create a
.envfile in the root directory. - Add your MongoDB URI:
MONGODB_URI=your_mongodb_connection_string
npm startor
yarn start