{"id":42332,"library":"xcraft-core-server","title":"Xcraft Core Server","description":"The central server module of the Xcraft framework. As of v6.5.0, it orchestrates startup, automatic module discovery, and lifecycle management for the entire Xcraft ecosystem. Release cadence is monthly. Key differentiators include automatic scanning of node_modules for compatible Xcraft modules, recursive dependency resolution, and dual daemon/library execution modes with built-in heartbeat and transport routing. It integrates tightly with xcraft-core-bus, xcraft-core-busclient, and goblin-* actor modules.","status":"active","version":"6.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/Xcraft-Inc/xcraft-core-server","tags":["javascript","xcraft","server"],"install":[{"cmd":"npm install xcraft-core-server","lang":"bash","label":"npm"},{"cmd":"yarn add xcraft-core-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add xcraft-core-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"core communication bus used by all modules","package":"xcraft-core-bus","optional":false},{"reason":"client connection to the bus","package":"xcraft-core-busclient","optional":false},{"reason":"module configuration loading","package":"xcraft-core-etc","optional":true},{"reason":"message transport and routing","package":"xcraft-core-transport","optional":true},{"reason":"automatic integration if hordes configured","package":"xcraft-core-horde","optional":true}],"imports":[{"note":"CommonJS only; no ESM export.","wrong":"import xServer from 'xcraft-core-server';","symbol":"default","correct":"const xServer = require('xcraft-core-server');"},{"note":"Options object is optional but recommended for logging and error handling.","wrong":"xServer.runAsDaemon();","symbol":"runAsDaemon","correct":"xServer.runAsDaemon({logs: true, response: (err) => {}});"},{"note":"The library mode requires a callback to handle errors.","wrong":"xServer.runAsLib().start();","symbol":"runAsLib","correct":"const lib = xServer.runAsLib(); lib.start(callback);"}],"quickstart":{"code":"const xServer = require('xcraft-core-server');\n\n// Start as daemon\nxServer.runAsDaemon({\n  logs: true,\n  response: (err) => {\n    if (err) {\n      console.error('Startup error:', err);\n    } else {\n      console.log('Server started');\n    }\n  },\n});\n\n// Or as library\nconst lib = xServer.runAsLib();\nlib.start((err) => {\n  if (err) {\n    console.error('Library start error:', err);\n  } else {\n    console.log('Library server started');\n  }\n});\n","lang":"javascript","description":"Shows how to start the Xcraft server in both daemon and library modes with error handling."},"warnings":[{"fix":"Use the blacklist or filter configuration to exclude irrelevant modules.","message":"Module discovery scans node_modules recursively which can be slow in large projects.","severity":"gotcha","affected_versions":"<=6.5.0"},{"fix":"Always pass an options object with at least `logs` and `response`.","message":"The `runAsDaemon` without options object still works but may be deprecated in future releases.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Always call `lib.start(callback)` after creating the library instance.","message":"Running as library without calling `start()` will leave the server in an uninitialized state.","severity":"gotcha","affected_versions":"all"},{"fix":"Update calls to pass `{logs: true, response: callback}` instead of just a function.","message":"In v6.0.0, the `runAsDaemon` signature changed from callback-only to options object.","severity":"breaking","affected_versions":">=6.0.0"}],"env_vars":null,"search_vec":"'actor':75 'automat':18,36 'built':55 'built-in':54 'bus':68 'busclient':72 'cadenc':30 'central':5 'compat':42 'core':2,67,71 'daemon/library':50 'depend':46 'differenti':34 'discoveri':20 'dual':49 'ecosystem':28 'entir':26 'execut':51 'framework':11 'goblin':74 'heartbeat':57 'includ':35 'integr':62 'javascript':77 'key':33 'lifecycl':22 'manag':23 'mode':52 'modul':7,19,40,44,76 'month':32 'node':39 'orchestr':16 'recurs':45 'releas':29 'resolut':47 'rout':60 'scan':37 'server':3,6,79 'startup':17 'tight':63 'transport':59 'v6.5.0':14 'xcraft':1,10,27,43,66,70,78 'xcraft-core-bus':65 'xcraft-core-buscli':69","created_at":"2026-06-04T18:56:44.930431+00:00","updated_at":"2026-06-04T18:56:44.930431+00:00","problems":[{"fix":"Use `require('xcraft-core-server')` instead of relative path.","cause":"Incorrect require path due to monorepo symlink issues.","error":"Error: Cannot find module '../lib/boot'"},{"fix":"Update to v5.0.0 or later, or use `require('xcraft-core-server').runAsLib`.","cause":"Using an older version that only exports daemon mode.","error":"TypeError: xServer.runAsLib is not a function"},{"fix":"Configure a blacklist in options or use environment variable XCRAFT_MODULE_BLACKLIST.","cause":"Too many modules in node_modules causing slow scan.","error":"Timeout waiting for module discovery to complete"}],"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/Xcraft-Inc/xcraft-core-server#readme","github":"https://github.com/Xcraft-Inc/xcraft-core-server","docs":null,"changelog":null,"pypi":null,"npm":"xcraft-core-server","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}