From 14c2921f5e69160347d8132b4ef3e1ffe18f7f7d Mon Sep 17 00:00:00 2001 From: Mike Yumatov Date: Fri, 19 Jun 2026 12:47:16 +0300 Subject: [PATCH] feat: persist dev backend SQLite between runs 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 .sqlite file per plugin and reuses them across restarts. Gitignore the .data directory. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 3 +++ README.md | 7 +++++++ app-config.yaml | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 221de7e..2b01599 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ node_modules/ /dist-types *.tsbuildinfo dist/ + +# Persisted local dev backend database (better-sqlite3) +/.data/ diff --git a/README.md b/README.md index 614f137..baddf13 100644 --- a/README.md +++ b/README.md @@ -95,3 +95,10 @@ yarn install yarn workspace @rwdocs/backstage-plugin-rw run build yarn workspace @rwdocs/backstage-plugin-rw-backend run build ``` + +Run the dev harness (frontend + backend) with `yarn dev`. + +The backend persists its SQLite database (catalog, search index, …) under a +`.data/` directory at the repo root, so state survives restarts instead of being +rebuilt from scratch each time. The directory is git-ignored. Delete it +(`rm -rf .data`) for a clean database. diff --git a/app-config.yaml b/app-config.yaml index 19ef3f6..ad7e8a5 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -10,7 +10,13 @@ backend: dangerouslyDisableDefaultAuthPolicy: true database: client: better-sqlite3 - connection: ':memory:' + connection: + # Persist the dev DB between runs (catalog, search index, …) instead of + # rebuilding from scratch on every start. Resolved relative to the backend + # process cwd (packages/backend), so ../../ points at the repo root. + # Backstage writes one .sqlite file per plugin in this directory. + # Remove the directory (rm -rf .data) for a clean database. + directory: ../../.data cors: origin: http://localhost:3000 credentials: true