├── .example.env
├── .gitignore
├── LICENSE
├── README.md
├── client
├── .example.env
├── package.json
├── public
│ ├── favicon.ico
│ └── index.html
└── src
│ ├── actions
│ ├── constants.js
│ └── index.js
│ ├── components
│ ├── app.js
│ ├── login.js
│ ├── main.js
│ └── video-chat.js
│ ├── index.js
│ ├── reducers
│ ├── index.js
│ ├── room.js
│ └── user.js
│ └── store
│ ├── configureStore.js
│ └── preloadedState.js
├── package.json
├── server.js
└── start-client.js
/.example.env:
--------------------------------------------------------------------------------
1 | # Generated via Google API Console
2 | GOOGLE_CLIENT_ID=
3 |
4 | # Overall Twilio Account SID
5 | TWILIO_ACCOUNT_SID=
6 |
7 | # Configuration information for Programmable Video API
8 | TWILIO_API_KEY=
9 | TWILIO_API_SECRET=
10 | TWILIO_CONFIGURATION_SID=
11 |
--------------------------------------------------------------------------------
/.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 | # nyc test coverage
18 | .nyc_output
19 |
20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21 | .grunt
22 |
23 | # node-waf configuration
24 | .lock-wscript
25 |
26 | # Compiled binary addons (http://nodejs.org/api/addons.html)
27 | build/Release
28 |
29 | # Dependency directories
30 | node_modules
31 | jspm_packages
32 |
33 | # Optional npm cache directory
34 | .npm
35 |
36 | # Optional REPL history
37 | .node_repl_history
38 | # See http://help.github.com/ignore-files/ for more about ignoring files.
39 |
40 | # dependencies
41 | node_modules
42 |
43 | # testing
44 | coverage
45 |
46 | # production
47 | build
48 |
49 | # misc
50 | .DS_Store
51 | .env
52 | npm-debug.log
53 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Twilio Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Google Hangouts Clone using Twilio Programmable Video and React
2 | This demo project demonstrates how to use Twilio APIs in a React application to
3 | recreate a Google Hangouts app.
4 |
5 | ### Configure the sample application
6 |
7 | Before we run the application, we'll need to gather API credentials from Google
8 | and Twilio.
9 |
10 | ### Configure Google account information
11 |
12 | Since part of our application uses Google oAuth for authentication we will
13 | need configure the Google Client ID. We'll need to store this ID on the backend
14 | and frontend since it is stored in both. In `.env`, we will configure a
15 | `GOOGLE_CLIENT_ID` variable for the backend.
16 |
17 | | Config Value | Description |
18 | |--------------|-------------|
19 | | GOOGLE_CLIENT_ID | Client ID needed for oAuth - generate one [using these instructions](https://developers.google.com/identity/sign-in/web/devconsole-project). |
20 |
21 | We'll also configure the same ID under a different variable name in `client/.env`.
22 |
23 | | Config Value | Description |
24 | |--------------|-------------|
25 | | REACT_APP_GOOGLE_CLIENT_ID | The same ID as above under a different name |
26 |
27 | ### Configure Twilio account information
28 |
29 | | Config Value | Description |
30 | |--------------|-------------|
31 | | TWILIO_ACCOUNT_SID | Your primary Twilio account identifier - find this [in the console here](https://www.twilio.com/console). |
32 | | TWILIO_API_KEY | Used to authenticate - [generate one here](https://www.twilio.com/console/video/dev-tools/api-keys). |
33 | | TWILIO_API_SECRET | Used to authenticate - generated when you generate the key above. |
34 |
35 | ### Configure Twilio video settings
36 |
37 | | Config Value | Description |
38 | |--------------|-------------|
39 | | TWILIO_CONFIGURATION_SID | Identifier for a set of config properties for your video application - [find yours here](https://www.twilio.com/console/video/profiles). |
40 |
41 | ## Run the demo application
42 |
43 | This demo application runs two servers simulanteously. One is a server that serves
44 | the front-end assets of the application, the other is a server that exposes a backend
45 | endpoint that will be used for authentication. The front-end server contains a proxy
46 | to the backend server so that users can send a query from the frontend server
47 | to the backend server. You can read more about this type of development
48 | setup in [the official create-react-app documentation](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#node).
49 |
50 | So we need to install both our backend and frontend dependencies.
51 | Let's install the dependencies for our backend first.
52 |
53 | ```
54 | npm install
55 | ```
56 |
57 | We'll then install our frontend dependencies.
58 |
59 | ```
60 | cd client
61 | npm install
62 | ```
63 |
64 | Then we'll need to initiate both the backend and frontend servers.
65 |
66 | ```
67 | cd ..
68 | npm start
69 | ```
70 |
71 | Then navigate to [http://localhost:3000/login](http://localhost:3000/login) in
72 | order to use the application.
73 |
74 | ### Changing the application port
75 |
76 | You can change the port that the frontend server is configured to run on by
77 | settng the `PORT` varialbe in the `.env` file inside the `client` directory.
78 | An example is shown in `client/.example.env`.
79 |
--------------------------------------------------------------------------------
/client/.example.env:
--------------------------------------------------------------------------------
1 | PORT=
2 |
--------------------------------------------------------------------------------
/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hangouts-clone-react",
3 | "version": "0.1.0",
4 | "private": true,
5 | "proxy": "http://localhost:3001/",
6 | "devDependencies": {
7 | "react-scripts": "0.9.2",
8 | "redux-logger": "^2.8.1"
9 | },
10 | "dependencies": {
11 | "aphrodite": "^1.1.0",
12 | "material-ui": "^0.16.7",
13 | "react": "^15.4.2",
14 | "react-dom": "^15.4.2",
15 | "react-google-login": "^2.8.1",
16 | "react-redux": "^5.0.2",
17 | "react-router": "^3.0.2",
18 | "react-router-redux": "^4.0.7",
19 | "react-tap-event-plugin": "^2.0.1",
20 | "redux": "^3.6.0",
21 | "redux-actions": "^1.2.1",
22 | "shortid": "^2.2.6",
23 | "twilio-video": "^1.0.0-beta4"
24 | },
25 | "scripts": {
26 | "start": "react-scripts start",
27 | "build": "react-scripts build",
28 | "test": "react-scripts test --env=jsdom",
29 | "eject": "react-scripts eject"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TwilioDevEd/hangouts-clone-react/8b5fe467f9955a2c2d7717b53923cc19741a6fdc/client/public/favicon.ico
--------------------------------------------------------------------------------
/client/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |