Registry / gaming / xcraft-server

xcraft-server

JSON →
library5.2.0jsnpmunverified

Standalone server for the Xcraft ecosystem, version 5.2.0. Provides a self-contained runtime environment for Xcraft game servers with integrated module loading and lifecycle management. Designed for headless server deployments, it handles authentication, world persistence, and client connections out of the box. Released irregularly alongside the Xcraft monorepo. Differentiators: zero-config setup, plugin-based extensibility, and built-in mod support compared to manual CraftBukkit setups.

npm install xcraft-server
INSTALL
IMPORT
SIG · XCRAFT-SERVER
X
xcraft-server
gamingjavascriptv5.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createServer
import { createServer } from 'xcraft-server'
const createServer = require('xcraft-server')
ESM-only since v5; CommonJS require() throws ERR_REQUIRE_ESM.
XcraftServer
import { XcraftServer } from 'xcraft-server'
import XcraftServer from 'xcraft-server'
Named export, not default. TypeScript types available.
ServerConfig
import type { ServerConfig } from 'xcraft-server'
Type import for TypeScript projects; not a runtime value.

Creates and starts an Xcraft server instance with environment-based configuration, including port, world directory, and max players.

import { createServer } from 'xcraft-server'; const server = createServer({ port: parseInt(process.env.PORT ?? '25565'), worldDir: process.env.WORLD_DIR ?? './world', maxPlayers: parseInt(process.env.MAX_PLAYERS ?? '20'), }); server.on('error', (err) => { console.error('Server error:', err); process.exit(1); }); server.start().then(() => { console.log('Server running on port', server.port); }).catch((err) => { console.error('Failed to start:', err); process.exit(1); });
Debug
Known issues
breakingESM-only starting from version 5.0.0. CommonJS require() will not work.
fix
Convert project to ESM ("type": "module" in package.json) or use dynamic import().
affects: >=5.0.0
breakingconstructor server options changed in version 4.0.0: worldPath renamed to worldDir, maxConnections renamed to maxPlayers.
fix
Update configuration object keys to new names.
affects: >=4.0.0
deprecatedThe server.setMotd() method is deprecated since v5.0.0. Use server.motd property instead.
fix
Replace server.setMotd('message') with server.motd = 'message'.
affects: >=5.0.0
gotchaNode.js 14 is the minimum engine; using older versions causes cryptic errors.
fix
Upgrade to Node.js >=14.
affects: <14.0.0
gotchaThe server does not support IPv6 addresses in the port configuration; only IPv4 is accepted.
fix
Use IPv4 or bind to all interfaces ('0.0.0.0').
affects: <5.2.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Using CommonJS require() with an ESM-only package (xcraft-server >=5.0.0).
fix
Use import syntax or convert project to ESM.
TypeError: server.start is not a function
Importing XcraftServer class instead of createServer factory, or misapplying start method.
fix
Use createServer(options) and call start() on the returned instance.
Error: listen EADDRINUSE: address already in use :::25565
Port already occupied by another process; server crashed previously.
fix
Kill process using the port or set a different PORT environment variable.
Upgrade
Version history
5.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
41 hits · last 30 days
node
40
Resources
xcraft-server — npm install xcraft-server · libregistry