Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Œ GitHub Repository & Commit Explorer

A simple full-stack application that fetches GitHub repositories, displays commit counts, and supports filtering by language and stars. This project uses: Backend: Node.js, Express, Axios Frontend: HTML, CSS, Vanilla JavaScript

πŸš€ Features βœ” Fetch all repositories of a user-> Uses /users/:username/repos βœ” Fetch commit count of a specific repository-> Uses /repos/:username/:repo/commits βœ” Filters implemented

  1. Language filter β†’ Show repos of a selected programming language
  2. Star sorting β†’ Sort repos based on star count (High β†’ Low)

βœ” Robust Error Handling Network failures, Timeout handling, Invalid JSON responses, Malformed fields, GitHub API rate-limit or token errors

πŸ› οΈ Setup Instructions 1️⃣ Create a remote repository(Global Trend) Creating local folder(GLOBAL Trend) -> frontend and backend folder inside it.

2️⃣ Backend Setup (Node.js) Install dependencies(express, cors, axios, dotenv) cd backend npm install

Create .env file GITHUB_TOKEN=your_github_token GITHUB_USERNAME=your_github_username PORT=5000

Start the backend:- nodemon index.js Backend runs on: http://localhost:5000/

3️⃣ Frontend Setup Simply open: frontend/index.html

πŸ”— API Endpoints Used

  1. Get all repositories

GET /api/repos

Optional Query Params Param Type Description

language string Filter by programming language sort string stars to sort by stars search string Search repos by name

Example /api/repos?language=JavaScript&sort=stars

  1. Get details of a single repo GET /api/repos/:repoName Returns: id, name, description, stars, forks, createdAt, language

  2. Get commit count GET /api/commits/:repoName Returns:

{ "repo": "AnimatedWebsites", "totalCommits": 42 }

🧠 How Filtering Works Language Filter

Extracts all unique languages from repo list

Filters only repos matching selected language

Star Filter sort=stars
β†’ Sorts repos by stargazers_count (descending)

βš™οΈ Assumptions & Notes βœ” GitHub Token Required GitHub API limits unauthenticated requests β€” So a Personal Access Token is mandatory.

βœ” Rate-Limits & Token Errors If token expires or GitHub blocks due to rate-limit, UI displays: ❌ Error: API Rate Limit / Invalid Token

βœ” Commit Count Logic GitHub API returns commits in pages; for simplicity: /commits endpoint is used with default pagination.

βœ” Network Safety Frontend includes: Timeout system (7 seconds) JSON parsing validation Graceful error messages

βœ” Malformed API Fields If any field like language or stars is missing β†’ handled safely.

About

Here is intership assignment solution i made.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages