- Table of Contents
- What is it?
- Why use it?
- Project Architecture
- Platforms Supported
- Requirements
- Running Locally
- Testing on Multiple Devices
- Deployment to Vonage Cloud Runtime
- Testing
- Code style
- Documentation Generation
- Code of Conduct
- Getting Involved
- Known Issues
- Report Issues
The Vonage Video API Reference App for React is an open-source video conferencing reference application for the Vonage Video API using the React framework.
The Reference App demonstrates the best practices for integrating the Vonage Video API with your application for various use cases, from one-to-one and multi-participant video calling to recording, screen sharing, reactions, and more.
The Vonage Video API Reference App for React provides developers an easy-to-setup way to get started with using our APIs with React.
The application is open-source, so you can not only get started quickly, but easily extend it with features needed for your use case. Any features already implemented in the Reference App use best practices for scalability and security.
As a commercial open-source project, you can also count on a solid information security architecture. While no packaged solution can guarantee absolute security, the transparency that comes with open-source software, combined with the proactive and responsive open-source community and vendors, provides significant advantages in addressing information security challenges compared to closed-source alternatives.
This application provides features for common conferencing use cases, such as:
- A video conferencing “room” supporting up to 25 participants and the following features:
- Background blur and noise suppression toggles.
- Active speaker detection.
- Layout manager with options to display active speaker, screen share, or all participants in a grid view.
- The dynamic display adjusts to show new joiners, hide video tiles to conserve bandwidth, and show the “next” participant when someone previously speaking leaves.
- Meeting information with an easy-to-share URL to join the meeting.
The Vonage Video API Reference App for React is currently supported on the latest release versions for the following browsers:
Note: Mobile web views have limited supported at the moment. The minimum supported device width is 360px
.
-
Ensure You Have a Vonage Account
You can create one at the Vonage API Dashboard.
-
Create an Application in the Dashboard
Once logged in, navigate to the Applications page via the main dashboard menu:
If you don’t already have an application, create a new one:
During the setup process, make sure to:
- Provide a name for your application.
- Generate and download the public and private keys.
- Enable Video capabilities.
Refer to the following image for visual guidance:
-
Environment Variables
In the root project directory, create the environment files by running:
cp backend/.env.example backend/.env && cp frontend/.env.example frontend/.env
Then, open backend/.env and fill in the required configuration:
- VONAGE_APP_ID – This is the ID of your Vonage application. You can find it on the Applications page.
- VONAGE_PRIVATE_KEY – If you've already generated a private key, use that. Otherwise, use the key you downloaded when creating the app.
-
Start in Development Mode
yarn dev
This starts both the backend server (port 3345) and the frontend Vite dev server (port 5173). You can now access the app at http://localhost:5173.
To test the video API across multiple devices on your local network, you can use ngrok to expose your frontend publicly.
-
Create an account at ngrok if you haven’t already.
-
Follow the Setup and Installation instructions for your operating system to install and configure ngrok.
-
Create a secure tunnel to your frontend using:
yarn forward:frontend
This command creates a publicly accessible HTTPS URL for your frontend. It will appear in your terminal, similar to the image below:
-
Copy the domain from the output and update your frontend/.env file:
# example VITE_TUNNEL_DOMAIN=GENERIC_DOMAIN
Note: ngrok assigns a temporary domain. You’ll need to update your environment variable each time the domain changes.
- Open the provided Forwarding URL in your browser. This exposes your Vite app publicly. However, keep in mind that the backend server is still local, so the devices accessing the app must be on the same local network.
Enjoy testing!
You can easily deploy your local branch to Vonage Cloud Runtime (VCR) using the tools in this repository. See https://developer.vonage.com/en/vonage-cloud-runtime/overview for an overview of Vonage Cloud Runtime.
Firstly, install the VCR cli: https://developer.vonage.com/en/vonage-cloud-runtime/getting-started/working-locally#cli-installation.
Run vcr configure
entering your Vonage API Key and Secret, and select a region. You can find your API key and secret on the dashboard: https://dashboard.nexmo.com/.
Now run vcr init
and follow the steps to:
- choose a project name
- choose an instance name
- select
nodejs22
for the runtime - Select a region for your app
- Choose or create an application for deployment.
⚠️ You should use a separate Vonage application to your Vonage Video application (i.e. the value you used forVONAGE_APP_ID
in thebackend/.env
file) to avoid issues with your private key - Choose an application for debug, if you SKIP it will re-use the application from your deployment
- For the product template select SKIP
You will see a new file created ./vcr.yml
. This file is ignored by git so that each developer can have their own deployment setup locally. This file is still missing the entrypoint
and build-script
fields which you can copy and paste from ./vcr.yml.example
.
Your file should now look something like this:
project:
name: my-project-name
instance:
name: my-instance-name
runtime: nodejs22
region: aws.euw1
build-script: './vcrBuild.sh'
entrypoint: [yarn, run-server]
application-id: my-deployment-app-id
debug:
entrypoint: [yarn, run-server]
application-id: my-debug-app-id
Now run yarn deploy-vcr
to deploy your project.
After a successful deployment the url of you instance will be shown in the output as 'Instance host address'.
You can also check your instances at https://dashboard.nexmo.com/serverless/instances.
Note: This will deploy the project using your local code and .env files, which is useful for debugging.
For a more centralized deployment to VCR see our GHA workflow .github/workflows/deploy-to-vcr.yml
.
We have integration tests using Playwright. We recommend using their VSCode integration to run tests.
To run the tests you need to run the app server separately:
# In one terminal tab
yarn start
# In a separate tab. Or use vscode extension to run tests
yarn test:integration
We use Playwright Visual Comparison for Screenshot UI tests. Since screenshot tests are part of our integration tests, running our integration tests also executes the screenshot tests.
If we need to update the expected screenshot due to UI changes, we can delete the existing expected screenshot and then run the test. The test will fail, but a new expected screenshot will be generated. Running the test again should pass, as the expected and actual screenshots will now match.
For CI tests, we require screenshots for various browsers and operating systems because they render interfaces with subtle differences.
To capture CI-specific screenshots, you can use the update-screenshots
job. This job is triggered by creating a pull request (PR) with the update-screenshots
label on GitHub. Once triggered, it will capture new screenshots on the virtual machine (VM) and automatically push those to the PR's branch.
- To run the frontend and backend tests:
yarn test
- To run backend tests once:
yarn test:backend
- To run backend tests in watch mode (ie you're adding more tests):
yarn test:backend:watch
- For additional CLI options, see jest docs.
We have frontend tests using vitest and React Testing Library. We recommend using the vitest VSCode integration to run tests.
Alternatively you can run the tests in the terminal:
- To run frontend tests once:
yarn test:frontend
- To run frontend tests in watch mode (ie you're adding more tests):
yarn test:frontend:watch
- For additional CLI options, see vitest docs
We use eslint and prettier to format code. Prettier issues will show up in eslint too via eslint-plugin-prettier. You can setup an eslint extension for your editor. For VSCode use: dbaeumer.vscode-eslint.
You can either set up vscode to fix eslint issues on save or fix them with VSCode keyboard command palette shortcut cmd + shift + p > "ESLint: Fix all auto-fixable problems"
.
In the terminal you can run
yarn lint
to check for eslint issues and
yarn lint:fix
to fix any auto-fixable issues and also run prettier on all files.
All filenames are in camelCase
.
We use typedoc
to generate documentation from our jsdoc comments.
Generated documents can be found in the frontend/dist
folder.
To generate documentation, run the following in the terminal
yarn docs
Please read our Code of Conduct.
If you wish to contribute to this project, read how in Contributing.
We track known issues in Known Issues. Please refer to it for details.
If you have any issues, feel free to open an issue or reach out to support via [email protected].