• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dev tool to analyze the performance of user interface and single-page applications based on the React frontend library

ReaPer Logo (Home)

ReaPer


What is ReaPer?

ReaPer is an open-source developer tool used for analyzing the performance of user interface and single-page applications based on the React frontend library. ReaPer offers comprehensive insights into React application efficiency in development. React is often used for building complex user interfaces that require a high degree of interactivity and responsiveness. It is important to know where performance weaknesses and strengths are to deliver optimal user experience. ReaPer brings a set of tools to improve the developer's diagnostic process. It creates a graphical analysis of component render events, their duration and their rank by render time. ReaPer starts a session and records render event data to demonstrate how the virtual DOM and each component's props and state change over time. The platform also presents a visual spread of the virtual DOM that can be traversed.


Table of Contents


Motivation

There are several strategies developers can leverage to improve the performance of their React applications, but it can be challenging to measurably assess the impact on performance resulting from these changes. React Dev Tool was the first inspiration for this product and a catalyst for further probing questions. While it is possible to determine which specific props and state have triggered a render event using React Dev Tools Profiler and Components, our engineers wondered if it would be possible to visualize how the virtual DOM and each component's props and state change over time with the render analysis on a single panel for a seamless workflow.


Key Features

ReaPer allows developers to start and end a session to record render event data so that it can provide a visualization that details render times and information on how the virtual DOM and each component's performance changes during a session.

recording

ReaPer's dashboard then displays four sets of data to analyze the render events.

dashboard

Developers have a bar graph of render events and event durations.

duration

Another graph displays the render time for each component during a specific render event.

componeent

This list holds all the components re-rendered during a session. It displays the number of times that component was re-rendered along with the average render duration.

list

By traversing the React Fiber tree, a visual of the React virtual DOM is created and displayed, allowing developers to see how the virtual DOM and components’ state and props change over time.

DOM


How to Use ReaPer

Installation

To get started, install the ReaPer extension from the Chrome Web Store.

Note: If you do not already have React Developer Tools extension installed on your browser, it is required in order for ReaPer to run.

Manual Installation

For a manual installation, clone the ReaPer repo onto your local machine after downloading React Dev Tools Chrome extension.

git clone https://github.com/oslabs-beta/ReaPer.git

Install dependencies and run the ReaPer application locally.

cd reaper
npm install
npm start

Add ReaPer to your Chrome extensions.

  • Navigate to chrome://extensions
  • Select Load Unpacked
  • Turn on 'Allow access to file URLs' in extension details
  • Choose reaper/dist
  • Navigate to your application in development mode

Note: ReaPer is intended for analyzing and debugging React applications in development mode running on local host, and not for production websites or production versions with minimized and compressed files.

Note: This version of ReaPer only fully supports class components. For functional components, state and props information is incomplete.

Open up your project in Google Chrome.

Open Chrome Dev Tools:

  • Windows / Linux: F12
  • Mac: Fn + F12

Navigate to the ReaPer panel. Start recording a session, interact with your application, stop recording session and analyze your application's React performance on ReaPer's dashboard!


How ReaPer Works Under the Hood

React Under the Hood

In order for our engineers to begin to consider assessing a React application's performance, we needed a good understanding of how React works under the hood. React provides a component-based architecture that lets developers build reusable user interfaces (UI) components that can be composed together to create complex UIs. React also uses a virtual Document Object Model (DOM) that allows efficient updates to the UI by only re-rendering the components that changed.

React Fiber

When we took a deep dive into React, we learned of a powerful ingredient in React's core algorithm - React Fiber. React Fiber was introduced with the release of React 16, which was a significant update to the library. React Fiber makes the rendering of components more efficient by breaking the rendering process into smaller blocks that can be prioritized and executed more efficiently. It is based on a reconciliation algorithm that uses priorities, determines how state changes of components are propagated to its children and renders components based on importance and available resources.

React builds a Fiber Node object that represents a unit of work in the React Fiber reconciliation algorithm. React Fiber Nodes are constructed into a tree structure with each node representing a single component in the application. Each node holds details about a component, its props, its children and metadata about its position in the rendering tree.

ReaPer Accesses React Fiber

ReaPer peeks into the reconciliations of each constructed tree and updated information after the reconciliation process. ReaPer pulls data on the render events, the trees and the components and how they've changed through the course of the session that was recorded.

In order to gain access to React's Fiber Tree, ReaPer uses a React Dev Tool object called __REACT_DEVTOOLS_GLOBAL_HOOK__, which is installed onto the window object, and this is why developers need to have React Dev Tools installed onto their Chrome browser. ReaPer uses this "global hook" to access the contents of React's Fiber Tree including the method, onCommitFiberRoot, which is invoked after the reconciliation process is completed.

ReaPer's Magic

When a ReaPer session is initiated, ReaPer's magical functionality is injected into the developer's target testing application for monitoring React render data. ReaPer connects to React Dev Tool's global hook and then intercepts the global hook's onCommitFiberRoot method, instantiates a session's collection of render events, and after each render event, rebuilds ReaPer's own version of the tree for each event. Reconstructing the tree and determining which information to pull from React's tree was quite tricky. You'll see more about this in the next section.

Then when a session ends ReaPer turns the session off, undoes the interception of React global hook's onCommitFiberRoot method and points it back to the original method. Then the data is passed to the frontend to display on ReaPer's dashboard.

How the Tree Node Was Reconstructed

React's tree of fiber nodes is structured as a linked list of parent nodes with a 'child' property pointing to the first child node. The first child node points to other children in its 'sibling' property. This results in all of the children of one parent node being in their own linked list.

When a render event is saved in a session, ReaPer recursively traverses React's fiber node tree of linked lists and creates a ReaPer tree that represents the virtual DOM after that render event. A ReaPer tree structure consists of tree node objects that save each fiber node's props, state, render time, component name, and an array of children nodes. This architecture facilitated the conversion of the ReaPer tree into a visual tree of components.

tree-diagrams


How We Built Dev Tools

ReaPer uses the Chrome Devtools Panels API to integrate itself into the Google Chrome Dev Tools window.

From there, the components of ReaPer can be broken down as follows:

  • ReaPer front end, which comprises of React components and their business logic
  • ReaPer back end, which is where the logic is for tasks like connecting to the __REACT_DEVTOOLS_GLOBAL_HOOK__ parsing the React Fiber Tree and building the ReaPer tree, and connecting to the user’s target React application
  • The background script for the ReaPer Chrome dev tool
  • The content script for the ReaPer Chrome dev tool

In order for these components to communicate and pass information, ReaPer utilizes a combination of short-lived and long-lived connections to execute message passing:

  • The content script:
    • Uses chrome.runtime to send and receive messages from the background script
    • Has an event listener for window messages to receive messages from the ReaPer back end
  • The background script:
    • Uses chrome.runtime to:
      • Receive messages from the content script
      • Send and receive messages to and from ReaPer’s front end
    • Uses chrome.tabs to send messages to the content script
  • The ReaPer front end uses chrome.runtime to send messages to the background script

To gain access to the user’s target website’s DOM and its React Dev Tools global hook, the background script uses the chrome.scripting API to add a script tag whose source is a backend index.js file. This index.js file, once executed, will immediately:

  • Invoke startReaperSession, a back end function. By executing this function in the context of the user’s target website, ReaPer is able to gain access to the target website’s DOM and React Dev Tools global hook
  • Add an event listener for a “startReaperSession” event
  • Add an event listener for a “endReaperSession” event

The “startReaperSession” and “endReaperSession” events are created and dispatched by the content script via document.dispatchEvent.

flow1

flow2

flow3

flow4

flow5


Call to Action

If you would like to read more about ReaPer, checkout the Medium article.

We encourage you to submit issues for any bugs or ideas for enhancements. Please feel free to fork this repo and submit pull requests to contribute as well. Also visit our website and follow ReaPer on LinkedIn for more updates.

