Skip to content

Panic7/githubrepos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

Description

A Spring Boot 3.5 application that provides a REST API for retrieving non-forked GitHub repositories for a given username, including branch names and their last commit SHA.

This project uses modern Spring Boot features like RestClient, Java 21 virtual threads, and a clean minimal layered architecture.

Technologies

Java: 21

Spring Boot: 3.5.4

Tomcat: 10.1.43

Spring Framework: 6.2.9

GitHub API: v3

Usage

Endpoint

GET /api/repositories/{username}

Returns all non-forked repositories for the specified GitHub user, including their branches and last commit SHA. Response example:

[
  {
    "repositoryName": "Spoon-Knife",
    "ownerLogin": "octocat",
    "branches": [
      {
        "name": "main",
        "lastCommitSha": "d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9"
      }
    ]
  }
]

Application Configuration

These are the relevant properties used in the application.yml file:

spring:
  threads:
    virtual:
      enabled: true
  • While GitHub rate limiting currently limits concurrency, virtual threads are added proactively — to be ready for future scale when concurrency increases and limits are lifted.
github:
  api:
    token: ${github-token:#{null}}
  • The GitHub API token can be set as an environment variable github-token or left empty for unauthenticated requests (which have lower rate limits (60 compared to 5000 per hour)).

To do

  • Rate Limiting: GitHub enforces both primary and secondary rate limits. The current implementation does not yet include rate-limit handling. For details, refer to the GitHub rate limit documentation.

  • Async Error Edge Case: When fetching branches asynchronously, there is a potential race condition: if a repository is deleted after listing but before fetching its branches, the request may fail with a 404 error. Alternatively, we could handle this case gracefully and return data for the remaining repositories.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages