Provides repositories and their branches by username
Java 21 & Maven should be accessible on $PATH
mvn install
cd github-repository-service
mvn spring-boot:run
Request example
curl -i -X GET http://localhost:8080/repositories?username=morphlne
Response example
{
"repositories":[
{
"repositoryOwnerLogin":"morphlne",
"repositoryName":"graph-api-authentication",
"branches":[
{
"branchName":"master",
"lastCommitSha":"761a3bf3c68168dfebdf0db5cab5d8c295c91a23"
}
]
}
]
}Swagger UI is accessible on http://localhost:8080/swagger-ui.html and OpenAPI spec on http://localhost:8080/api.yaml
Project consists of 2 submodules:
- github-repository-api
The API module is completely generated from OpenAPI specification using openapi-generator-maven-plugin
Run mvn verify to generate
- github-repository-service
The Service module is based on Spring WebFlux - Project Reactor adoption for Spring ecosystem
Important components of the Service module:
- WebClientConfiguration - general behavior for all requests - headers, logging etc
- GithubClient - behavior for specific request - URI path, parameters etc
- RepositoryService - sequence of calls & applied business-rules (like skip forks)
Github REST API is used as a source of information about repositories and branches
If you reached rate limit for unauthenticated user, you can provide token to get a higher rate limit
github.header.auth: YOUR_TOKEN_HERE
The simplest way to get token
- Go to https://github.com/settings/tokens
- Click
Generate new token
More about authentication on docs.github.com
- Add pagination support. For now, only the first 100 repositories and the first 100 branches in each repository will be returned
- Retry on error & circuit breaker
- Implement cache
- Username validation (pattern)
- Unit & integration tests