Website for visualizing a persons github network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
6.7 KiB

5 years ago
4 years ago
  1. # Github-Graphs
  2. Website for visualizing a persons github network.
  3. ![Example Graph](./doc/graphExample.png)
  4. If you are lucky, you can find the site live [here](https://github-graphs.com/).
  5. ## Built With
  6. - [BootStrap](https://getbootstrap.com/)
  7. - [jQuery](https://jquery.com/)
  8. - [Vis JS](http://visjs.org/)
  9. - [Github v3 API](https://developer.github.com/v3/)
  10. - [Node.js](https://nodejs.org/en/)
  11. ![javascript](./doc/javaScript.jpg)
  12. ## Deployment
  13. The easiest way to get started with Github-Graphs is to fork this repository
  14. and follow the instructions below.
  15. #### Create a new OAuth app
  16. The objective of creating an app under your github account is to access an
  17. endpoint through the GitHub API and obtain credentials to set your environment
  18. file. For more information on how to create a new OAuth app, consult the corresponding
  19. Github developer documentation [here](https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/).
  20. #### Create a .env file
  21. After forking this repository, run the command `cd server/`. Inside that folder,
  22. setup your environment credentials by creating a `.env file` with the code below filled in.
  23. ```
  24. CLIENT_ID = <your_client_ID_from_oauth_app>
  25. CLIENT_SECRET = <your_generated_personal_access_from_oauth_app>
  26. SESSION_SECRET = <any_string_you_want>
  27. PORT = <any_number>
  28. ```
  29. The creation of your OAuth app and the .env file are required steps,
  30. irrespective of your desired deployment environment. For specific directions,
  31. continue by following the steps specified below.
  32. ### Deployment on the local machine
  33. #### Install dependencies
  34. Dependencies are installed using `npm`. Therefore, please install the package manager
  35. before proceeding. If you already have `npm` installed, run the command below inside
  36. `server/` in order to install the dependencies in the package directory.
  37. ```bash
  38. npm install
  39. ```
  40. #### Explore GitHub-Graphs
  41. Inside `server/`, run the following command to start the program, and in your
  42. browser, check `localhost:8000` to visualize your Github network.
  43. ```bash
  44. node server.js
  45. ```
  46. ### Deployment in a Docker container
  47. Github-graphs can also be deployed inside a docker container and displayed in
  48. your browser through port mapping. To get started run the following commands
  49. inside your forked repository.
  50. The easiest way to deploy in a docker container is through the use of our proposed
  51. `docker-compose.yml` file. If you choose this methodology, make sure the port numbers
  52. in your `.env` file matches the docker-compose file. Note that this approach will work
  53. only on systems which have Docker and Docker-compose both installed.
  54. Considering the example provided in our provided docker-compose,
  55. the port number of the .env file should be `PORT= 8000`. Therefore, you could
  56. visualize the Github-Graphs page at `localhost:8080` after running:
  57. ```
  58. docker-compose up -d --build
  59. ```
  60. In order to clean the environment, you can run the following command.
  61. ```
  62. docker-compose down --rmi all
  63. ```
  64. Besides the use of docker-compose, deployment with just docker is possible with the following commands:\
  65. ```
  66. docker build -t <choose_name_for_image> .
  67. docker run -d --name <choose_name_for_container> -p <local_port_num>:<port_num_from_env_file> <name_of_image>
  68. ```
  69. For instance, assume I name my image `graph-app`, my container `github-graphs`,
  70. and set the port number in my .env file to `8000`, I can decide to listen on my localhost at port `8080`.
  71. Therefore, my commands are:
  72. ```
  73. docker build -t graph-app .
  74. docker run -d --name github-graphs -p 8080:8000 graph-app
  75. ```
  76. If you are willing to read the debugging statement on the CLI, do not add `-d` to the `docker run` statement.
  77. At this step, you can now visualize Github graphs at `localhost:<local_port_num>`.
  78. ## Contributing
  79. We are very open to new contributors. If you want to contribute to this project,
  80. and don't know where to start, look at the [open issues](https://github.com/jrtechs/github-graphs/issues).
  81. Once you know what you want to work on, comment on the issue and file a pull request.
  82. ## API Reference
  83. `GET https://github-graphs.com/api/friends/<username>`
  84. Fetches `https://api.github.com/users/<username>/followers` [(GitHub Reference)](https://developer.github.com/v3/users/followers/#list-followers-of-a-user)
  85. and `https://api.github.com/users/<username>/following` [(GitHub Reference)](https://developer.github.com/v3/users/followers/#list-users-followed-by-another-user)
  86. to generate an array of users following `<username>` and that `<username>` follows each with values `login` and `avatar_url`.
  87. Example result:
  88. ```json
  89. [
  90. {
  91. "login": "jrtechs",
  92. "avatar_url": "https://avatars1.githubusercontent.com/u/13894625?s=460&v=4"
  93. }
  94. ]
  95. ```
  96. ---
  97. `GET https://github-graphs.com/api/repositories/<username>`
  98. Fetches `https://api.github.com/users/<username>/repos` and returns an array of the repositories `<username>` owns.
  99. Example result:
  100. ```json
  101. [
  102. {
  103. "name": "bash_manager",
  104. "created_at": "2017-09-27T14:38:01Z",
  105. "homepage": "",
  106. "description": "Python scripts I use to manage my ssh connections, drive mounts, and other bash related things. ",
  107. "language": "Python",
  108. "forks": 26,
  109. "watchers": 4,
  110. "open_issues_count": 7,
  111. "license": {
  112. "key": "mpl-2.0",
  113. "name": "Mozilla Public License 2.0",
  114. "spdx_id": "MPL-2.0",
  115. "url": "https://api.github.com/licenses/mpl-2.0",
  116. "node_id": "MDc6TGljZW5zZTE0"
  117. },
  118. "html_url": "https://github.com/jrtechs/bash_manager"
  119. }
  120. ]
  121. ```
  122. ---
  123. `GET https://github-graphs.com/api/org/users/<organization_name>`
  124. Fetches `https://api.github.com/orgs/<organization_name>/members` [(GitHub Reference)](https://developer.github.com/v3/orgs/members/#members-list)
  125. to generate an array of users that are in `<organization_name>` each with values `login` and `avatar_url`.
  126. Example result:
  127. ```json
  128. [
  129. {
  130. "login": "jrtechs",
  131. "avatar_url": "https://avatars1.githubusercontent.com/u/13894625?s=460&v=4"
  132. }
  133. ]
  134. ```
  135. ---
  136. `GET https://github-graphs.com/api/org/repositories/<organization_name>`
  137. Fetches `https://api.github.com/orgs/<organization_name>/repos` [(GitHub Reference)](https://developer.github.com/v3/repos/#list-organization-repositories)
  138. to return an array of repositories `<organization_name>` owns.
  139. Example result:
  140. ```json
  141. [
  142. {
  143. "name": "vue",
  144. "created_at": "2013-07-29T03:24:51Z",
  145. "homepage": "http://vuejs.org",
  146. "description": "🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.",
  147. "language": "JavaScript",
  148. "forks": 23228,
  149. "watchers": 154891,
  150. "open_issues_count": 419,
  151. "license": {
  152. "key": "mit",
  153. "name": "MIT License",
  154. "spdx_id": "MIT",
  155. "url": "https://api.github.com/licenses/mit",
  156. "node_id": "MDc6TGljZW5zZTEz"
  157. },
  158. "html_url": "https://github.com/vuejs/vue"
  159. }
  160. ]
  161. ```