Skip to content
EN

Set up a local development environment

Last updated

The Plugin Playground is ideal for quick experiments, but use a local development environment to build a full Plugin. This setup lets you write your Plugin in your own editor and see your changes in Re:Earth Visualizer almost instantly—without manually building and reinstalling the .zip each time.

This workflow has two halves: a Plugin project created from a template, and a local Re:Earth Visualizer that loads your Plugin directly from a preview server using the DEV_PLUGIN feature.

This guide assumes you already have Re:Earth Visualizer running locally and accessible at http://localhost:3000. Setting up the Visualizer itself (including its server and database) is a separate process—for instructions, see the reearth-visualizer repository.

Also install Node.js and Yarn.

The recommended starting point is the Re:Earth Visualizer Plugin ShadCN Template, built with React, ShadCN, and Tailwind CSS.

After creating your own copy of the template and opening it in your terminal:

  1. Move into your Plugin directory:

    Terminal window
    cd your-new-plugin
  2. Install the dependencies:

    Terminal window
    yarn install
  3. Run an initial build to generate the required files:

    Terminal window
    yarn build
  4. Start the development and preview server:

    Terminal window
    yarn dev-build

This last command watches your code, rebuilds the Plugin automatically when you save, and serves it from a preview server at http://localhost:5005.

Next, tell your local Visualizer to load the Plugin from that preview server.

  1. In your local Re:Earth Visualizer project, move into the web directory and create a .env file if one does not already exist:

    Terminal window
    cd web
    touch .env
  2. Add the preview server URL to the .env file:

    Terminal window
    REEARTH_WEB_DEV_PLUGIN_URLS='["http://localhost:5005"]'

The web server restarts automatically after you save changes to .env.

With both servers running, set up a project in the Visualizer to host your Plugin:

  1. Open your local Re:Earth Visualizer at http://localhost:3000.
  2. Create a new project from the dashboard.
  3. Double-click the project to open it.
  4. In the editor header, click Install Dev Plugins to fetch and install your Plugin from the preview server.
  5. Open the Widgets tab and add your Plugin’s Widget to the scene.

Once everything is connected, your day-to-day workflow becomes very short:

  1. Make a change to your Plugin code and save it. The Plugin rebuilds automatically.
  2. In the Visualizer editor header, click Reload Dev Plugin Extensions to load the updated Plugin.

Because only the Plugin reloads—not the entire page—your changes appear almost immediately.

The DEV_PLUGIN workflow adds two buttons to the Visualizer editor header. Both are puzzle-piece icons:

  • Install Dev Plugins: Fetches your Plugin from the preview server, packages it into a .zip, and installs it.
  • Reload Dev Plugin Extensions: Reloads your Plugin’s extension code from the preview server without reloading the page.

Use this guide to decide which one to click:

What you changedButton to use
First-time setup in a projectInstall Dev Plugins
Extension code (TypeScript / JavaScript)Reload Dev Plugin Extensions
reearth.yml (the Plugin manifest)Install Dev Plugins