@merinaa/client
v0.3.0
Published
Client-side framework for FiveM with decorator-based controllers and NUI bridge
Maintainers
Readme
@merinaa/client
Client-side runtime for the Merinaa FiveM framework. Provides
ClientApplication for registering decorator-based controllers, an NUI
bridge, typed RPC client, and FiveM native helpers.
Install
npm install @merinaa/client @merinaa/core reflect-metadataPeer dependencies: @citizenfx/client, reflect-metadata.
Quick example
// src/client-entry.ts
import 'reflect-metadata';
import { ClientApplication } from '@merinaa/client';
import './modules/hello/client'; // side-effect registers controllers
ClientApplication.getInstance().start();// src/modules/hello/client/hello.client.ts
import { Controller, OnServer } from '@merinaa/core';
@Controller()
export class HelloClientController {
@OnServer('hello:greeted')
onGreeted(message: string): void {
console.log('[Hello]', message);
SendNuiMessage(JSON.stringify({ type: 'hello:open', message }));
}
}
// src/modules/hello/client/index.ts
import { ClientApplication } from '@merinaa/client';
import { HelloClientController } from './hello.client';
ClientApplication.getInstance().registerController(HelloClientController);What's inside
ClientApplication— singleton, registers controllers + tick handlerscreateClient— declarative module loader for multi-module setupsNuiBridge— typed NUI messagingrpcClient— typed RPC calls to the server (rpcClient.controller<T>(...))notification.service,player-local.service— built-in helpers- Native re-exports and streaming utilities
License
MIT
