npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@urban-mp/rpc

v0.1.9

Published

FiveM RPC is an all-in-one package with asynchronous RPC implementation for FiveM servers in JS/TS

Readme

FiveM RPC

Small Promise-based RPC for FiveM server, client, and cef runtimes.

Installation

npm install @urban-mp/rpc

Create An Instance

Create one instance per runtime.

import { RPC } from '@urban-mp/rpc'

export const rpc = new RPC({ env: 'server' }).get()
export const rpc = new RPC({ env: 'client' }).get()
export const rpc = new RPC({ env: 'cef' }).get()

resourceName is optional. Server/client default to GetCurrentResourceName(), and CEF defaults to GetParentResourceName().

export const rpc = new RPC({
	env: 'cef',
	resourceName: 'my_resource',
}).get()

Register Events

Use register everywhere.

rpc.register('profile:get', async userId => {
	return getProfile(userId)
})

On server, handlers receive player as the first argument when the call comes from client or cef.

rpc.register('inventory:get', async (player, itemId) => {
	return getInventoryItem(player, itemId)
})

Call Events

Use call(targetEnv, eventName, ...args) everywhere.

const profile = await rpc.call('server', 'profile:get', userId)

From CEF, pass resourceName before eventName to call a handler registered in another resource. The NUI HTTP request still goes through the parent NUI resource, but the RPC payload targets resourceName.

const result = await rpc.call(
	'server',
	'core',
	'server:player:account:login',
	{ name: 'cataadv', password: '12' },
)

Server calls to a player runtime use eventName before player.

await rpc.call('client', 'hud:setVisible', player, true)
await rpc.call('cef', 'modal:open', player, { id: 'inventory' })

Call Matrix

| From | To | Example | | --- | --- | --- | | Server | Server | rpc.call('server', 'cache:flush') | | Server | Client | rpc.call('client', 'hud:getState', player) | | Server | CEF | rpc.call('cef', 'modal:open', player, payload) | | Client | Server | rpc.call('server', 'profile:get', userId) | | Client | Client | rpc.call('client', 'player:getPosition') | | Client | CEF | rpc.call('cef', 'settings:get', key) | | CEF | Server | rpc.call('server', 'profile:save', payload) | | CEF | Server resource | rpc.call('server', 'core', 'profile:save', payload) | | CEF | Client | rpc.call('client', 'camera:getMode') | | CEF | Client resource | rpc.call('client', 'hud', 'camera:getMode') | | CEF | CEF | rpc.call('cef', 'theme:get') |

Broadcast From Server

Server can call all clients with callClientEveryone.

await rpc.callClientEveryone('my_resource', 'hud:announce', 'Hello')

Configuration

type RPCConfig = {
	env: 'server' | 'client' | 'cef'
	debug?: boolean
	resourceName?: string
}

Errors

| Error | Meaning | | --- | --- | | EVENT_NOT_REGISTERED | The target runtime has no handler for that event. | | INVALID_DATA | The received payload could not be parsed. | | NO_PLAYER | FiveM could not resolve the player. | | UNKNOWN_ENVIRONMENT | The env is not server, client, or cef. |

Exports

import { RPC, RPCFactory } from '@urban-mp/rpc'