Private package — not published to npm. This package is built and bundled into
@powersync/cli-plugin-config-editduring the build step (pnpm --filter editor buildcopies the output intoplugins/config-edit/editor-dist/). It is served at runtime by that plugin when you runpowersync edit config. It is not intended to be installed or used directly.
The PowerSync CLI Config Studio is the Monaco-powered editor that ships with the powersync edit config command. It exposes the two YAML files managed by the CLI (service.yaml and sync-config.yaml), enforces our official JSON Schemas, and lets you save the result back to your local PowerSync directory without touching the CLI manually.
- Automatic file discovery – the server functions locate
service.yamlandsync-config.yamlusing the JSON blob inPOWERSYNC_PROJECT_CONTEXT(set bypowersync edit config) and expose them over TanStack Start server functions. - Schema-aware authoring – Monaco runs
monaco-yamlwith the schemas from@powersync/cli-schemas, so completions, hover docs, and validation all match the CLI contract. - Unsaved change tracking – changes are stored in an RxJS subject so every route can see which files are pending saves, making the sidebar badges and the editor status consistent.
- Actionable validation – validation markers can be expanded into a details panel that highlights the line and reason that the schema rejected the content.
- Reset + Save controls – users can revert to the upstream file contents or persist the edited version. Saves round-trip through the server function to disk so the CLI immediately sees the change.
- The server layer in
src/utils/files/files.functions.tsreads and writes files with Nodefs, whileSaveFileRequestinsrc/utils/files/files.tsrestricts which YAML files can be touched. useFilesanduseTrackedFilesinsrc/components/hooks/useFiles.tsfetch the latest copy of each file and maintain the in-memory diff state that powers the UI badges.- Monaco is configured in
src/components/MonacoEditor.tsxto load schemas fromsrc/utils/yaml-schemas.tsso validation, formatting, and completions follow the CLI spec. - The sidebar + editor experience lives under
src/routes/fileswith/fileslisting every detected config and/files/$filenamerendering the Monaco instance plus validation details.
The editor talks directly to your filesystem. Always point
POWERSYNC_PROJECT_CONTEXTat a test project unless you intend to edit production config files.
- Install dependencies
pnpm install
- Provide project context – the editor expects
POWERSYNC_PROJECT_CONTEXT(JSON) to describe the linked project. The safest way is to let the CLI set it for you:If you need to run# from the repo root, uses the CLI command to set POWERSYNC_PROJECT_CONTEXT automatically pnpm --filter cli exec powersync edit config --directory /absolute/path/to/powersync --port 3000
pnpm --filter editor dev, export the same env yourself. A minimal self-hosted example:(For full validation, include the real linked metadata; using the CLI command above is preferred.) The dev server runs on http://localhost:3000 by default. Hot reloading works for both React components and server functions.export POWERSYNC_PROJECT_CONTEXT='{"linkedProject":{"projectDirectory":"/absolute/path/to/powersync","linked":{"type":"self-hosted"}}}' pnpm --filter editor dev
- Run tests (optional)
pnpm --filter editor test
pnpm --filter editor build uses Vite/Nitro to emit the production build into .output/ and then runs scripts/copy-editor-dist.mjs to mirror the artifacts into plugins/config-edit/editor-dist/. That folder is what the CLI plugin serves when you run powersync edit config.
pnpm --filter editor build
# copies the contents of packages/editor/.output into plugins/config-edit/editor-distNeed to preview the built bundle exactly like the CLI plugin does? Use Vite preview against the copied dist:
pnpm --filter @powersync/cli-plugin-config-edit exec \
vite preview --host 127.0.0.1 --port 4173 --outDir editor-distOnce the workspace has been built (pnpm build at the repo root), the config-edit plugin exposes:
powersync edit config --directory ./powersync --port 3000Behind the scenes the command defined in plugins/config-edit/src/commands/edit/config.ts sets POWERSYNC_PROJECT_CONTEXT, serves editor-dist with the Nitro server, and opens your browser automatically. Any changes saved in the editor are written straight to the directory you passed via --directory, so the main CLI can immediately consume the updated YAML. Pass --host 0.0.0.0 only when you intentionally need the editor accessible from other hosts.
Refer back to this README whenever you need to adjust scripts, tweak validation behavior, or explain the editor flow to other contributors.