{"id":44005,"library":"station-adapter-mysql","title":"station-adapter-mysql","description":"MySQL adapter for station-signal and station-broadcast, enabling MySQL-backed message queues and broadcast channels. Current stable version is 1.0.4. No release cadence announced. Key differentiator: integrates with the station ecosystem for typed, scheduled, and broadcasted messages, with TypeScript support. Requires Node.js >= 18 and peer dependencies station-signal, station-schedules, and station-broadcast.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install station-adapter-mysql","lang":"bash","label":"npm"},{"cmd":"yarn add station-adapter-mysql","lang":"bash","label":"yarn"},{"cmd":"pnpm add station-adapter-mysql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for message handling","package":"station-signal","optional":false},{"reason":"Scheduling support","package":"station-schedules","optional":false},{"reason":"Broadcast capability","package":"station-broadcast","optional":false}],"imports":[{"note":"This is a named export, not a default export.","wrong":"import MySQLAdapter from 'station-adapter-mysql'","symbol":"MySQLAdapter","correct":"import { MySQLAdapter } from 'station-adapter-mysql'"},{"note":"ESM-only package; CommonJS require is not supported.","wrong":"const { StationMySQLClient } = require('station-adapter-mysql')","symbol":"StationMySQLClient","correct":"import { StationMySQLClient } from 'station-adapter-mysql'"},{"note":"TypeScript users should prefer type import for types.","wrong":"import { AdapterOptions } from 'station-adapter-mysql'","symbol":"AdapterOptions","correct":"import type { AdapterOptions } from 'station-adapter-mysql'"}],"quickstart":{"code":"import { MySQLAdapter } from 'station-adapter-mysql';\nimport { stationSignal } from 'station-signal';\nimport { stationBroadcast } from 'station-broadcast';\nimport { stationSchedules } from 'station-schedules';\n\nconst adapter = new MySQLAdapter({\n  host: process.env.MYSQL_HOST ?? 'localhost',\n  port: Number(process.env.MYSQL_PORT ?? 3306),\n  user: process.env.MYSQL_USER ?? 'root',\n  password: process.env.MYSQL_PASSWORD ?? '',\n  database: process.env.MYSQL_DATABASE ?? 'station',\n});\n\nawait adapter.initialize();\n\nstationSignal.use(adapter);\nstationBroadcast.use(adapter);\nstationSchedules.use(adapter);\n\n// Send a signal\nstationSignal.send('user.created', { id: 123 });\n\n// Broadcast a message\nstationBroadcast.broadcast('system', 'User created');\n\n// Schedule a job\nstationSchedules.schedule('email.reminder', new Date(Date.now() + 3600000), { userId: 123 });\n\nawait adapter.close();","lang":"typescript","description":"Initialize MySQLAdapter, attach to station-signal, station-broadcast, and station-schedules, then use each for sending signals, broadcasting, and scheduling."},"warnings":[{"fix":"Update to v1.0.0 and follow the new configuration format with host, user, password, database, and port.","message":"Version 1.0.0 introduced breaking changes in the adapter configuration interface.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Call await adapter.initialize() before using stationSignal.use() or similar.","message":"The initialize() method is now required before using adapter with any station module. Previously it was optional.","severity":"deprecated","affected_versions":">=0.5.0 <1.0.0"},{"fix":"Use import statements only. Ensure your project is configured for ESM (type: 'module' in package.json) or use dynamic import().","message":"ESM-only: The package uses ES modules and does not support CommonJS require(). Attempting to require() will throw a ModuleNotFound error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Install exact peer dependency versions: npm install station-signal@1.0.4 station-schedules@1.0.4 station-broadcast@1.0.4","message":"Peer dependencies must be exactly version 1.0.4. Using different versions may cause runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to version 18 or higher.","message":"Node.js >= 18 required. Versions of Node < 18 will not work due to ESM and newer APIs.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.4':28 '18':51 'adapt':3,6 'announc':32 'back':18 'broadcast':14,22,44,64 'cadenc':31 'channel':23 'current':24 'depend':54 'differenti':34 'ecosystem':39 'enabl':15 'integr':35 'javascript':65 'key':33 'messag':19,45 'mysql':4,5,17 'mysql-back':16 'node.js':50 'peer':53 'queue':20 'releas':30 'requir':49 'schedul':42,60 'signal':10,57 'stabl':25 'station':2,9,13,38,56,59,63 'station-adapter-mysql':1 'station-broadcast':12,62 'station-schedul':58 'station-sign':8,55 'support':48 'type':41 'typescript':47,66 'version':26","created_at":"2026-06-05T17:02:31.215401+00:00","updated_at":"2026-06-05T17:02:31.215401+00:00","problems":[{"fix":"Use import instead of require. If you must use require, use dynamic import: const { MySQLAdapter } = await import('station-adapter-mysql');","cause":"Package is ESM-only; require() does not work.","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'station-adapter-mysql'"},{"fix":"Ensure you call await adapter.initialize() after constructing the adapter.","cause":"Trying to use adapter without calling initialize() or using an older version where initialize was not required.","error":"TypeError: adapter.initialize is not a function"},{"fix":"Install the exact peer dependency version: npm install station-signal@1.0.4","cause":"Peer dependency version mismatch; package requires exact 1.0.4.","error":"Error: Cannot find module 'station-signal' satisfying version ^1.0.3"},{"fix":"Use named import: import { MySQLAdapter } from 'station-adapter-mysql';","cause":"Using default import instead of named import.","error":"TypeError: MySQLAdapter is not a constructor"}],"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-mysql","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}}