Skip to main content
RapidDev - Software Development Agency
retool-integrationsDevelopment Workflow

How to Integrate Retool with Visual Studio Code

Use Visual Studio Code alongside Retool to write and test custom JavaScript transformers, Custom Component React code, and query logic locally before pasting into Retool's editor. VS Code also works with the Retool CLI for exporting, version-controlling, and importing Retool app JSON files — giving teams a professional development workflow for Retool apps beyond the browser-only editor.

What you'll learn

  • How to set up VS Code as the local editor for Retool JavaScript transformers and query logic
  • How to install and use the Retool CLI to export and import Retool app definitions from VS Code
  • How to write and debug JavaScript transformers locally in VS Code before deploying to Retool
  • How to develop Retool Custom Components (React) in VS Code using the Retool CLI scaffold
  • How to use VS Code extensions for JavaScript linting and formatting that improve Retool code quality
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner17 min read15 minutesDevOpsLast updated April 2026RapidDev Engineering Team
TL;DR

Use Visual Studio Code alongside Retool to write and test custom JavaScript transformers, Custom Component React code, and query logic locally before pasting into Retool's editor. VS Code also works with the Retool CLI for exporting, version-controlling, and importing Retool app JSON files — giving teams a professional development workflow for Retool apps beyond the browser-only editor.

Quick facts about this guide
FactValue
ToolVisual Studio Code
CategoryDevOps
MethodDevelopment Workflow
DifficultyBeginner
Time required15 minutes
Last updatedApril 2026

Use VS Code to Develop Retool Apps Locally

Retool's browser-based editor is designed for rapid app assembly — drag components, write queries, connect event handlers. But Retool apps can also contain significant amounts of JavaScript: transformer functions that reshape API responses, query logic that joins data from multiple sources, and Custom Components built with React. For non-trivial JavaScript, Retool's browser-based code editor has limitations: no full linting, no local debugging with breakpoints, and no version history beyond Retool's internal snapshot system.

Visual Studio Code fills these gaps. Developers use VS Code to write transformer functions in files with proper JavaScript/TypeScript tooling — ESLint catches bugs before they reach Retool, Prettier enforces consistent formatting, and the browser debugger in VS Code can be used to test logic locally before pasting it into Retool's transformer editor. For teams that want to treat Retool apps as code, the Retool CLI provides app export and import commands that integrate naturally into a VS Code + Git workflow.

This is not a native real-time sync — VS Code does not directly edit live Retool apps. The workflow is: develop locally in VS Code → copy transformer code into Retool, OR use the Retool CLI to export app JSON → edit in VS Code → import the updated JSON. Both patterns are covered here, and teams typically use both depending on whether they are editing isolated JavaScript logic or restructuring the entire app definition.

Integration method

Development Workflow

Visual Studio Code integrates with Retool as a local development companion for writing and testing JavaScript transformer functions, Custom Component code, and complex query logic before deploying it into the Retool browser editor. The Retool CLI (available via npm) enables teams to export Retool app definitions as JSON, version-control them in Git repositories, and import updated versions — creating a full round-trip development workflow between VS Code and Retool Cloud or self-hosted.

Prerequisites

  • Visual Studio Code installed (download from code.visualstudio.com)
  • Node.js 18 or later installed on your machine (required for the Retool CLI)
  • A Retool account (Cloud or self-hosted) with admin access to generate an API token for the Retool CLI
  • Familiarity with JavaScript — Retool transformers and Custom Components are written in JavaScript/React
  • Git installed and configured (recommended for version control of exported Retool app definitions)

Step-by-step guide

1

Set up VS Code for Retool JavaScript development

Install VS Code from code.visualstudio.com if you have not already. Open VS Code and install the following extensions from the Extensions panel (Cmd+Shift+X on Mac, Ctrl+Shift+X on Windows): 1. **ESLint** (dbaeumer.vscode-eslint) — real-time JavaScript error detection and code quality rules. Retool transformers are plain JavaScript, and ESLint catches common bugs like undefined variables, incorrect return statements, and unused imports before you deploy code. 2. **Prettier - Code Formatter** (esbenp.prettier-vscode) — automatic code formatting that enforces consistent style. Retool's built-in editor does not auto-format, so code written locally in VS Code with Prettier will be clean and readable. 3. **JavaScript (ES2022)** syntax highlighting is built into VS Code. No extension needed. 4. **GitLens** (eamodio.gitlens) — enhanced Git history view. Useful for understanding when Retool app JSON files were changed and by whom. Create a workspace folder for your Retool development work, for example ~/projects/retool-dev/. Inside it, create a transformers/ subdirectory for transformer JavaScript files and an apps/ subdirectory for exported Retool app JSON files. Open the workspace folder in VS Code (File → Open Folder). In the workspace root, initialize a Node.js project: open the integrated terminal (Ctrl+`) and run `npm init -y`. Then install development dependencies: `npm install --save-dev eslint prettier`. Create an .eslintrc.json file with basic settings to match Retool's JavaScript environment.

.eslintrc.json
1// .eslintrc.json — ESLint config for Retool transformer development
2{
3 "env": {
4 "es2022": true,
5 "browser": true
6 },
7 "extends": "eslint:recommended",
8 "parserOptions": {
9 "ecmaVersion": 2022
10 },
11 "rules": {
12 "no-unused-vars": "warn",
13 "no-console": "warn",
14 "no-undef": "warn"
15 },
16 "globals": {
17 "data": "readonly",
18 "moment": "readonly",
19 "_": "readonly",
20 "utils": "readonly"
21 }
22}

Pro tip: The `globals` section in .eslintrc.json tells ESLint about Retool's built-in global variables: `data` (transformer input), `moment` (date library), `_` (lodash), and `utils` (Retool utility functions). Without these globals, ESLint will flag references to them as undefined variables — which would be incorrect errors in the context of Retool transformers.

Expected result: VS Code opens the workspace with the ESLint and Prettier extensions active. Creating a new .js file in the transformers/ folder shows real-time linting feedback in the Problems panel.

2

Install the Retool CLI and authenticate

The Retool CLI (retool-cli) is the official command-line tool for managing Retool apps from your terminal. It supports exporting app definitions to JSON, importing updated definitions, listing apps, and scaffolding Custom Components. In VS Code's integrated terminal, install the Retool CLI globally: ``` npm install -g retool-cli ``` Verify installation: ``` retool --version ``` To authenticate the CLI with your Retool instance, generate an API token in Retool: 1. Go to your Retool instance → Settings (gear icon) → API Keys. 2. Click 'Create New API Key'. Give it a name like 'VS Code CLI' and set permissions to Apps (Read and Write). 3. Copy the generated token — it is shown only once. In VS Code's terminal, run: ``` retool login ``` The CLI prompts for your Retool instance URL (e.g., `https://yourcompany.retool.com` for Cloud, or your self-hosted domain) and the API token. Enter both when prompted. The CLI saves these credentials in ~/.retoolrc on your machine. For teams working with Retool self-hosted instances behind a VPN, ensure you are connected to the VPN before running Retool CLI commands — the CLI must reach your Retool instance over HTTPS.

package.json
1// package.json scripts for common Retool CLI operations
2{
3 "scripts": {
4 "retool:export": "retool apps export --name \"My App Name\" --output ./apps/my-app.json",
5 "retool:import": "retool apps import --file ./apps/my-app.json",
6 "retool:list": "retool apps list",
7 "retool:components:scaffold": "retool components scaffold MyComponent --output ./components/"
8 }
9}

Pro tip: Store the Retool API token in a .env file at the workspace root (RETOOL_API_TOKEN=your_token_here) and reference it in your npm scripts using dotenv. Add .env to your .gitignore to prevent the token from being committed to Git. Never hardcode the token in scripts or commit it to a shared repository.

Expected result: Running `retool --version` returns the installed CLI version. Running `retool apps list` returns a list of apps from your Retool instance, confirming successful authentication.

