SQLite
Official SQLite
driver for StoreCraft
using better-sqlite
package.
npm i @storecraft/database-sqlite
usage
import 'dotenv/config';import http from "node:http";import { App } from '@storecraft/core'import { NodePlatform } from '@storecraft/core/platform/node';import { NodeLocalStorage } from '@storecraft/core/storage/node'import { SQLite } from '@storecraft/database-sqlite'import { migrateToLatest } from '@storecraft/database-sqlite/migrate.js'const app = new App({}).withPlatform(new NodePlatform()).withDatabase(new SQLite({filepath: join(homedir(), 'db.sqlite')})).withStorage(new NodeLocalStorage()).init();await migrateToLatest(app.__show_me_everything.db, false);http.createServer(app.handler).listen(8000,() => {app.print_banner('http://localhost:8000');});
Storecraft will search the following env
variables
SQLITE_FILEPATH=./data.db
So, you can instantiate with empty config
.withDatabase(new SQLite())
Testing Locally
Simply run tests/runner.test.js
npm run database-sqlite:test
All Rights Reserved, storecraft, (2025)