Contribution Ideas:

  • The ability to analyze the state properties of functional components
  • Allow users to save session data and compare it to the current data (overlay bar graph and display time difference)
  • Support collecting data for React Native so that developers can evaluate performance on mobile devices
  • When clicking on a component node, display the node’s render time, the reason why it was rendered, and its props values
  • Displaying a bar graph and render time for a selected component
  • Vigorous testing
  • Conversion to TypeScript

Bug to Fix:

  • Currently, when the extension is reloaded into the Chrome Web Store, the ReaPer user must either hard refresh or close and reopen the target application tab. This issue occurs randomly, but when it does, the ReaPer user sees the notice, "No session data to display" instead of the data that is collected.

Resources

This product would not have been possible with extensive work done by the following entities and resources:


Love the Product?

Star and fork 🔱 ReaPer's repository.
Follow us at Follow us on LinkedIn

Clap 👏 ReaPer's Medium article if you enjoyed it!


Contributors


Anna Ko


Jamie Lee


Katrina McDonagh


Michael Arita


Nancy Yu


License

ReaPer is a free and open-sourced software licensed under the MIT licensed.


More Repositories

1

sapling

Sapling - A convenient way to traverse your React app in VS Code
JavaScript
489
star
2

Kafka-Sprout

🚀 Web GUI for Kafka Cluster Management
Java
429
star
3

GraphQuill

Real-time GraphQL API Exploration in VS Code
TypeScript
395
star
4

protographql

ProtoGraphQL is a prototyping tool that empowers developers to build and visualize GraphQL schemas and queries without writing any code.
JavaScript
360
star
5

seeql

see your database in a new way
TypeScript
344
star
6

Realize

A React component tree visualizer
JavaScript
327
star
7

Allok8

⚡️A pretty swell Kubernetes visualization tool
JavaScript
273
star
8

ReactRTC

NPM package that simplifies set-up of WebRTC as importable React components
JavaScript
270
star
9

svend3r

Interactive plug and play charting library for Svelte
JavaScript
267
star
10

aether

All-in-One Memory Leak Testing Solution
JavaScript
250
star
11

Yodelay

Your preferred gRPC endpoint testing tool. Making sure your outbound 🗣️ ‘yodelay’ returns the ‘IiiOoo’ 📣 that you expect
TypeScript
228
star
12

ReactRPC

Full feature integration library for gRPC-Web into React
JavaScript
224
star
13

atomos

Atomos is an open source dev tool for Recoil that provides real-time visualization of the component tree and atom-selector relationships to facilitate debugging of a React application.
JavaScript
218
star
14

Dockter

A low-overhead, open-source Docker log management tool
TypeScript
217
star
15

svelte-sight

A Svelte dev tool for visualizing component hierarchy, state, and props of your application
Svelte
215
star
16

KUR8

A visual overview of Kubernetes architecture and Prometheus metrics
JavaScript
213
star
17

OpticQL

Developer tool focused on streamlining the performance testing and optimization of GraphQL API
JavaScript
212
star
18

connext-js

A middleware and route handling solution for Next.js.
JavaScript
210
star
19

hypnos

The best way to test GraphQL calls to RESTful APIs.
JavaScript
205
star
20

Equa11y

A stream-lined command line tool for developers to easily run accessibility testing locally through axe-core and puppeteer.
TypeScript
204
star
21

preducks

React/Redux/Typescript Application Prototyping & Smart Boilerplate Generation Tool
TypeScript
199
star
22

drawql

an OSS tool for designing a graphql endpoint in Apollo
CSS
195
star
23

kubermetrics

JavaScript
194
star
24

TotalRecoilJS

TotalRecoilJS is a tool created to help developers visualize/debug and track their Recoil state via a Chrome extension.
JavaScript
193
star
25

Horus

🎯 A gRPC-Node Distributed Tracing and Monitoring Tool.
JavaScript
187
star
26

PostQL

Web app to visualize your GraphQL metrics and provide historical analytics
TypeScript
186
star
27

Ahoy