3

Write and test Retool transformer functions locally

The most immediate benefit of using VS Code for Retool development is writing JavaScript transformer functions with proper tooling. Transformers in Retool take query result data as input (`data`) and return a transformed array or object. In your VS Code workspace's transformers/ folder, create a file named `userTransformer.js`. Write the transformer function as if `data` is already defined (matching Retool's transformer runtime): To test the transformer locally without Retool, add a test block at the bottom of the file wrapped in a conditional. Use Node.js to run the file and verify the output before copying it to Retool. For more structured testing, install Jest (`npm install --save-dev jest`) and create corresponding test files in a __tests__/ folder. Each test imports the transformer function and validates its output against sample API response fixtures stored as JSON files. Once the transformer logic is validated locally: 1. Open your Retool app in the browser. 2. Open the relevant query in the Code panel. 3. Go to the query's Advanced tab → enable 'Run transformer' toggle. 4. In the transformer editor, paste the transformer function body (without the `const data =` mock block). 5. Click Save and verify the Table or component data updates correctly. This workflow eliminates the trial-and-error cycle of debugging transformers inside Retool's browser editor, where you would otherwise need to repeatedly trigger queries to see the effect of code changes.

userTransformer.js
1// transformers/userTransformer.js
2// Retool transformer: reshape API user response for display
3// In Retool, 'data' is provided automatically by the query runtime
4
5// For local testing only — remove this block when pasting into Retool:
6const data = require('../data/sample_users.json');
7
8// Transformer function (paste this part into Retool's transformer editor)
9const users = Array.isArray(data) ? data : (data.users || data.results || []);
10
11return users
12 .filter(user => user.status !== 'deleted')
13 .map(user => ({
14 id: user.id || user._id,
15 name: user.name || `${user.first_name} ${user.last_name}`.trim() || 'Unknown',
16 email: (user.email || '').toLowerCase(),
17 status: user.status || 'unknown',
18 plan: user.subscription?.plan || user.plan || 'free',
19 created: user.created_at
20 ? new Date(user.created_at).toLocaleDateString('en-US')
21 : 'N/A',
22 last_active: user.last_seen_at
23 ? new Date(user.last_seen_at).toRelativeString?.() ||
24 new Date(user.last_seen_at).toLocaleDateString()
25 : 'Never'
26 }))
27 .sort((a, b) => a.name.localeCompare(b.name));

Pro tip: Structure your transformer files so the core transformation logic is a named function that you can import in Jest tests. Wrap the `return` statement in a function like `function transformUsers(data) { return data.map(...); }` and add `module.exports = { transformUsers };` at the bottom. This makes the function testable in isolation while still being pasteable into Retool's transformer editor.

Expected result: Running the transformer file with Node.js in VS Code's terminal outputs the expected transformed array. ESLint highlights any issues inline. The function pastes cleanly into Retool's transformer editor and produces correct Table data.

4

Export, version-control, and import Retool apps with the CLI

The Retool CLI's `apps export` command downloads a Retool app's definition as a JSON file that can be opened and edited in VS Code, committed to Git, and imported back into Retool. Export an app: in VS Code's terminal, run: ``` retool apps export --name "My App Name" --output ./apps/my-app.json ``` The exported JSON file contains the complete app definition: component tree, query definitions, event handlers, transformer code, layout settings, and permissions. It is typically hundreds to thousands of lines long. Open it in VS Code and explore the structure — transformer code appears as strings within the JSON. To version-control the exported file: ``` git add apps/my-app.json git commit -m "feat: add date range filter to orders dashboard" ``` To edit transformer code embedded in the exported JSON, use VS Code's search (Cmd+F) to find the transformer by name within the JSON file. Edit the JavaScript string value carefully — be aware that newlines must be escaped as `\n` within JSON strings. To import an updated app definition back into Retool: ``` retool apps import --file ./apps/my-app.json ``` This creates a new version of the app in Retool. Retool keeps version history internally, but the Git history in VS Code provides a more accessible record of what changed, who changed it, and why. For teams where multiple developers modify the same Retool app, establish a convention: the Retool GUI is the source of truth for live app edits, and app exports to Git are snapshots for audit and disaster recovery — not a live bidirectional sync.

