Skip to content

rbalogic/gh-projects-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Description

gh-projects-react is a React application that demonstrates simple GitHub API integration, enabling developers to interact with GitHub data directly from a web interface. Built primarily with JavaScript (94.3%) and HTML (5.7%), this project showcases how to authenticate with the GitHub API, fetch project and repository information, and display it in a clean, interactive React-based UI. Ideal for learning GitHub API fundamentals and React state management.


Github Projects (React)

A React application demonstrating GitHub API integration for browsing and managing GitHub projects.

Overview

gh-projects-react is a lightweight web application built with React that showcases how to interact with the GitHub API. Users can authenticate with their GitHub account, explore repositories, view project data, and manage GitHub resources through an intuitive React interface. This project is perfect for developers learning about API integration and modern React development practices.

Features

  • GitHub Authentication - Secure login with GitHub account
  • Repository Browsing - View and search your GitHub repositories
  • Project Exploration - Access GitHub project information and details
  • API Integration - Seamless GitHub API data fetching and management
  • Responsive UI - Clean, modern interface built with React
  • Real-time Updates - Dynamic data fetching and display

Technology Stack

  • Frontend: React, JavaScript (94.3%)
  • Markup: HTML (5.7%)
  • API: GitHub REST API v3
  • Build Tool: Create React App (or similar)
  • State Management: React Hooks/Context API

Project Structure

gh-projects-react/
├── public/
│   ├── index.html       # Main HTML entry point
│   └── assets/          # Static assets
├── src/
│   ├── components/      # React components
│   │   ├── Auth/        # Authentication components
│   │   ├── Projects/    # Project display components
│   │   ├── Repos/       # Repository components
│   │   └── Layout/      # Layout components
│   ├── services/        # GitHub API service
│   ├── hooks/           # Custom React hooks
│   ├── App.js           # Main App component
│   ├── index.js         # React DOM render
│   └── styles/          # CSS styling
├── .env.example         # Environment variables template
├── package.json         # Dependencies
└── README.md            # This file

Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • GitHub account
  • GitHub Personal Access Token (for API access)

Installation

  1. Clone the repository:
git clone https://github.com/rbalogic/gh-projects-react.git
cd gh-projects-react
  1. Install dependencies:
npm install
  1. Create a GitHub Personal Access Token:

  2. Create a .env file in the project root:

REACT_APP_GITHUB_TOKEN=your_personal_access_token_here
REACT_APP_GITHUB_USERNAME=your_github_username
  1. Start the development server:
npm start
  1. Open your browser and navigate to http://localhost:3000

Usage

Viewing Repositories

  1. Log in with your GitHub account (or provide your token)
  2. Browse your repositories on the main page
  3. Click on a repository to view details

Exploring Projects

  1. Navigate to the Projects section
  2. View project information and associated repositories
  3. Interact with project data in real-time

Searching

  • Use the search bar to filter repositories by name or keyword
  • Results update dynamically as you type

GitHub API Integration

This project uses the GitHub REST API to fetch:

  • User Information - Account details and profile data
  • Repositories - List of user's repositories with metadata
  • Projects - GitHub project data and organization
  • Issues & Pull Requests - Repository activity information

Example API Calls

// Fetch user repositories
GET /user/repos

// Fetch project information
GET /repos/{owner}/{repo}/projects

// Search repositories
GET /search/repositories?q=language:javascript

Configuration

Environment Variables

Create a .env file with the following variables:

REACT_APP_GITHUB_TOKEN=your_token_here
REACT_APP_GITHUB_API_URL=https://api.github.com

Development

Available Scripts

# Start development server
npm start

# Build for production
npm run build

# Run tests
npm test

# Eject configuration (one-way operation)
npm run eject

Code Structure

  • Components: Reusable React components for different sections
  • Services: Centralized GitHub API service for data fetching
  • Hooks: Custom React hooks for shared logic
  • Styles: CSS files for component styling

Authentication

The application supports GitHub authentication via:

  1. Personal Access Token - Store in .env file (development)
  2. OAuth Flow - For production deployment (recommended)

Security Note: Never commit .env files or expose tokens in version control.

API Rate Limits

Be aware of GitHub API rate limits:

  • Authenticated Requests: 5,000 requests per hour
  • Unauthenticated Requests: 60 requests per hour

The application handles rate limiting gracefully with appropriate error messages.

Deployment

Deploy to Vercel

vercel

Deploy to GitHub Pages

npm run build
npm run deploy

Environment Setup for Production

Ensure the following for production deployment:

  1. Use OAuth for secure authentication
  2. Never expose personal access tokens
  3. Set appropriate API rate limit handling
  4. Configure CORS if needed

Learning Objectives

This project demonstrates:

  • React component architecture and hooks
  • GitHub API authentication and data fetching
  • State management with React
  • Error handling and loading states
  • Environment variable configuration
  • API integration best practices

Troubleshooting

"Token is invalid" Error

  • Verify your Personal Access Token is correct
  • Check that the token hasn't expired
  • Ensure required scopes are selected

API Rate Limit Exceeded

  • Wait for the rate limit to reset (hourly)
  • Use a Personal Access Token for higher limits
  • Optimize API calls to reduce requests

CORS Issues

  • Use a proxy service if making requests from browser
  • Configure proper headers in API calls

Contributing

This is a personal learning project. Feel free to fork and experiment!

Resources

License

This project is open source and available under the MIT License.

Author

rbalogic


Note: This is a learning project demonstrating GitHub API integration with React. For production use, implement proper OAuth authentication and follow GitHub's API best practices.

About

A React-based GitHub API explorer with a clean, interactive interface for browsing repositories and projects.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors