New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@platformatic/globals

Package Overview
Dependencies
Maintainers
8
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/globals

Platformatic Global Object Getter

latest
Source
npmnpm
Version
3.75.0
Version published
Weekly downloads
0
Maintainers
8
Weekly downloads
 
Created
Source

@platformatic/globals

Typed accessors for Platformatic runtime APIs.

Applications use @platformatic/globals to read runtime context, use the shared logger, exchange messages, register metrics, customize health checks, and publish metadata while running inside Watt or Platformatic Runtime.

Install

npm install @platformatic/globals

Usage

import { getApplicationId, getLogger, getMessaging } from '@platformatic/globals'

const applicationId = getApplicationId()
const logger = getLogger()
const messaging = getMessaging()

logger.info({ applicationId }, 'Application started')

messaging.handle('ping', () => 'pong')

Runtime APIs are injected when the application runs inside Watt or Platformatic Runtime. Most getters throw when the requested API is not available. Pass { throwOnMissing: false } to return undefined instead:

import { getBasePath } from '@platformatic/globals'

const basePath = getBasePath({ throwOnMissing: false }) ?? ''

Direct access through the legacy globalThis.platformatic object is still supported for compatibility, but deprecated. Use the typed getters and setters instead.

Documentation

See the Runtime APIs reference for the complete API list and examples.

License

Apache 2.0

Keywords

platformatic

FAQs

Package last updated on 22 Oct 2026

Related posts