.gitignore
1// .gitignore for a Retool development workspace
2node_modules/
3.env
4*.log
5
6# Retool CLI cache
7.retoolrc
8
9# Keep app JSON exports in Git (intentional)
10# apps/*.json <-- do NOT add this, we want to track these files

Pro tip: When reviewing Retool app JSON diffs in VS Code's Git panel (Source Control tab), look for changes in the `queries` array (query SQL or JavaScript changes) and `transformer` fields (transformer function changes) to quickly identify what logic was modified. Component layout changes appear in the `components` array and are harder to review in JSON diff — those are best reviewed in Retool's built-in version history instead.

Expected result: Running `retool apps export` creates a JSON file in the apps/ directory. The file is committed to Git. Running `retool apps import` with the updated JSON reflects the changes in the Retool browser editor.

5

Scaffold and develop a Retool Custom Component in VS Code

Retool Custom Components are fully custom React components that embed directly inside Retool apps. They receive data from Retool queries via props and can trigger Retool queries and event handlers through a model/trigger API. VS Code is the natural IDE for developing Custom Components, which involve React, JSX, and sometimes npm packages. Create a new Custom Component scaffold using the Retool CLI: ``` retool components scaffold MyChart --output ./components/ ``` This creates a component directory with: - `src/index.jsx` — the React component entry point - `package.json` — npm dependencies - `retool.config.json` — component metadata and prop definitions Open the directory in VS Code. Install component dependencies: ``` npm install ``` Edit `src/index.jsx` to implement your component. The scaffold provides the Retool model object with `model` (incoming data from Retool) and `modelUpdate` (function to send data back to Retool). For example: ```jsx import React from 'react'; export default function MyChart({ model, modelUpdate }) { const data = model.chartData || []; return ( <div style={{ height: model.height || 300 }}> {/* Your chart implementation */} </div> ); } ``` Test the component locally: ``` npm run dev ``` Deploy to Retool when ready: ``` retool components deploy ``` After deployment, the Custom Component appears in Retool's Component panel under 'Custom' for use in any app. The source code remains in VS Code and can be version-controlled in Git like any React project.

src/index.jsx
1// src/index.jsx — Retool Custom Component scaffold
2import React, { useEffect, useRef } from 'react';
3
4export default function CustomDataViz({ model, modelUpdate }) {
5 const containerRef = useRef(null);
6
7 // model.data is set by Retool via the component's model binding
8 const chartData = model.data || [];
9 const title = model.title || 'Chart';
10
11 // Notify Retool when user interacts with the component
12 const handleRowClick = (row) => {
13 modelUpdate({ selectedRow: row });
14 };
15
16 return (
17 <div style={{ padding: '16px', fontFamily: 'sans-serif' }}>
18 <h3 style={{ marginBottom: '12px' }}>{title}</h3>
19 <ul style={{ listStyle: 'none', padding: 0 }}>
20 {chartData.map((item, i) => (
21 <li
22 key={i}
23 onClick={() => handleRowClick(item)}
24 style={{ padding: '8px', cursor: 'pointer', borderBottom: '1px solid #eee' }}
25 >
26 {item.label}: {item.value}
27 </li>
28 ))}
29 </ul>
30 </div>
31 );
32}

Pro tip: Custom Components in Retool run in a sandboxed iframe, which means they cannot access the browser's localStorage, call Retool component APIs directly, or access other Retool component values outside the model object. All communication with Retool must happen through the model/modelUpdate pattern. Design your component's interface contract (which props it accepts, what it returns via modelUpdate) before writing the implementation.

Expected result: The Retool CLI deploys the Custom Component to your Retool instance. It appears in the Component panel under 'Custom'. Dragging it onto a Retool canvas and binding data to its model renders the component correctly.

