NX

modular TypeScript framework for game servers, with decorator-based service exports.

NX is a modular, monorepo-based framework for building high-performance distributed systems. emphasizes service-oriented architecture, type safety with Zod, and full-stack TypeScript across multiple runtime contexts.

features

  • monorepo architecture

    built with Turborepo and PNPM, the workspace separates concerns between applications, shared libraries, configuration, scripts, and service definitions.

  • resource-based application modules

    each application module (e.g., rc) includes client, server, and shared folders with support for command handlers, event bindings, and service controllers.

  • decorator-based service exposure

    public methods within services are exposed to FiveM’s global runtime using custom decorators and TypeScript metadata reflection.

  • dynamic runtime exports

    server classes dynamically introspect and export services and methods to the FiveM global context for use across modules.

usage

// Example service method export
@ExportedMethod()
kickPlayer(reason: string) {
  // Implementation
}

// Auto-registered and exposed to <NX>.kickPlayer
// Usage example
const NX = exports.NX.useServer()

const nxPlayer = NX.Players.Get(1)

nxPlayer.kickPlayer(reason)

stack

TypeScript, Lua, React, Vite, Zod, Sass, Zustand, MySQL, Esbuild, ESLint