Ahoy! is a GUI tool for DevOps engineers which distills the many functions of Helm into a user-friendly interface.
JavaScript
183
star
28

battletest

A CLI module for npm that auto-generates tests based on user specified parameters.
JavaScript
183
star
29

Deno-Redlock

Deno's first lightweight, secure distributed lock manager utilizing the Redlock algorithm
TypeScript
182
star
30

ReactMonitor

Quickly visualize React's component tree and its performance
JavaScript
181
star
31

Osiris

An Electron based desktop application for generating components, building pages, and storing them in a UI library.
JavaScript
177
star
32

protostar-relay

Open-source iteration of the official Relay devtool.
JavaScript
171
star
33

TorchQL

A tool to quickly generate GraphQL schemas and resolvers from a relational database
JavaScript
171
star
34

trydent

testing tamed
TypeScript
170
star
35

genesisQL

rapid schema-prototyping tool for GraphQL applications
JavaScript
169
star
36

FilamentQL

GraphQL query and caching solution
JavaScript
168
star
37

GatsbyHub

Access everything Gatsby has to offer without ever leaving Visual Studio Code. This VSCode Extension allows you to generate a new Gatsby site using a starter, browse Gatsby plugins, and develop a server all with a click of a button.
TypeScript
163
star
38

aditum

Accessibility components for managing focus in React SPAs
JavaScript
162
star
39

watchmo

JavaScript
162
star
40

react-chronoscope

Developer tool to monitor React performance
JavaScript
162
star
41

navigate

A Kubernetes cluster visualizer for DevOps engineers - network policies, aggregated scheduler logs, deployments and pods before your cluster is running!
TypeScript
161
star
42

TrunQ

NPM package for easy client and/or server side graphQL caching.
JavaScript
160
star
43

onyx

Onyx is authentication middleware for Deno, inspired by Passport.js
TypeScript
159
star
44

BACE

JavaScript
159
star
45

MASH

Kafka visualizer and management suite
TypeScript
158
star
46

portara

Portara directive is a rate limiter / throttler for GraphQL
TypeScript
158
star
47

irisql

GraphQL prototyping tool to quickly mock-up Node API's and visualize where you can query from.
JavaScript
158
star
48

Interspect

An API mocking tool for testing data interoperability between microservices and secure HTTP endpoints
JavaScript
157
star
49

SMEE

JavaScript
154
star
50

ChaosQoaLa

Chaos Engineering meets GraphQL
JavaScript
153
star
51

VaaS

Modular Kubernetes Management System with OpenFaaS Support
TypeScript
153
star
52

tropicRPC

A VS Code extension that provides gRPC API endpoint testing.
TypeScript
153
star
53

dashport

Local and OAuth authentication middleware for Deno
TypeScript
151
star
54

anagraphql

JavaScript
151
star
55

Trinity

A VSCode extension for Cypher and Neo4j
TypeScript
150
star
56

DockerLocal

DockerLocal is a GUI application that allows you to keep an up-to-date version of the docker compose file for interconnected repositories while doing development work on a single repository.
TypeScript
150
star
57

giraffeQL

🦒 Developer tool to visualize relational databases and export schemas for GraphQL API's.
JavaScript
147
star
58

ProtoCAD

ProtoCAD is a prototyping tool that allows developers to build UI component tree structure based on GraphQL query results.
TypeScript
146
star
59

Trace

A lightweight GraphQL query performance monitoring GUI with real-time, resolver-level performance tracing metrics and error logging.
TypeScript
146
star
60

StratosDB

☄️ ☁️ An All-in-One GUI for Cloud SQL that can help users design and test their AWS RDS Instances
TypeScript
145
star
61

snAppy

snAppy is a VS Code extension coupled with an interactive view to support your React front-end delivery.
TypeScript
144
star
62

synapse

Realtime API Library
TypeScript
144
star
63

SpectiQL

GraphQL query, mutation, subscription test generator
JavaScript
143
star
64

starfleet

Command line tool to generate GraphQL services from Mongoose schemas with full CRUD functionality and deploy them to the cloud
JavaScript
143
star
65

pelican

Automated GUI canary testing for your kubernetes clusters
JavaScript
140
star
66

ProtoNative

A React Native prototyping tool for developers.
TypeScript
140
star
67

reactFLO

A Chrome DevTool built for developers to visualize the flow of state throughout their application.
TypeScript
140
star
68

ReactionTime

ReactionTime provides a simpler way to write tests for React's Experimental Concurrent Mode.
TypeScript
140
star
69

DacheQL

GraphQL caching tool
JavaScript
139
star
70

KuberOptic

An Electron app for developers to visualize their Kubernetes clusters in real-time
TypeScript
137
star
71

sono.land

Real-time Communication Library for Deno (WebSockets & WebRTC)
TypeScript
137
star
72

KubeScrape

KubeScrape: An open-source dev tool that provides an intuitive way to view the health, structure, and live metrics of your Kubernetes cluster
JavaScript
136
star
73

LucidQL

A developer tool and visualizer that generates a GraphQL schema from an established relational database.
JavaScript
135
star
74

Hookd

A cli tool and visualizer for converting React class components to functional components with hooks.
TypeScript
135
star
75

kr8s

Docker/Kubernetes Visualization Tool
JavaScript
133
star
76

Svelcro

Svelte DevTool with a focus on rendering
JavaScript
133
star
77

KnightOwl

An npm package of GraphQL middleware to protect you from malicious queries.
JavaScript
133
star
78

Palaemon

Palaemon is an open-source developer tool for monitoring health and resource metrics of Kubernetes clusters and analyzing Out of Memory (OOMKill) errors
TypeScript
133
star
79

SvelTable

Feature rich data table component.
Svelte
132
star
80

Ekkremis

A periscopic view into pending Kubernetes pods
TypeScript
132
star
81

kQ

TypeScript
131
star
82

fflow

fflow is an easy-to-use open-source tool for all developers to create their React application.
JavaScript
127
star
83

KlusterView

Get instant insights on your Kubernetes clusters with our lightweight, plug-and-play performance monitoring tool
TypeScript
125
star
84

Aqls-server

An intelligent full-stack GraphQL subscription and analytics module. Server-side analytics processing, self-auditing router, and resolver plugins.
JavaScript
123
star
85

kondo

JavaScript
123
star
86

periqles

React form library for Relay and Apollo
JavaScript
120
star
87

ThermaKube

A web application that monitors the health and performance of Kubernetes clusters with support for AWS EKS deployments
JavaScript
120
star
88

arteMetrics

Creating performance monitors for Apollo implementations of graphQL.
JavaScript
118
star
89

QLens

QLens is an electron app which dynamically generates GraphQL Schemas and Mongo Schema visualization. QLens significantly cuts development time by automating the formation of their GraphQL schemas based on information fetched from their non-relational database.
JavaScript
118
star
90

firecomm

A complete framework for gRPC-node.
JavaScript
117
star
91

Kafkasocks

JavaScript
114
star
92

dangoDB

A MongoDB ODM for Deno
TypeScript
111
star
93

AtomicKafka

JavaScript
110
star
94

Bedrock

A modular authentication library for Deno.
TypeScript
110
star
95

Docklight

Metrics for your Docker containers
TypeScript
109
star
96

Neptune

A light-weight, simple, and straightforward learning tool for your Kubernetes cluster
JavaScript
109
star
97

ArtemisQL

ArtemisQL is a GraphQL migration tool and database visualizer that empowers developers to build and implement GraphQL with ease.
TypeScript
108
star
98

shipm8

JavaScript
108
star
99

ReacTree

ReacTree - VS Code extension that generates a hierarchy tree of React components with each node listing the passed down props, indicating whether it's connected the Redux store, and guiding you to the associated file with the click of a button
TypeScript
107
star
100

reactron

Reactron is a React component visualizer that allows you to traverse an app's fiber tree and render components individually.
JavaScript
105
star