Skip to main content

xrift.json Configuration

Item settings are stored in xrift.json at the project root, under the item key (the same file used for worlds).

Example

{
"item": {
"distDir": "./dist",
"title": "My Item",
"description": "A sample item",
"thumbnailPath": "thumbnail.png",
"buildCommand": "npm run build",
"ignore": [
"**/.DS_Store",
"**/Thumbs.db",
"**/*.map"
],
"permissions": {
"allowedDomains": ["api.example.com"],
"allowedCodeRules": ["no-storage-access"]
}
}
}

Fields

FieldTypeDescription
distDirstringThe directory containing the build artifacts to upload
titlestringItem title (prompted at upload time if not set)
descriptionstringItem description (prompted at upload time if not set)
thumbnailPathstringPath to the thumbnail image (relative to distDir)
buildCommandstringBuild command run before upload
ignorestring[]Glob patterns of files excluded from the upload
permissionsobjectPermissions required by the item
Difference from World Configuration

Item configuration shares most fields with worlds, but physics, camera, and outputBufferType are world-only. Items do not use them.

Field Details

distDir

The directory to upload. This is the build output directory that contains Module Federation's remoteEntry.js.

{
"item": {
"distDir": "./dist"
}
}

title / description

Item title and description. These are optional, but when set they skip the corresponding prompts in xrift upload item.

{
"item": {
"title": "My Awesome Item",
"description": "An interactive 3D item"
}
}

thumbnailPath

Path to the item's thumbnail image, relative to distDir.

{
"item": {
"distDir": "./dist",
"thumbnailPath": "thumbnail.png"
}
}

In this case, dist/thumbnail.png is used as the thumbnail.

Recommended size: 512x512 pixels

buildCommand

A command executed automatically before upload when running xrift upload item.

{
"item": {
"buildCommand": "npm run build"
}
}

Setting this removes the need to build manually before each upload.

ignore

Glob patterns of files to exclude from the upload.

{
"item": {
"ignore": [
"**/.DS_Store",
"**/Thumbs.db",
"**/*.map"
]
}
}

permissions

Declares the permissions the item requires. Declared permissions are considered during review and apply when the item is used inside a world.

FieldTypeDescription
allowedDomainsstring[]External domains the item communicates with
allowedCodeRulesstring[]Code security rules that need to be relaxed

Basic Setup

{
"item": {
"permissions": {
"allowedDomains": ["api.example.com", "cdn.example.com"],
"allowedCodeRules": ["no-storage-access", "no-network-without-permission"]
}
}
}

allowedDomains

Specifies external domains the item's code communicates with. @xrift/code-security statically analyzes the code and blocks communication to domains not listed here.

allowedCodeRules

Declares relaxations of code security rules defined by @xrift/code-security. By default, unsafe operations (eval, external communication, storage access, etc.) are blocked. Declare relaxations here when they are required by your item's functionality.

Dynamic Code Execution
RuleDescription
no-evalAllow running code via eval()
no-new-functionAllow dynamic code generation via the Function constructor
no-string-timeoutAllow string arguments to setTimeout/setInterval
no-javascript-blobAllow dynamic script generation via JavaScript Blobs
Obfuscation
RuleDescription
no-obfuscationAllow obfuscated code patterns
Network Communication
RuleDescription
no-network-without-permissionAllow network communication such as fetch and WebSocket
no-unauthorized-domainAllow connections to domains not in allowedDomains
no-rtc-connectionAllow WebRTC peer connections
no-external-importAllow loading JavaScript modules from external URLs
Storage / Data
RuleDescription
no-storage-accessAllow access to localStorage / sessionStorage
no-cookie-accessAllow reading/writing cookies
no-indexeddb-accessAllow access to IndexedDB
no-storage-eventAllow observing storage change events from other tabs
DOM Manipulation
RuleDescription
no-dangerous-domAllow innerHTML and inserting script elements
Browser APIs
RuleDescription
no-navigator-accessAllow access to geolocation, camera, microphone, clipboard, etc.
Global Pollution
RuleDescription
no-sensitive-api-overrideAllow overriding security-sensitive APIs like fetch
no-global-overrideAllow overriding global objects such as window / document
no-prototype-pollutionAllow modifying prototypes of built-in objects