Skip to content

Latest commit

Β 

History

History
119 lines (86 loc) Β· 2.75 KB

File metadata and controls

119 lines (86 loc) Β· 2.75 KB

HotGits is a sleek, full-stack web app that surfaces GitHub's most-starred repositories across multiple time ranges. It features a dark glassmorphism UI with modern animations, backed by an Express + MongoDB API with automatic caching.

πŸ› οΈ Tech Stack

  • Frontend β€” Vanilla HTML / CSS / JavaScript (no framework needed)
  • Backend β€” Node.js Β· Express Β· Mongoose
  • Database β€” MongoDB (with 30-day TTL cache)
  • API β€” GitHub Search API

πŸš€ Getting Started

Prerequisites

  • Node.js v18+
  • MongoDB running locally or a cloud URI (e.g. MongoDB Atlas)

Installation

# 1. Clone the repository
git clone https://github.com/<your-username>/hotgits.git
cd hotgits

# 2. Install dependencies
npm install

# 3. Create a .env file in the project root
#    Add your MongoDB connection string:
echo "MONGO_URI=mongodb://localhost:27017/hotgits" > .env

Running

# Development (with auto-reload)
npm run dev

# Production
npm start

Then open http://localhost:5000 in your browser.


πŸ“ Project Structure

hotgits/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── db.js              # MongoDB connection
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   └── trendingController.js  # GitHub fetch & cache logic
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── Trending.js        # Mongoose schema (TTL index)
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   └── trending.js        # /api/trending route
β”‚   └── index.js               # Express server entry point
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ index.html             # Main page
β”‚   β”œβ”€β”€ style.css              # Glassmorphism theme & animations
β”‚   └── app.js                 # Client-side fetch & render
β”œβ”€β”€ .env                       # Environment variables
β”œβ”€β”€ package.json
└── README.md

πŸ”Œ API Reference

GET /api/trending

Fetch trending GitHub repositories.

Parameter Type Default Description
duration string week Time range: day, week, month, year

Example:

curl http://localhost:5000/api/trending?duration=month

Response:

{
  "duration": "month",
  "repos": [
    {
      "id": 123456,
      "name": "owner/repo-name",
      "owner": "owner",
      "description": "A cool project",
      "url": "https://github.com/owner/repo-name",
      "stars": 12500,
      "forks": 890,
      "language": "TypeScript",
      "avatar": "https://avatars.githubusercontent.com/u/..."
    }
  ]
}


Inspired by https://roadmap.sh/projects/github-trending-cli