Skip to content

KIaudius/github_repo_analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Repo Analyzer (FastAPI + React)

A web application that analyzes public GitHub repositories and presents insights using the GitHub API.

Features

  • Input field for GitHub repository URL
  • Fetches and displays repository metadata (name, stars, forks, etc.)
  • Shows contributor and commit activity data
  • Visualizes commit frequency and other metrics
  • Handles rate-limiting and API errors gracefully

Tech Stack

Backend

  • FastAPI - High-performance Python web framework
  • PyGithub - Python library for GitHub API
  • Pydantic - Data validation and settings management
  • Uvicorn - ASGI server

Frontend

  • React - JavaScript library for building user interfaces
  • Chart.js - JavaScript charting library
  • Bootstrap - CSS framework
  • Axios - Promise-based HTTP client

Setup and Installation

Prerequisites

  • Docker and Docker Compose
  • GitHub Personal Access Token (optional, for higher API rate limits)

Running with Docker

  1. Clone this repository
  2. (Optional) Create a .env file in the root directory with your GitHub token:
    GITHUB_TOKEN=your_github_personal_access_token
    
  3. Build and start the containers:
    docker-compose up -d
    
  4. Access the application at http://localhost:3000

Running Locally (Development)

Backend

  1. Navigate to the backend directory:
    cd backend
    
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. (Optional) Set GitHub token as environment variable:
    # Windows
    set GITHUB_TOKEN=your_github_personal_access_token
    
    # Linux/Mac
    export GITHUB_TOKEN=your_github_personal_access_token
    
  4. Start the FastAPI server:
    uvicorn main:app --reload
    
  5. The API will be available at http://localhost:8000
    • API documentation: http://localhost:8000/docs

Frontend

  1. Navigate to the frontend directory:
    cd frontend
    
  2. Install dependencies:
    npm install
    
  3. Start the development server:
    npm start
    
  4. The frontend will be available at http://localhost:3000

API Endpoints

  • GET / - Root endpoint to check if API is running
  • POST /api/repo - Get basic information about a GitHub repository
  • POST /api/contributors - Get contributors for a GitHub repository
  • POST /api/commit-activity - Get commit activity for a GitHub repository
  • GET /api/rate-limit - Get current GitHub API rate limit status

GitHub API Rate Limits

This application uses the GitHub REST API which has rate limits:

  • For unauthenticated requests: 60 requests per hour
  • For authenticated requests: 5,000 requests per hour

To increase the rate limit, provide a GitHub personal access token in the .env file.

Project Structure

github-repo-analyzer-fastapi/
├── backend/                 # FastAPI backend
│   ├── main.py              # Main application file
│   ├── requirements.txt     # Python dependencies
│   └── Dockerfile           # Backend Docker configuration
├── frontend/                # React frontend
│   ├── public/              # Static files
│   ├── src/                 # React source code
│   │   ├── components/      # React components
│   │   ├── services/        # API services
│   │   ├── App.js           # Main App component
│   │   └── index.js         # Entry point
│   ├── package.json         # NPM dependencies
│   ├── Dockerfile           # Frontend Docker configuration
│   └── nginx.conf           # Nginx configuration for production
├── docker-compose.yml       # Docker Compose configuration
└── README.md                # Project documentation

About

This project is built for Codium Assignment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published