Common use cases

Develop complex Retool transformer logic locally in VS Code

Write JavaScript transformer functions in a local VS Code project with ESLint, Jest unit tests, and full IntelliSense. Test data transformation logic against sample API responses before pasting the final function into Retool's transformer editor. This approach is especially valuable for transformers that join multiple query results, implement complex filtering logic, or reshape deeply nested API responses into flat table-friendly arrays.

Retool Prompt

Set up a VS Code workspace with a transformers/ folder containing individual .js files for each Retool transformer, sample data fixtures in a data/ folder, and Jest tests that validate transformer output before the code is pasted into Retool.

Copy this prompt to try it in Retool

Version-control Retool apps using VS Code and Git

Use the Retool CLI to export Retool app definitions as JSON files into a VS Code workspace, commit them to a Git repository with meaningful commit messages, and maintain a complete version history of app changes. Team leads can review Retool app changes in VS Code using standard Git diff tools before changes are imported back into Retool's live environment.

Retool Prompt

Set up a VS Code project with retool-apps/ containing exported Retool app JSON files, a .gitignore for node_modules, and npm scripts that wrap retool-cli export and import commands for the team's Retool instance.

Copy this prompt to try it in Retool

Build Retool Custom Components in VS Code with React

Develop Retool Custom Components — fully custom React components that embed inside Retool apps — using the Retool CLI scaffold in VS Code. Write component code with JSX syntax highlighting, install npm packages, test the component in isolation, then deploy it to Retool. The Retool CLI handles the build and deployment process from within the VS Code terminal.

Retool Prompt

Use the Retool CLI to scaffold a new Custom Component project in VS Code, build a React chart component using a third-party charting library, test it locally, and deploy it to Retool for use in apps.

Copy this prompt to try it in Retool

Troubleshooting

Retool CLI `retool login` fails with 'Unauthorized' or 'Invalid API key'

Cause: The Retool API key entered during login has insufficient permissions, has been revoked, or was copied incorrectly. The Retool CLI requires an API key with at minimum Apps read/write permissions.

Solution: Go to your Retool instance → Settings → API Keys. Check that the API key you created still exists and has not been revoked. Click 'Create New API Key', select Apps permissions (read and write), and copy the new key. Run `retool logout` in VS Code's terminal to clear the stored credentials, then run `retool login` again with the new key and your instance URL.

ESLint shows 'no-undef' errors for `data`, `moment`, or `_` in transformer files

Cause: These are Retool global variables that are available inside Retool's transformer runtime but are not defined in the local Node.js environment. ESLint does not know about them without configuration.

Solution: Add these identifiers to the `globals` section of your .eslintrc.json file: `"data": "readonly", "moment": "readonly", "_": "readonly", "utils": "readonly"`. This tells ESLint to treat them as globally available without throwing undefined errors. For the `data` variable specifically, also add a mock definition at the top of your local transformer file (wrapped in a conditional) so you can run the file with Node.js for testing.

typescript
1// .eslintrc.json globals section fix
2{
3 "globals": {
4 "data": "readonly",
5 "moment": "readonly",
6 "_": "readonly",
7 "utils": "readonly",
8 "retoolContext": "readonly"
9 }
10}

Retool CLI `apps import` fails with 'App version conflict' or imports an empty/broken app

Cause: The exported JSON was edited manually in VS Code and contains invalid JSON syntax, references components that no longer exist in the Retool schema, or the app name in the JSON does not match an existing app (creating an unintended duplicate).

Solution: Validate the JSON file before importing by running `node -e "require('./apps/my-app.json')"` in VS Code's terminal — any JSON syntax errors will be reported. Avoid manually editing the component tree or query structures in the exported JSON; restrict manual edits to transformer code strings and query SQL. If you need to rename an app, do it through the Retool UI before exporting rather than by editing the JSON.

