Replace libSQL with Node SQLite - #39
Open
jamesmontemagno wants to merge 2 commits into
Open
Conversation
Use Node's built-in SQLite driver to avoid platform-native libSQL installs while preserving the Drizzle workshop workflow. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 577ec881-eb21-4233-b7ba-5a91e021e274
There was a problem hiding this comment.
Pull request overview
This PR migrates the data layer from the platform-native libSQL client to Node.js’s built-in node:sqlite via Drizzle’s SQLite proxy adapter, keeping the existing schema/migrations/seed flow and injectable helpers while aiming to improve cross-platform setup reliability.
Changes:
- Reworked the Drizzle database client to use
drizzle-orm/sqlite-proxybridged tonode:sqlite, including transactional migration execution. - Updated data-access and migration/test utilities to use the new adapter (
.get()for single-row fetches; proxy migrator wiring for migrations). - Updated docs and tooling metadata for the new SQLite approach + Node 22.13+ requirement, and removed libSQL-specific config/deps.
Show a summary per file
| File | Description |
|---|---|
src/lib/games.ts |
Switches single-row lookup to .get() for the proxy-backed SQLite adapter. |
src/lib/db.ts |
Replaces libSQL client setup with a node:sqlite + Drizzle proxy bridge, plus migration helpers. |
db/test-helpers.ts |
Updates in-memory test DB creation/migrations to use the SQLite proxy migrator. |
db/migrate.ts |
Updates migration runner to use the proxy migrator + atomic execution via DatabaseSync. |
drizzle.config.ts |
Aligns drizzle-kit default DB URL with the new local DB filename. |
README.md |
Updates architecture/setup docs to reflect Node SQLite and the new local DB location. |
CONTRIBUTING.md |
Updates contributor setup requirements and data-layer terminology for Node SQLite. |
package.json |
Adds a Node engine constraint (>=22.13) and removes @libsql/client. |
package-lock.json |
Removes libSQL packages and applies dependency/audit updates (also changes many resolved URLs). |
eslint.config.js |
Removes .data/ ignore in line with the new DB location. |
.gitignore |
Removes .data/ ignore; continues to ignore *.db files. |
.npmrc |
Removes the libSQL registry override. |
.github/workflows/copilot-setup-steps.yml |
Updates workflow comments to reference Node SQLite instead of libSQL. |
.github/skills/quality-checks/SKILL.md |
Updates quality-check guidance for Node SQLite + new DB file name + Node version. |
.github/instructions/unit-tests.instructions.md |
Updates unit test instructions to reference in-memory Node SQLite. |
.github/instructions/drizzle.instructions.md |
Updates Drizzle data-layer guidance to Node SQLite and adds Node 22.13 requirement. |
.github/instructions/astro.instructions.md |
Updates Astro guidance to reference Node SQLite-backed helpers. |
.github/copilot-instructions.md |
Updates repo-level Copilot guidance to reflect Node SQLite and new DB lifecycle wording. |
.github/agents/pr-readiness.md |
Updates PR readiness guidance to reference in-memory Node SQLite for unit tests. |
.devcontainer/devcontainer.json |
Updates devcontainer name to include Node SQLite. |
Review details
- Files reviewed: 18/20 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 577ec881-eb21-4233-b7ba-5a91e021e274
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replace the platform-native libSQL client with Node.js's built-in SQLite driver through Drizzle's SQLite proxy adapter. This preserves the workshop's Drizzle schema, migrations, seed flow, and injectable helpers while making setup reliable across supported Windows and macOS architectures. It also applies the safe npm audit remediation, removing all high-severity findings.
Related Issue
Closes #38
Type of Change
Changes Made
@libsql/clientwithnode:sqlitebehind Drizzle's SQLite proxy adapter.Testing
Data Layer Changes
npm run test:unit- all tests passnpm run db:generate) for any schema change (not applicable; schema unchanged)Frontend Changes
npm run test:e2e- all tests passdata-testidattributes to interactive elements (not applicable; UI unchanged)npm run build)Also ran
npm run typecheck:allandnpm run lint.Checklist
Additional Notes
Node.js 22.13 is the minimum supported version because it is the first Node 22 release where
node:sqliteworks without the experimental SQLite flag. Four moderate, development-only audit findings remain in the deprecateddrizzle-kitesbuild-loader chain; npm's only remediation is a breaking downgrade, so it was intentionally not applied.