Skip to content

Project

NX

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....

Description

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.

Goals

  • Provide a scalable, modular architecture for distributed TypeScript system development.
  • Support strong typing and shared validation schemas across server, client, and shared logic.
  • Improve developer experience with tooling, automation, and structured service boundaries.

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)
    

Learning outcomes

  • Designed a modular, service-based framework targeting game server infrastructure.
  • Built runtime-safe service exports using decorators and reflection metadata.
  • Applied modern monorepo practices to manage application topologies.