react-code-dataset / wp-calypso /docs /guide /tech-behind-calypso.md
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified

The Technology Behind Calypso

Understanding the technologies and abstractions on which Calypso is built can make for a much better learning and building experience. Even if you are a student of the “learning by doing” school, we would still encourage you spend some time with the resources in this document.

Based on React

Calypso is composed of multiple applications that are all built using React. React is a library by Facebook that implements a virtual DOM. Instead of carefully changing the DOM, we can just re-render whole components when the data changes. React radically simplified our code and allowed for an awesome composition of reusable components.

Important libraries used in Calypso

As Calypso evolved over time, we tried several approaches to both routing and data layers on top of React. These are some of the libraries commonly used in Calypso:

  • Redux – a predictable state container for JavaScript apps. Perfect fit for complex centralized state management. It powers the data layer of most of the calypso sections, but in new calypso applications, we're moving towards lighter approaches.
  • TanStack Query – a powerful data-fetching library for React. It provides a simple API for fetching, caching, and synchronizing server state in your React applications. It is used as the main data layer of new Calypso sections (like the hosting dashboard) but is also commonly used in other parts of Calypso.
  • TanStack Router – a powerful routing library for React. It provides a simple API for managing routes and navigation in your React applications. It is used as the main routing layer of new Calypso sections (like the hosting dashboard).

For more Calypso-specific details, see the Our Approach to Data document

Git

Calypso is developed on Github, and we use Git extensively. Git is extremely powerful, and understanding how it works and controlling it are an important part of our daily workflow.

Essential Git resources:

Key concepts checklist:

  • How is Git different from Subversion?
  • How does branching work? Why are branches cheap?
  • What is rebasing? How is it different from merging?
  • What happens when we run git pull?
  • What’s a remote? What happens when we push to it?
  • Which parts of the repository are kept locally and which remotely?
  • What’s the staging area? Why is this extra step useful?
  • What is squashing? How can we edit and reorder commits before pushing/merging?

The way we use Git with Calypso is described in the Git Workflow document.

Other technologies used in Calypso, worth checking out

  • page.js – router used in most sections of Calypso. New sections are using other libraries like TanStack Router.
  • express.js – light server-side framework we use to serve the initial page
  • webpack – building a JavaScript bundle of all of our modules and making sure loading them works just fine
  • Babel – for transpiling ES2015+ and JSX

Other technologies used in Calypso that are now deprecated

  • lodash – general purpose utility library; includes a ton of useful functions for dealing with arrays, objects, and collections; deprecated because of its lack of modularity and tendency to introduce code smells by implicitly converting different value types and handling nullish (null or undefined) values.

Previous: Hello, World! Next: Monorepo