{"id":46520,"library":"station-adapter-sqlite","title":"station-adapter-sqlite","description":"SQLite storage adapter for station-signal using better-sqlite3. Version 1.0.4. Synchronous better-sqlite3 wrapped in async interface matching SignalQueueAdapter. Defaults to WAL mode. Auto-creates tables and indexes. Requires peer dependencies station-signal, station-broadcast, station-schedules. ESM-only, ships TypeScript types. Requires Node >=18.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install station-adapter-sqlite","lang":"bash","label":"npm"},{"cmd":"yarn add station-adapter-sqlite","lang":"bash","label":"yarn"},{"cmd":"pnpm add station-adapter-sqlite","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Synchronous SQLite driver used under the hood","package":"better-sqlite3","optional":false},{"reason":"Peer dependency providing configure and SignalRunner","package":"station-signal","optional":false},{"reason":"Peer dependency for broadcasting","package":"station-broadcast","optional":false},{"reason":"Peer dependency for scheduling","package":"station-schedules","optional":false}],"imports":[{"note":"Package is ESM-only. CommonJS require will fail.","wrong":"const SqliteAdapter = require('station-adapter-sqlite')","symbol":"SqliteAdapter","correct":"import { SqliteAdapter } from 'station-adapter-sqlite'"},{"note":"Use type-only import for TypeScript interfaces to avoid runtime overhead.","wrong":"import { SqliteAdapterOptions } from 'station-adapter-sqlite'","symbol":"SqliteAdapterOptions","correct":"import type { SqliteAdapterOptions } from 'station-adapter-sqlite'"},{"note":"Package does not export a default. Named import only.","wrong":"import SqliteAdapter from 'station-adapter-sqlite'","symbol":"default","correct":"import { SqliteAdapter } from 'station-adapter-sqlite'"}],"quickstart":{"code":"import { configure } from 'station-signal';\nimport { SqliteAdapter } from 'station-adapter-sqlite';\n\n// Configure globally with default options (creates station-signal.db)\nconfigure({ adapter: new SqliteAdapter() });\n\n// With custom options\nconst adapter = new SqliteAdapter({\n  dbPath: process.env.SIGNAL_DB_PATH ?? './data/jobs.db',\n  tableName: 'signal_entries',\n});\n\n// Use in SignalRunner\nimport { SignalRunner } from 'station-signal';\nimport { fileURLToPath } from 'node:url';\n\nconst runner = new SignalRunner({\n  signalsDir: './src/signals',\n  configModule: fileURLToPath(new URL('./adapter.config.ts', import.meta.url)),\n});\n\nawait runner.start();\n\n// Graceful shutdown\nprocess.on('SIGINT', () => {\n  adapter.close();\n  process.exit(0);\n});","lang":"typescript","description":"Configures the SQLite adapter globally, shows custom options, integrates with SignalRunner with configModule, and handles graceful shutdown."},"warnings":[{"fix":"Add 'better-sqlite3' to pnpm.onlyBuiltDependencies in package.json and reinstall.","message":"pnpm 10 blocks lifecycle scripts by default. better-sqlite3 will fail to compile.","severity":"breaking","affected_versions":">=10"},{"fix":"Do not rely on concurrency benefits from async IO; consider offloading to worker threads if many operations.","message":"Methods are async but use synchronous better-sqlite3 under the hood. This can block the event loop.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"N/A","message":"No deprecation warnings issued yet. Adapter is stable as of v1.0.4.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Always specify an absolute path for production deployments.","message":"Default dbPath is 'station-signal.db' relative to CWD. May not be writable in production environments.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure running user has write permissions to the database directory.","message":"WAL mode enabled by default. Table and indexes are created automatically on first use (CREATE TABLE IF NOT EXISTS).","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.4':17 '18':58 'adapt':3,7 'async':24 'auto':33 'auto-cr':32 'better':14,20 'better-sqlite3':13,19 'broadcast':46 'creat':34 'default':28 'depend':40 'esm':51 'esm-on':50 'index':37 'interfac':25 'javascript':59 'match':26 'mode':31 'node':57 'peer':39 'requir':38,56 'schedul':49 'ship':53 'signal':11,43 'signalqueueadapt':27 'sqlite':4,5 'sqlite3':15,21 'station':2,10,42,45,48 'station-adapter-sqlit':1 'station-broadcast':44 'station-schedul':47 'station-sign':9,41 'storag':6 'synchron':18 'tabl':35 'type':55 'typescript':54,60 'use':12 'version':16 'wal':30 'wrap':22","created_at":"2026-06-07T13:00:19.459102+00:00","updated_at":"2026-06-07T13:00:19.459102+00:00","problems":[{"fix":"Add 'better-sqlite3' to pnpm.onlyBuiltDependencies and run pnpm install.","cause":"pnpm 10 blocks lifecycle scripts needed to compile native modules.","error":"The native binary for better-sqlite3 hasn't been compiled."},{"fix":"Use import { SqliteAdapter } from 'station-adapter-sqlite' or switch to ESM.","cause":"Using CommonJS require() on an ESM-only package.","error":"ERR_REQUIRE_ESM: require() of ES Module"},{"fix":"Use new SqliteAdapter() with proper named import.","cause":"Trying to use default import or calling without new.","error":"TypeError: SqliteAdapter is not a constructor"},{"fix":"Install better-sqlite3: pnpm add better-sqlite3 (must compile native binaries).","cause":"better-sqlite3 not installed or platform-specific build missing.","error":"Error: Cannot find module 'better-sqlite3'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"station-adapter-sqlite","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}