Skip to content

feat: persist dev backend SQLite between runs#66

Merged
yumike merged 1 commit into
mainfrom
worktree-persist-backend-sqlite
Jun 19, 2026
Merged

feat: persist dev backend SQLite between runs#66
yumike merged 1 commit into
mainfrom
worktree-persist-backend-sqlite

Conversation

@yumike

@yumike yumike commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Problem

The dev harness configured the Backstage backend DB as better-sqlite3 with connection: ':memory:', so the catalog and search index were rebuilt from scratch on every restart.

(The rw engine's own SQLite — the comments store — was a red herring: it's already persisted at .rw/comments/sqlite.db and the backend plugin doesn't open it.)

Change

Point better-sqlite3 at a directory instead of :memory:, so Backstage writes one persistent <pluginId>.sqlite file per plugin (catalog.sqlite, search.sqlite, …) and reuses them across restarts.

  • app-config.yamlconnection: { directory: ../../.data }. The path is resolved relative to the backend process cwd (packages/backend, since backstage-cli does no chdir), so ../../ lands at the repo root.
  • .gitignore — ignore /.data/.
  • README.md — document yarn dev and the new .data/ persistence (delete it to reset).

Verification

  • Confirmed against the installed @backstage/backend-defaults source that the multi-plugin backend requires connection.directory (a base filename to a real file throws), auto-creates the dir, and writes/reuses one file per plugin.
  • Verified the relative-path math: from cwd packages/backend, ../../.data resolves to repo-root .data/.
  • Live app boot left to the reviewer (those commands run long).

🤖 Generated with Claude Code

The dev harness configured the Backstage backend DB as
better-sqlite3 with connection ':memory:', so the catalog and
search index were rebuilt from scratch on every restart.

Point better-sqlite3 at a directory (../../.data, resolved from the
backend cwd packages/backend to the repo root) so Backstage writes
one persistent <pluginId>.sqlite file per plugin and reuses them
across restarts. Gitignore the .data directory.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yumike yumike merged commit 3713fdf into main Jun 19, 2026
1 check passed
@yumike yumike deleted the worktree-persist-backend-sqlite branch June 19, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant