Skip to main content

Adapters

What is an Adapter?

An Adapter defines the target platform for your OpenCore project. It is the central configuration that controls how your code is built, structured, and executed.

They can also add special features and APIs, such as expanding those of the base framework. You should read the special documentation for each adapter to learn more about this.

Adapters abstract platform-specific details so your gameplay code remains portable across different multiplayer runtimes and is needed for Runtime-level of the framework. No optional, by default is node for tests.


Why Adapters Matter

The multiplayer server ecosystem has different runtimes with distinct requirements:

AspectFiveMRageMPRedMNode (Default)
Manifestfxmanifest.luapackage.jsonfxmanifest.luafxmanifest.lua
Server RuntimeNode.jsNode.js 14Node.jsNode.js (any)
Client RuntimeNeutral JSNeutral JSNeutral JSNeutral JS
Output StructureSingle resource folderSplit packages/ + client_packages/Single resource folderSingle resource folder
NUI EnvironmentEmbedded browserWebViewEmbedded browserEmbedded browser

Without adapters, you would need to manage these differences manually. Adapters let you focus on gameplay logic while the CLI handles platform compliance.


Available Adapters

FiveM Adapter

The FiveM adapter targets CitizenFX runtimes (FiveM).

pnpm add @open-core/fivem-adapter

NPM - Github

import { FiveMClientAdapter } from '@open-core/fivem-adapter/client'
import { FiveMServerAdapter } from '@open-core/fivem-adapter/server'

What it configures:

AspectValue
Build target (server)ES2020, CommonJS
Build target (client)ES2020, IIFE, Neutral platform
Output layoutresourceName/server.js, resourceName/client.js
ManifestGenerates fxmanifest.lua automatically
Server platformnode

And extra apis for this enviroment.

When to use:

  • Production FiveM servers
  • When you need fxmanifest.lua compatibility
  • Standard FiveM resource distribution

RageMP Adapter

The RageMP adapter targets Rage Multiplayer.

import { RageMPClientAdapter } from '@open-core/ragemp-adapter/client'
import { RageMPServerAdapter } from '@open-core/ragemp-adapter/server'
pnpm add @open-core/ragemp-adapter

NPM - Github

What it configures:

AspectValue
Build target (server)Node.js 14 compatible
Build target (client)ES2020
Output layoutpackages/{resource}/index.js, client_packages/{resource}/index.js
ManifestNone (uses RageMP package structure)
Server platformnode
Client platformneutral

And extra apis for this enviroment.

When to use:

  • RageMP server projects
  • When you need RageMP-specific output structure
  • Node 14 compatibility requirements

Dependency guidance:

  • Prefer exact versions for critical server runtime packages.
  • Externalize heavy runtime dependencies such as typeorm and pg when they should resolve from the project root at runtime.
  • Be careful with transitive dependencies that may silently drop Node 14 compatibility.

RedM Adapter

Coming Soon

// Not yet available
import { RedMClientAdapter } from '@open-core/redm-adapter/client'
import { RedMServerAdapter } from '@open-core/redm-adapter/server'

RedM-specific optimizations and configurations will be available in a future release.


Node (Default)

The Node adapter is the framework default when no adapter is configured.

// No imports needed - used automatically
export default defineConfig({
name: 'my-project',
// No adapter section = uses Node defaults
})

What it provides:

AspectValue
Build target (server)ES2020, CommonJS
Build target (client)ES2020, IIFE, Neutral platform
Output layoutStandard resource folder
ManifestGenerates fxmanifest.lua

When to use:

  • Local development and testing
  • Standalone scripts
  • Prototyping without a specific platform target
  • CI/CD environments

Configuration

Configure your adapter in opencore.config.ts:

import { defineConfig } from '@open-core/cli'
import { FiveMClientAdapter } from '@open-core/fivem-adapter/client'
import { FiveMServerAdapter } from '@open-core/fivem-adapter/server'

export default defineConfig({
name: 'my-server',
destination: '/path/to/server/resources',
adapter: {
server: FiveMServerAdapter(),
client: FiveMClientAdapter(),
},
core: {
path: './core',
resourceName: 'core',
},
resources: {
include: ['./resources/*'],
},
})

The adapter setting is the runtime switch. Change it to migrate between platforms without rewriting your gameplay code.


Project Initialization

When creating a new project, specify the adapter with --adapter:

# Interactive wizard (prompts for adapter selection)
opencore init my-server

# Non-interactive with specific platform
opencore init my-server --adapter=fivem
opencore init my-server --adapter=ragemp

# No adapter (uses Node defaults)
opencore init my-server --adapter=none

Validation

The CLI validates your adapter configuration automatically:

opencore doctor

This command checks:

  • Adapter is properly configured
  • Required packages are installed
  • Configuration is valid for the selected runtime

Run opencore doctor whenever you:

  • Set up a new machine
  • Change adapter configuration
  • Debug build issues

Quick Reference

AdapterPackageStatusBest For
FiveM@open-core/fivem-adapterStableProduction FiveM servers
RageMP@open-core/ragemp-adapterStableRageMP projects
RedMBuilt-inIn DevelopmentRedM servers
NodeBuilt-inDefaultDevelopment, testing, standalone

Detailed Documentation

For in-depth information about each adapter, including specific features, APIs, and configuration options: