- A wrapper over GitHub API to automate some specific set of tasks.
- Deployed on Render
NodeJS 18 Required for Fetch API
- Clone the repository.
- Run
npm installto install all the dependencies. - Provision an in-memory database. (Redis)
- Fill environment variables in
.envfile.(See.env.examplefor reference) - Run
npm run buildto build the project. - Run
npm run startto start the project. - Optionally, run
npm run devto start the project in development mode. Nodemon is used to watch for changes in the source TS code and restart the server.
GET /user/loginredirects to GitHub OAuth login page.GET /user/signin/callbackredirects back to the application after successful login with acodequery parameter. This code is used to fetch the access token from GitHub asynchronously and the client is issued an auth cookie that references the access token from the in-memory store.GET /user/logoutclears the auth cookie and clears the access token from the in-memory store. User data is not persisted in the database. This behaviour can be changed by adding aUsermodel and persisting the user data in a long-term database like MongoDB.
GET /repostakesbody.usernameand returns all the accessible repositories of the specified user if they exist. If the user is not specified, it returns all the accessible repositories of the logged in user.GET /repos/:usernameis a URL param version of the above API.PUT /repos/:repoNametakesbody.repoName, and optionallybody.descriptionandbody.visibility, and creates a new repository with the specified name, description and visibility. If the repository already exists, it returns an error.
GET /repotakesbody.repoNameand returns the details of the specified repository if it exists. If the repository does not exist, it returns an error.ALL /repo/topicstakesbody.repoNameand returns the topics of the specified repository if it exists. If the repository does not exist, it returns an error. Depending on the HTTP method, it can also be used to add or remove topics from the repository.
GET /user/secretFanstakesbody.usernameand returns the list of users who have starred more than 2 of the specified user's repositories. If the user is not specified, it returns the list of users who have starred the logged in user's repositories.GET /user/specificSecretFanstakesbody.usernameand returns the list of users who have starred exactly 2 of the specified user's repositories. If the user is not specified, it returns the list of users who have starred exactly 2 of the logged in user's repositories.GET /user/popularRepostakesbody.usernameand returns the list of repositories of the specified user with >5stars and >5forks. If the user is not specified, it returns the list of repositories of the logged in user with >5stars and >5forks.GET /user/activeRepostakesbody.usernameand returns the list of repositories with > 5 commits by owner in last 10 days. If the user is not specified, it returns the list of repositories with > 5 commits by owner in last 10 days.
PORT- Port on which the server will run.SESSION_SECRET- Cookie Session Secret.GITHUB_CLIENT_ID- Client ID of the GitHub OAuth App.GITHUB_CLIENT_SECRET- Client Secret of the GitHub OAuth App.REDIS_URL- URL of the Redis instance.
https://api.github.com/users/:username- Returns the user details.https://api.github.com/users/:username/repos- Returns the repositories of the specified user.https://api.github.com/user/repos- Returns the repositories of the logged in user.https://api.github.com/repos/:username/:repoName- Returns the details of the specified repository.https://api.github.com/repos/:username/:repoName/topics- Returns the topics of the specified repository.https://api.github.com/repos/:username/:repoName/stargazers- Returns the stargazers of the specified repository.https://api.github.com/repos/:username/:repoName/commits- Returns the commits of the specified repository.https://api.github.com/repos/:username/:repoName- Creates a new repository with the specified name, description and visibility.
-
No Automated Tests have been written.
-
Manual testing has been done using Thunder Client/ Postman.
-
Testing files are included in the static folder.
- No Automated Tests have been written.
- Error boundary could have been implemented on application space instead of router scope.
- Response intercepting middleware could have been perfected to recognize and drop any fields whose values contain
https://api.github.com
- Add a
Usermodel and persist the user data in a long-term database like MongoDB. - Add automated tests.
- Cache the GitHub API responses in Redis to reduce the number of API calls.
- Rewrite code for a serverless architecture by shifting the in-memory database to a cloud-based database like Redis Labs or client side JWEs.
- Rewrite code with Octokit and GraphQL, but personally not a fan of batteries-included libraries.