Best practices

  • Keep transformer functions pure and stateless: they should take the `data` input and return a transformed result without accessing globals beyond Retool's built-ins (moment, _, utils). Pure functions are testable with Jest and produce predictable results every time.
  • Write transformer functions in separate VS Code files with sample data fixtures and Jest tests before pasting them into Retool. A transformer that passes local tests will almost always work correctly in Retool — catching bugs locally is faster than debugging inside the browser editor.
  • Use VS Code's multi-cursor editing (Cmd+D to select multiple identical strings) to consistently rename variables across your transformer files before pasting them into Retool. Inconsistent variable names between the transformer and the components that reference query results cause silent binding failures.
  • Commit exported Retool app JSON files to Git after every significant change with a descriptive message explaining what changed and why. This creates an audit trail for app changes that Retool's internal version history lacks (Retool Cloud keeps 14 days of version history by default).
  • Install the Retool CLI globally but pin the version in your project's package.json devDependencies to prevent team members from running different CLI versions that may produce incompatible export formats.
  • For Custom Components, create a Storybook workspace in VS Code to develop and preview components in isolation before deploying to Retool. Storybook lets you test different model prop combinations (different data shapes, edge cases) without needing to rebuild the Retool app each time.
  • Use VS Code's integrated Git diff viewer to review changes to exported Retool app JSON before committing. Pay particular attention to the `queries` array for SQL changes and the `components` array for layout changes — these are the highest-risk changes in Retool app definitions.
  • Configure VS Code's `editor.formatOnSave` setting to true in your workspace settings, so Prettier automatically formats JavaScript files whenever you save. This ensures transformer code pasted into Retool is consistently formatted and readable.

Alternatives

Frequently asked questions

Can VS Code directly edit a live Retool app in real time?

No. VS Code and Retool do not have a real-time sync connection. The workflow is one of two patterns: write transformer JavaScript locally in VS Code and paste it into Retool's transformer editor manually, or use the Retool CLI to export the app definition as JSON, edit it in VS Code, and import it back. Neither approach is live — changes in VS Code require a manual paste or CLI import step to reach the Retool app.

What is the Retool CLI and how does it differ from the Retool browser editor?

The Retool CLI (retool-cli) is a Node.js command-line tool for managing Retool apps outside the browser. It supports exporting app definitions as JSON, importing updated definitions, listing apps, and scaffolding Custom Components. The browser editor provides a visual drag-and-drop interface for building apps. The CLI is primarily useful for teams that want to version-control app definitions in Git or automate deployment of Retool apps as part of a CI/CD pipeline.

Can I use TypeScript instead of JavaScript for Retool transformers?

Retool's transformer editor accepts plain JavaScript only — it does not compile TypeScript at runtime. However, you can write your transformer logic in TypeScript locally in VS Code, compile it with tsc to a JavaScript string, and paste the compiled output into Retool's transformer editor. For Custom Components (React), the Retool CLI scaffold supports TypeScript and handles compilation before deploying to Retool.

Does the Retool CLI work with self-hosted Retool instances?

Yes. During `retool login`, the CLI prompts for your Retool instance URL — enter your self-hosted domain (e.g., https://retool.yourcompany.com) instead of the Retool Cloud URL. Ensure your machine can reach the self-hosted instance over HTTPS. If the instance is behind a VPN, connect to the VPN before running CLI commands. The Retool API must be enabled on self-hosted instances (it is enabled by default).

How do I debug a Retool transformer that is producing incorrect results?

The fastest approach is to copy the raw query response from Retool's query editor Result tab, save it as a JSON fixture file in VS Code, and run your transformer function against it locally in Node.js. Add console.log statements as needed for debugging — these are visible in VS Code's terminal but not in Retool's browser runtime. Once the transformer produces the expected output locally, paste it back into Retool's transformer editor. Remove any test-only code (mock data assignments, console.logs) before the final paste.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Integrations are where projects stall

We wire Retool integrations like this one every week — auth, webhooks, edge cases included. Fixed-price builds from $13K, delivered in 6–10 weeks.

Talk to an integration engineer

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.