├── obernal.png ├── google-gson.png ├── client ├── file-icons │ └── PNG │ │ ├── 3gp.png │ │ ├── 7z.png │ │ ├── ae.png │ │ ├── ai.png │ │ ├── apk.png │ │ ├── avi.png │ │ ├── bak.png │ │ ├── bmp.png │ │ ├── css.png │ │ ├── csv.png │ │ ├── divx.png │ │ ├── dll.png │ │ ├── doc.png │ │ ├── docx.png │ │ ├── dw.png │ │ ├── eps.png │ │ ├── exe.png │ │ ├── flv.png │ │ ├── fw.png │ │ ├── gif.png │ │ ├── gz.png │ │ ├── html.png │ │ ├── ico.png │ │ ├── jar.png │ │ ├── java.png │ │ ├── jpg.png │ │ ├── js.png │ │ ├── mov.png │ │ ├── mp3.png │ │ ├── mp4.png │ │ ├── mpeg.png │ │ ├── pdf.png │ │ ├── php.png │ │ ├── png.png │ │ ├── ppt.png │ │ ├── ps.png │ │ ├── psd.png │ │ ├── rar.png │ │ ├── svg.png │ │ ├── swf.png │ │ ├── sys.png │ │ ├── tar.png │ │ ├── tiff.png │ │ ├── txt.png │ │ ├── wav.png │ │ ├── zip.png │ │ └── scala.png ├── index.html ├── graphs.html ├── graph.js ├── d3-tip │ └── d3-tip.js └── jquery-1.11.3.min.js ├── api ├── config.json ├── github-api.js ├── user-api.js ├── app.js ├── followers-api.js └── repos-api.js ├── package.json ├── .gitignore └── README.md /obernal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/obernal.png -------------------------------------------------------------------------------- /google-gson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/google-gson.png -------------------------------------------------------------------------------- /client/file-icons/PNG/3gp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/3gp.png -------------------------------------------------------------------------------- /client/file-icons/PNG/7z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/7z.png -------------------------------------------------------------------------------- /client/file-icons/PNG/ae.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/ae.png -------------------------------------------------------------------------------- /client/file-icons/PNG/ai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/ai.png -------------------------------------------------------------------------------- /client/file-icons/PNG/apk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/apk.png -------------------------------------------------------------------------------- /client/file-icons/PNG/avi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/avi.png -------------------------------------------------------------------------------- /client/file-icons/PNG/bak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/bak.png -------------------------------------------------------------------------------- /client/file-icons/PNG/bmp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/bmp.png -------------------------------------------------------------------------------- /client/file-icons/PNG/css.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/css.png -------------------------------------------------------------------------------- /client/file-icons/PNG/csv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/csv.png -------------------------------------------------------------------------------- /client/file-icons/PNG/divx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/divx.png -------------------------------------------------------------------------------- /client/file-icons/PNG/dll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/dll.png -------------------------------------------------------------------------------- /client/file-icons/PNG/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/doc.png -------------------------------------------------------------------------------- /client/file-icons/PNG/docx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/docx.png -------------------------------------------------------------------------------- /client/file-icons/PNG/dw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/dw.png -------------------------------------------------------------------------------- /client/file-icons/PNG/eps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/eps.png -------------------------------------------------------------------------------- /client/file-icons/PNG/exe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/exe.png -------------------------------------------------------------------------------- /client/file-icons/PNG/flv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/flv.png -------------------------------------------------------------------------------- /client/file-icons/PNG/fw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/fw.png -------------------------------------------------------------------------------- /client/file-icons/PNG/gif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/gif.png -------------------------------------------------------------------------------- /client/file-icons/PNG/gz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/gz.png -------------------------------------------------------------------------------- /client/file-icons/PNG/html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/html.png -------------------------------------------------------------------------------- /client/file-icons/PNG/ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/ico.png -------------------------------------------------------------------------------- /client/file-icons/PNG/jar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/jar.png -------------------------------------------------------------------------------- /client/file-icons/PNG/java.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/java.png -------------------------------------------------------------------------------- /client/file-icons/PNG/jpg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/jpg.png -------------------------------------------------------------------------------- /client/file-icons/PNG/js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/js.png -------------------------------------------------------------------------------- /client/file-icons/PNG/mov.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/mov.png -------------------------------------------------------------------------------- /client/file-icons/PNG/mp3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/mp3.png -------------------------------------------------------------------------------- /client/file-icons/PNG/mp4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/mp4.png -------------------------------------------------------------------------------- /client/file-icons/PNG/mpeg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/mpeg.png -------------------------------------------------------------------------------- /client/file-icons/PNG/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/pdf.png -------------------------------------------------------------------------------- /client/file-icons/PNG/php.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/php.png -------------------------------------------------------------------------------- /client/file-icons/PNG/png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/png.png -------------------------------------------------------------------------------- /client/file-icons/PNG/ppt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/ppt.png -------------------------------------------------------------------------------- /client/file-icons/PNG/ps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/ps.png -------------------------------------------------------------------------------- /client/file-icons/PNG/psd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/psd.png -------------------------------------------------------------------------------- /client/file-icons/PNG/rar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/rar.png -------------------------------------------------------------------------------- /client/file-icons/PNG/svg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/svg.png -------------------------------------------------------------------------------- /client/file-icons/PNG/swf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/swf.png -------------------------------------------------------------------------------- /client/file-icons/PNG/sys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/sys.png -------------------------------------------------------------------------------- /client/file-icons/PNG/tar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/tar.png -------------------------------------------------------------------------------- /client/file-icons/PNG/tiff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/tiff.png -------------------------------------------------------------------------------- /client/file-icons/PNG/txt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/txt.png -------------------------------------------------------------------------------- /client/file-icons/PNG/wav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/wav.png -------------------------------------------------------------------------------- /client/file-icons/PNG/zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/zip.png -------------------------------------------------------------------------------- /client/file-icons/PNG/scala.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obernal/github-force-graphs/HEAD/client/file-icons/PNG/scala.png -------------------------------------------------------------------------------- /api/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "github-user":"", 3 | "github-token" : "", 4 | "oauth-token" : "", 5 | "graph-ttl" : 36000000 6 | } 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api", 3 | "version": "1.0.0", 4 | "description": "github-graphs-api", 5 | "main": "api/app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "obernal", 10 | "license": "ISC", 11 | "dependencies": { 12 | "github": "^0.2.4", 13 | "express": "^4.13.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 28 | node_modules 29 | -------------------------------------------------------------------------------- /api/github-api.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | var GitHubApi = require("github"); 3 | var config = require('./config.json'); 4 | var github = new GitHubApi({ 5 | // required 6 | version: "3.0.0", 7 | // optional 8 | debug: true, 9 | protocol: "https", 10 | host: "api.github.com", // should be api.github.com for GitHub 11 | timeout: 5000, 12 | headers: { 13 | "user-agent": "GitHub-Force-Graphs" // GitHub is happy with a unique user agent 14 | } 15 | }); 16 | 17 | // OAuth2 Key/Secret 18 | /*if (config['oauth-token']!= undefined){ 19 | github.authenticate({ 20 | type: "oauth", 21 | token: config['oauth-token'] 22 | }) 23 | }else{*/ 24 | github.authenticate({ 25 | type: "basic", 26 | username: config['github-user'], 27 | password: config['github-token'] 28 | }); 29 | 30 | //} 31 | 32 | return { 33 | github_client: github 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /api/user-api.js: -------------------------------------------------------------------------------- 1 | module.exports = function(options) { 2 | 3 | function GitHubReposApi(user,callback) { 4 | var github = require('./github-api')().github_client; 5 | this.callback = callback; 6 | this.repos = []; 7 | this.current_page = 1; 8 | this.pages = 4; 9 | 10 | var self = this; 11 | this.get_repos = function(user, page){ 12 | github.repos.getFromOrg({ 13 | org : user, 14 | page: page 15 | }, function(err, json) { 16 | if (json != undefined && json.length > 0){ 17 | self.repos = self.repos.concat(json); 18 | if (self.current_page >= self.pages){ 19 | callback(self.repos); 20 | }else{ 21 | self.current_page = self.current_page + 1; 22 | self.get_repos(user,self.current_page); 23 | } 24 | } 25 | }); 26 | } 27 | } 28 | 29 | var get_repos = function(user, callback) { 30 | var graph = new GitHubReposApi(user, callback); 31 | graph.get_repos(user, 1); 32 | } 33 | 34 | return { 35 | get_repos: get_repos 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /api/app.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var app = express(); 3 | 4 | app.use(express.static(__dirname + '/../' + 'client')); 5 | 6 | app.get('/:user/repos', function (req, res) { 7 | res.header('Access-Control-Allow-Origin', "*"); 8 | var user_api = require('./user-api')({ 9 | user: req.params.user, 10 | }); 11 | user_api.get_repos(req.params.user,function(json){ 12 | //console.log(json); 13 | res.json(json); 14 | }); 15 | }); 16 | 17 | app.get('/followers-graph', function (req, res) { 18 | res.header('Access-Control-Allow-Origin', "*"); 19 | var followers_api = require('./followers-api')({ 20 | user: req.query.user, 21 | }); 22 | followers_api.graph_gh_followers(req.query.user,function(json){ 23 | res.json(json); 24 | }); 25 | }); 26 | 27 | app.get('/repo-graph', function (req, res) { 28 | res.header('Access-Control-Allow-Origin', "*"); 29 | var repos_api = require('./repos-api')({ 30 | user: req.query.user, 31 | repo: req.query.repo 32 | }); 33 | repos_api.graph_gh_repo(req.query.user, req.query.repo, function(json){ 34 | res.json(json); 35 | }); 36 | }); 37 | 38 | var server = app.listen(3000, function () { 39 | var host = server.address().address; 40 | var port = server.address().port; 41 | 42 | console.log('Example app listening at http://%s:%s', host, port); 43 | }); 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Github Force Graphs 2 | This project provides an api to extract network data from github and a client to draw its force-directed graphs. 3 | 4 | It provides you with simple force graphs to very easily analyze the contributions made to a repository. 5 | 6 | ## Repo Graphs 7 | 8 | Repo graphs show contributors and files committed and their relationships. A simple repo graph looks like this: 9 | 10 |  11 | 12 | It shows which contributors have affected which files and how nodes are related. Files are distinguished by their type. Rolling over a node shows a tootip with information while clicking on it provides a link to it on github. 13 | 14 | ## Followers Graphs 15 | Followers graphs are less informational but are still fun to draw :). They provide information about who follows who on github, starting with one single user. 16 | 17 |  18 | 19 | # Get Started 20 | 21 | You first need to configure your github access credentials at [config.json](https://github.com/obernal/github-force-graphs/blob/master/api/config.json) 22 | 23 | `npm install` 24 | 25 | `node .` 26 | 27 | # API 28 | 29 | The api provides two main resources which are quite self-explanatory: 30 | 31 | * `/followers-graph?user=xx` 32 | * `/repo-graph?user=xx&repo=yy` 33 | 34 | # Client 35 | 36 | Client has two available interfaces: 37 | 38 | * `http://localhost:3000/index.html` shows a simple interface which graphs either a repo or a user graph based on the input 39 | * `http://localhost:3000/graphs.html?username=xxx` which plays a slide show of all repos available to the organization 40 | 41 | 42 | -------------------------------------------------------------------------------- /client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 || t |