Client-side SQLite editor: React 19 + TypeScript + Vite 8 + Tailwind 4 +
Zustand + sql.js in a web worker.
- Start with
README.md,package.json,biome.json,vite.config.ts, andtsconfig*.json. - Then read the nearest scoped instructions when working under:
src/AGENTS.mdsrc/components/AGENTS.mdsrc/components/browse-tab/AGENTS.mdsrc/components/execute-tab/AGENTS.mdsrc/components/structure-tab/AGENTS.mdsrc/components/ui/AGENTS.mdsrc/hooks/AGENTS.mdsrc/lib/AGENTS.mdsrc/providers/worker/AGENTS.mdsrc/sqlite/AGENTS.mdsrc/store/AGENTS.md
- Install:
npm install - Dev server:
npm run dev - Tests:
npm test(single run) /npm run test:watch(watch mode) - Full check:
npm run check - Build app:
npm run build(typecheckruns first) - Build GitHub Pages variant:
npm run build:pages - Unused-file/deps check:
npm run knip - React diagnostics:
npm run doctor
- Preferred for small edits:
npx biome check <changed-files> - Run related tests:
npx vitest run <path>ornpm testfor the full suite - Format-only check for one file:
npx biome check --formatter-enabled=true --linter-enabled=false --assist-enabled=false <file> - Lint one file/folder:
npx biome lint <path> - Typecheck only:
npm run typecheck - Recommended sequence after edits:
npx biome check <changed-files>npx vitest run src/__tests__/<test-path>(find the matching test under__tests__)npm run build
- If you changed entrypoints, imports, or dead code boundaries, also run
npm run knip.
- Vitest is the test runner (jsdom environment, setup in
src/test/setup.ts). Test files live insrc/__tests__/, mirroring the source tree. Run the full suite withnpm test, or target files withnpx vitest run <path>. - Biome is the formatter and linter. Let Biome own import organization.
- TypeScript is strict;
buildandbuild:pagesboth runtsc -bfirst. vite.config.tssetsbaseto/sqlite-online/only inpagesmode.
- App entrypoint is
src/main.tsx: it initializes API key storage, then mountsStrictMode > ErrorBoundary > ThemeProvider > PanelProvider > DatabaseWorkerProvider > App.AppToasteris a sibling ofPanelProviderinsideThemeProvider. src/App.tsxis the top-level tab shell.ExecuteTabandStructureTabare lazy-loaded; keep them lazy unless the task requires otherwise.- Browser UI never talks to SQLite directly. UI actions go through
src/providers/worker/WorkerProvider.tsxintosrc/sqlite/sqliteWorker.ts. src/types/(split intoindex.tsfor domain types andworker-protocol.tsfor worker protocol types) is the source of truth for type definitions.src/store/useDatabaseStore.tsis the main app state store. Use selectors and existing store actions before adding new state.
- Prefer
@/imports across directories; use relative imports within the same folder. - Keep CSS side-effect imports first, matching
src/main.tsx. sqliteWorker.tsis protocol glue; avoid changing it unless the worker message contract changes.- Add SQL helpers in
src/sqlite/sqlUtils.ts, not inline insrc/sqlite/core.ts. - Keep worker/store/provider changes aligned: protocol updates usually require
coordinated edits across
@/types, worker runtime, message handler, and provider actions.