{"library":"signalk-server","title":"Signal K Server","description":"Signal K Server is an open-source Node.js application that functions as a central data hub for marine electronics, implementing the Signal K standard for boats. It aggregates data from various sources such as NMEA 0183, NMEA 2000, and SeaTalk, then makes this information available to other applications and devices via WebSockets and HTTP APIs. Currently at stable version 2.25.0, the project maintains an active release cadence with frequent minor and patch updates, often including beta versions, addressing features, fixes, and performance improvements. Key differentiators include its role as a vendor-agnostic data standard implementer, its extensibility through a robust plugin architecture, and its ability to run efficiently on embedded hardware like Raspberry Pis and Victron Cerbo GX devices. It enables a wide range of functionalities such as serving as a wireless AIS and navigation hub for popular marine apps, providing anchor watches, functioning as a weather station, and generating automatic logbooks.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install signalk-server"],"cli":{"name":"signalk-server","version":null}},"imports":["import { start } from 'signalk-server'","import { stop } from 'signalk-server'","import { Server } from 'signalk-server/lib/server'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { start, stop } from 'signalk-server';\nimport path from 'path';\nimport { fileURLToPath } = from 'url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nasync function runSignalKServer() {\n  const serverConfig = {\n    port: 3000,\n    // For a minimal example, the server will use its default paths for plugins, webapps, etc.\n    // In a production application or custom setup, you might specify:\n    // configPath: path.join(__dirname, 'my-config'),\n    // pluginsPath: path.join(__dirname, 'my-plugins'),\n    // security: { strategy: 'none' } // Use with caution; disables security for development\n  };\n\n  console.log(`Attempting to start Signal K server on port ${serverConfig.port}...`);\n  let serverInstance;\n  try {\n    // The start function returns a server object which contains the express app and other components\n    serverInstance = await start(serverConfig);\n    console.log(`Signal K Server is running on http://localhost:${serverConfig.port}`);\n    console.log(`Admin UI available at http://localhost:${serverConfig.port}/admin`);\n    console.log('Press Ctrl+C to stop the server.');\n\n    // Keep the process alive until SIGINT (Ctrl+C) is received\n    process.on('SIGINT', async () => {\n      console.log('\\nReceived SIGINT. Shutting down Signal K server...');\n      if (serverInstance) {\n        await stop(serverInstance);\n        console.log('Signal K server has been stopped.');\n      }\n      process.exit(0);\n    });\n\n  } catch (error) {\n    console.error('Failed to start Signal K server:', error.message);\n    if (error.code === 'EADDRINUSE') {\n      console.error(`Port ${serverConfig.port} is already in use. Please choose another port or stop the conflicting process.`);\n    }\n    process.exit(1);\n  }\n}\n\nrunSignalKServer();","lang":"typescript","description":"Demonstrates how to programmatically start and stop a Signal K server instance with a basic configuration, listening on a specified port. This is useful for embedding or testing.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}