Skip to main content

xrift.json Configuration

Configure your world settings in xrift.json at the project root.

Configuration Example

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

Configuration Items

FieldTypeDescription
distDirstringDirectory of build artifacts to upload
titlestringWorld title (if not set, input required at upload)
descriptionstringWorld description (if not set, input required at upload)
thumbnailPathstringPath to thumbnail image (relative to distDir)
buildCommandstringBuild command to execute before upload
ignorestring[]Glob patterns of files to exclude from upload
physicsobjectWorld physics settings
permissionsobjectPermissions required by the world

Details of Each Item

distDir

Specifies the directory to upload.

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

title / description

Sets the world title and description. These are optional, but if set, they will be used as default values in the prompt when running xrift upload world.

{
"world": {
"title": "My Awesome World",
"description": "An interactive 3D world"
}
}

thumbnailPath

Specifies the thumbnail image for the world. Specify as a relative path from distDir.

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

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

Recommended Size: 1280x720 pixels

buildCommand

A command that is automatically executed before uploading when running xrift upload world.

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

Setting this eliminates the need to build manually.

ignore

Specifies files to exclude from upload using glob patterns.

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

physics

You can customize the physics behavior of the world.

SettingTypeDefaultDescription
gravitynumber9.81Strength of gravity (Positive value, Earth=9.81, Moon=1.62)
allowInfiniteJumpbooleantrueWhether to allow infinite jumping

Basic Settings

{
"world": {
"physics": {
"gravity": 9.81,
"allowInfiniteJump": true
}
}
}

Athletic World (No Infinite Jump)

{
"world": {
"physics": {
"allowInfiniteJump": false
}
}
}

Low Gravity World (Moon Gravity)

{
"world": {
"physics": {
"gravity": 1.62
}
}
}

High Gravity World (Jupiter Gravity)

{
"world": {
"physics": {
"gravity": 24.79
}
}
}

permissions

Declares the permissions required by the world. Declared permissions are shown to users as an approval screen when entering an instance.

SettingTypeDescription
allowedDomainsstring[]List of external domains the world communicates with
allowedCodeRulesstring[]List of code security rules to relax

Basic Settings

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

allowedDomains

Specifies external domains that the world's code communicates with. Communication to unauthorized domains is detected and blocked by @xrift/code-security code analysis.

allowedCodeRules

Declares relaxation of code security rules defined by @xrift/code-security. By default, unsafe operations (eval, external communication, storage access, etc.) are blocked, but can be relaxed here when required for the world's functionality.

Dynamic Code Execution
RuleDescription
no-evalAllows eval() to execute strings as code
no-new-functionAllows Function constructor to dynamically generate code
no-string-timeoutAllows setTimeout/setInterval with string arguments
no-javascript-blobAllows creating JavaScript Blobs for dynamic script execution
Obfuscation
RuleDescription
no-obfuscationAllows obfuscated code patterns
Network
RuleDescription
no-network-without-permissionAllows network requests (fetch, WebSocket, etc.)
no-unauthorized-domainAllows connections to domains not in allowedDomains
no-rtc-connectionAllows WebRTC peer connections
no-external-importAllows importing JavaScript modules from external URLs
Storage & Data
RuleDescription
no-storage-accessAllows localStorage/sessionStorage access
no-cookie-accessAllows cookie read/write
no-indexeddb-accessAllows IndexedDB access
no-storage-eventAllows listening to storage events from other tabs
DOM
RuleDescription
no-dangerous-domAllows innerHTML and script element injection
Browser APIs
RuleDescription
no-navigator-accessAllows access to geolocation, camera, microphone, clipboard, etc.
Global Pollution
RuleDescription
no-sensitive-api-overrideAllows overriding security-critical APIs (fetch, etc.)
no-global-overrideAllows overriding global objects (window, document, etc.)
no-prototype-pollutionAllows modifying built-in object prototypes