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.

196 lines
5.9 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. ```
  51. docker build -t <choose_name_for_image> .
  52. docker run -d --name <choose_name_for_container> -p <local_port_num>:<port_num_from_env_file> <name_of_image>
  53. ```
  54. For instance, assume I name my image `graph-app`, my container `github-graphs`,
  55. and set the port number in my .env file to `8000`, I can decide to listen on my localhost at port `8080`.
  56. Therefore, my commands are:
  57. ```
  58. docker build -t graph-app .
  59. docker run -d --name github-graphs -p 8080:8000 graph-app
  60. ```
  61. If you are willing to read the debugging statement on the CLI, do not add `-d` to the `docker run` statement.
  62. At this step, you can now visualize Github graphs at `localhost:<local_port_num>`.
  63. ## Contributing
  64. We are very open to new contributors. If you want to contribute to this project,
  65. and don't know where to start, look at the [open issues](https://github.com/jrtechs/github-graphs/issues).
  66. Once you know what you want to work on, comment on the issue and file a pull request.
  67. ## API Reference
  68. `GET https://github-graphs.com/api/friends/<username>`
  69. Fetches `https://api.github.com/users/<username>/followers` [(GitHub Reference)](https://developer.github.com/v3/users/followers/#list-followers-of-a-user)
  70. and `https://api.github.com/users/<username>/following` [(GitHub Reference)](https://developer.github.com/v3/users/followers/#list-users-followed-by-another-user)
  71. to generate an array of users following `<username>` and that `<username>` follows each with values `login` and `avatar_url`.
  72. Example result:
  73. ```json
  74. [
  75. {
  76. "login": "jrtechs",
  77. "avatar_url": "https://avatars1.githubusercontent.com/u/13894625?s=460&v=4"
  78. }
  79. ]
  80. ```
  81. ---
  82. `GET https://github-graphs.com/api/repositories/<username>`
  83. Fetches `https://api.github.com/users/<username>/repos` and returns an array of the repositories `<username>` owns.
  84. Example result:
  85. ```json
  86. [
  87. {
  88. "name": "bash_manager",
  89. "created_at": "2017-09-27T14:38:01Z",
  90. "homepage": "",
  91. "description": "Python scripts I use to manage my ssh connections, drive mounts, and other bash related things. ",
  92. "language": "Python",
  93. "forks": 26,
  94. "watchers": 4,
  95. "open_issues_count": 7,
  96. "license": {
  97. "key": "mpl-2.0",
  98. "name": "Mozilla Public License 2.0",
  99. "spdx_id": "MPL-2.0",
  100. "url": "https://api.github.com/licenses/mpl-2.0",
  101. "node_id": "MDc6TGljZW5zZTE0"
  102. },
  103. "html_url": "https://github.com/jrtechs/bash_manager"
  104. }
  105. ]
  106. ```
  107. ---
  108. `GET https://github-graphs.com/api/org/users/<organization_name>`
  109. Fetches `https://api.github.com/orgs/<organization_name>/members` [(GitHub Reference)](https://developer.github.com/v3/orgs/members/#members-list)
  110. to generate an array of users that are in `<organization_name>` each with values `login` and `avatar_url`.
  111. Example result:
  112. ```json
  113. [
  114. {
  115. "login": "jrtechs",
  116. "avatar_url": "https://avatars1.githubusercontent.com/u/13894625?s=460&v=4"
  117. }
  118. ]
  119. ```
  120. ---
  121. `GET https://github-graphs.com/api/org/repositories/<organization_name>`
  122. Fetches `https://api.github.com/orgs/<organization_name>/repos` [(GitHub Reference)](https://developer.github.com/v3/repos/#list-organization-repositories)
  123. to return an array of repositories `<organization_name>` owns.
  124. Example result:
  125. ```json
  126. [
  127. {
  128. "name": "vue",
  129. "created_at": "2013-07-29T03:24:51Z",
  130. "homepage": "http://vuejs.org",
  131. "description": "🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.",
  132. "language": "JavaScript",
  133. "forks": 23228,
  134. "watchers": 154891,
  135. "open_issues_count": 419,
  136. "license": {
  137. "key": "mit",
  138. "name": "MIT License",
  139. "spdx_id": "MIT",
  140. "url": "https://api.github.com/licenses/mit",
  141. "node_id": "MDc6TGljZW5zZTEz"
  142. },
  143. "html_url": "https://github.com/vuejs/vue"
  144. }
  145. ]
  146. ```