Requirements
@powersync/capacitor0.10.0 or later.- Vite 7 or later. The Vite dev server must serve your app.
Set Up DevTools
1
Install the packages
2
Add the plugin
In The app on the simulator or emulator loads from the port that you give to
vite.config.ts, enable Vite DevTools, add the PowerSync plugin, and configure the dev server:npx cap run. By default, if that port is in use, Vite starts on the next free port, and the app cannot reach the dev server. With strictPort: true, Vite exits with an error instead.The devtools option requires Vite 8.3 or later. If you use Vite 7, use the DevTools() plugin. Refer to PowerSync DevTools for Vite.3
Optional: Enable diagnostics when you connect
To show the total number of operations for each bucket in the Buckets tab, set
diagnostics: true when you connect:4
Run the app with live reload
Start the dev server. Then run the app on a simulator or emulator. Use the port that you set in
server.port.- iOS simulator
- Android emulator
5
Trust the app and open DevTools
Vite DevTools must trust each WebView before it shows data. To trust the app on the simulator or emulator:
- In the app, tap Unauthorized in the Vite DevTools dock.
- Find the six-digit code in the dev server terminal. Below the code, the terminal shows the user agent of the client that asked for it, for example
iOS 18.7 mobile. - Type the code in the app.
- Open the link that the dev server terminal shows next to the code. The link opens in your default browser and trusts that browser. You cannot use the link to trust the app, because the link does not open in the app.
- In that browser, open
http://localhost:5173/__devtools/. The app on the simulator or emulator is attached as a database. If more than one database is attached, select one in the database list in the DevTools header.
MCP Tools
Coding agents use the Vite MCP endpoint to read the database of the app on the simulator or emulator. Keep the app open with live reload while the agent uses the tools.Troubleshooting
DevTools shows “No PowerSync database attached”. Sometimes the database of the app detaches from DevTools and does not attach again. To attach it again, close the app and open it again. Requests to your backend fail during live reload. With live reload, the app loads fromhttp://localhost:5173, not from the device. If your backend allows only specific origins (CORS), add this address. Or send the requests through the dev server with server.proxy.