{"id":42846,"library":"hemera-sql-store","title":"Hemera SQL Store","description":"Generic SQL client for the Hemera microservices framework using Knex. Version 7.0.0 is the latest stable release. This package provides a store pattern for SQL databases, supporting MySQL, MariaDB, SQLite, and PostgreSQL via Knex. It integrates with Hemera's plugin system and optionally with Hemera-Joi for validation. The package requires a Nats connection for Hemera and a Knex configuration. It wraps Knex to provide CRUD operations within the Hemera pattern. The release cadence is irregular; this version supports Hemera v7.","status":"active","version":"7.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/hemerajs/hemera-sql-store","tags":["javascript","hemera","sql","mariadb","mysql"],"install":[{"cmd":"npm install hemera-sql-store","lang":"bash","label":"npm"},{"cmd":"yarn add hemera-sql-store","lang":"bash","label":"yarn"},{"cmd":"pnpm add hemera-sql-store","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency; requires Hemera and Nats to function.","package":"hemera","optional":false},{"reason":"Used for SQL query building and execution.","package":"knex","optional":false},{"reason":"MySQL driver for Knex; required for MySQL/MariaDB.","package":"mysql","optional":true}],"imports":[{"note":"The package provides a CommonJS default export. ESM import may not work directly without a bundler or Node.js ESM support.","wrong":"import hemeraSqlStore from 'hemera-sql-store'","symbol":"default","correct":"const hemeraSqlStore = require('hemera-sql-store')"},{"note":"The first argument to hemera.use should be the required module, not a string.","wrong":"hemera.use('hemera-sql-store', { knex: { ... } })","symbol":"plugin usage","correct":"hemera.use(require('hemera-sql-store'), { knex: { ... } })"},{"note":"Joi support is provided by the separate 'hemera-joi' package, not bundled here.","wrong":"hemera.use(require('hemera-sql-store-joi'))","symbol":"Joi integration","correct":"hemera.use(require('hemera-joi'))"}],"quickstart":{"code":"const Hemera = require('nats-hemera');\nconst Nats = require('nats');\nconst hemera = new Hemera(new Nats(), { logLevel: 'info' });\n\nhemera.use(require('hemera-joi'));\nhemera.use(require('hemera-sql-store'), {\n  knex: {\n    dialect: 'mysql',\n    connection: {\n      host: '127.0.0.1',\n      user: 'root',\n      password: 'password',\n      database: 'test'\n    }\n  }\n});\n\nawait hemera.ready();\n\nconst result = await hemera.act({\n  topic: 'sql-store',\n  cmd: 'create',\n  table: 'users',\n  data: { name: 'Alice', email: 'alice@example.com' }\n});\nconsole.log('Inserted:', result);","lang":"javascript","description":"Shows how to initialize Hemera with Nats, register the SQL store plugin, and perform a create operation."},"warnings":[{"fix":"Ensure you use the correct version of Hemera (v7) and follow the new plugin pattern.","message":"Hemera v7 introduced breaking changes in plugin API.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Install 'mysql', 'pg', or 'sqlite3' as needed.","message":"The package no longer bundles a SQL driver; you must install one separately.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Ensure a Nats server is running and the connection options are correct.","message":"Missing Nats connection will cause 'ECONNREFUSED' error.","severity":"gotcha","affected_versions":"*"},{"fix":"Verify that the host, port, user, password, and database are valid.","message":"The 'knex' option must include 'connection' object with correct credentials.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'7.0.0':15 'cadenc':78 'client':6 'configur':64 'connect':58 'crud':70 'databas':29 'framework':11 'generic':4 'hemera':1,9,41,49,60,74,84,87 'hemera-joi':48 'integr':39 'irregular':80 'javascript':86 'joi':50 'knex':13,37,63,67 'latest':18 'mariadb':32,89 'microservic':10 'mysql':31,90 'nat':57 'oper':71 'option':46 'packag':22,54 'pattern':26,75 'plugin':43 'postgresql':35 'provid':23,69 'releas':20,77 'requir':55 'sql':2,5,28,88 'sqlite':33 'stabl':19 'store':3,25 'support':30,83 'system':44 'use':12 'v7':85 'valid':52 'version':14,82 'via':36 'within':72 'wrap':66","created_at":"2026-06-05T16:56:57.442012+00:00","updated_at":"2026-06-05T16:56:57.442012+00:00","problems":[{"fix":"Run 'npm install knex' in your project.","cause":"'knex' is a peer dependency and must be installed explicitly.","error":"Error: Cannot find module 'knex'"},{"fix":"Run 'npm install mysql' (or appropriate driver).","cause":"The MySQL driver is not installed.","error":"Error: Cannot find module 'mysql'"},{"fix":"Install 'mysql' package and ensure it's in node_modules.","cause":"The MySQL driver is missing or incorrectly installed.","error":"Error: Knex: dialect mysql not found"},{"fix":"Start your MySQL or MariaDB server, or change the connection host/port.","cause":"No MySQL server is running at the specified address.","error":"Error: connect ECONNREFUSED 127.0.0.1:3306"}],"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":"https://github.com/hemerajs/hemera-sql-store#readme","github":"ssh://git@github.com/hemerajs/hemera-sql-store","docs":null,"changelog":null,"pypi":null,"npm":"hemera-sql-store","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-05","next_check":"2026-09-03","install_tag":null}}