Development Setup
Port forwarding, local development, and tooling for Google Workspace add-ons
This guide covers setting up your development environment for efficient add-on development with hot module replacement and live preview inside Google Workspace.
Local Development
Start the development server with port forwarding up and running (see below).
cd addon
yarn run start:sheets # For Sheets onlyor for all enabled workspace types:
cd addon
yarn run start # For all enabled typesThis starts a Vite dev server with HMR for previewing your UI outside of Google Workspace.
Live Development Inside Google Workspace
The most powerful development feature is the ability to develop your React client locally while seeing changes instantly inside the actual Google add-on window—no redeployment needed.
How It Works
In development mode, the add-on loads a wrapper HTML that embeds an iframe pointing to your local Vite dev server. The gas-client library bridges communication between your local React app and the Apps Script server functions.
┌─────────────────────────────────────────────────────────┐
│ Google Sheets/Docs/Slides/Forms │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Sidebar (wrapper HTML pushed to Apps Script) │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ iframe → Your Local Dev Server (via tunnel)│ │ │
│ │ │ - Hot Module Replacement (HMR) │ │ │
│ │ │ - Instant React updates │ │ │
│ │ │ - Full Vite dev experience │ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘1. Create an HTTPS Tunnel
Google's iframe requires HTTPS. Create a tunnel to expose your local dev server:
Option A: VS Code Ports (recommended)
- Open the Ports panel in VS Code (
Cmd+Shift+P> "Ports: Focus on Ports View") - Forward port
3000 - Set visibility to Public
- Copy the tunnel URL (e.g.,
https://xxxxxxxx-3000.brs.devtunnels.ms)
Option B: ngrok
ngrok http 3000Copy the HTTPS URL from the output.
2. Configure the Tunnel URL
Update addon/src/constants.ts with your tunnel URL:
// constants.ts
export const DEV_SERVER_URL = "https://your-tunnel-url";3. Start Live Development
cd addon
yarn run start:sheetsThis command:
- Builds the server code and wrapper HTML with your tunnel URL
- Pushes the wrapper to Apps Script
- Starts the local Vite dev server
4. Develop with Instant Feedback
- Open your Google document and launch the add-on sidebar
- The sidebar loads your local React app via the tunnel
- Edit your React components—changes appear instantly via HMR
- Server function calls still work (routed through
gas-client)
Tips
- Keep the tunnel stable: VS Code Ports tunnels persist across restarts
- One app at a time: Use
yarn start:sheetsinstead ofyarn startfor faster iteration on a specific app type - Server changes still require deploy: Only client React code hot-reloads; server function changes need
yarn deploy
Build Commands
Building for Production
yarn buildOutput is written to addon/dist/:
sidebar.html- Inlined sidebar appdialog.html- Inlined dialog appcode.js- Bundled server code
Deploying
yarn deployPushes the dist folder to Google Apps Script using clasp.
Utility Scripts
The boilerplate includes several helper scripts in addon/scripts/:
| Script | Description |
|---|---|
open-all.sh | Opens all configured Google Workspace documents |
open-type.sh | Opens a specific document type (sheets, docs, etc.) |
push-all.sh | Pushes code to all Apps Script projects |
push-type.sh | Pushes code to a specific Apps Script project |
setup.sh | Initial setup script for new projects |
Running Scripts
# Open all test documents
./scripts/open-all.sh
# Open only Sheets test document
./scripts/open-type.sh sheets
# Push to all projects
./scripts/push-all.sh
# Push to Sheets project only
./scripts/push-type.sh sheets