Registry / communication / glitch-javascript-sdk

glitch-javascript-sdk

JSON →
library3.0.6jsnpmunverified

Official JavaScript SDK for Glitch, an open-source live community platform for gaming and esports. Version 3.0.6 is current stable. Released as needed; key differentiator is its tight integration with the Glitch backend API. Supports both browser and Node.js environments. Includes TypeScript definitions.

npm install glitch-javascript-sdk
INSTALL
IMPORT
SIG · GLITCH-JAVASCRIPT-
G
glitch-javascript-sdk
communicationjavascriptv3.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Glitch
import Glitch from 'glitch-javascript-sdk'
const Glitch = require('glitch-javascript-sdk')
Default import; CommonJS require is supported but discouraged.
Glitch.config.Config
import Glitch from 'glitch-javascript-sdk'; Glitch.config.Config.setBaseUrl(url)
import { Config } from 'glitch-javascript-sdk'
Config is a nested singleton, not a named export.
Glitch.api.Auth
import Glitch from 'glitch-javascript-sdk'; Glitch.api.Auth.login(email, password)
import { Auth } from 'glitch-javascript-sdk'
Auth is accessed via Glitch.api.

Shows setup, authentication via JWT, login call, and user retrieval.

import Glitch from 'glitch-javascript-sdk'; Glitch.config.Config.setBaseUrl('https://api.glitch.local/api/', true); const jwt = process.env.JWT ?? ''; if (jwt) { Glitch.config.Config.setAuthToken(jwt); } Glitch.api.Auth.login('user@example.com', 'password123') .then(() => console.log('Logged in')) .catch(err => console.error(err)); // Use other API endpoints Glitch.api.Users.getCurrentUser().then(user => console.log(user));
Debug
Known issues
breakingv3.0.0 changed to ESM-only; CommonJS require() will fail without module transformation.
fix
Use import syntax or enable ESM compat in your bundler (e.g., 'type': 'module' in package.json).
affects: >=3.0.0
deprecatedGlitch.api.Auth.register has been deprecated in v3.0.0; use Glitch.api.Users.create
fix
Replace Glitch.api.Auth.register with Glitch.api.Users.create.
affects: >=3.0.0
gotchaConfig setBaseUrl second parameter 'addTrailingSlash' defaults to false in v2.x, true in v3.x
fix
Explicitly pass true to ensure consistent trailing slash behavior.
affects: >=3.0.0
gotchaSetting auth token before base URL may cause requests to fail silently
fix
Always call setBaseUrl before setAuthToken.
affects: >=1.0.0
Errors
Common errors & fixes
Uncaught TypeError: Glitch.config is undefined
Using named imports instead of default import of Glitch object.
fix
Use: import Glitch from 'glitch-javascript-sdk';
ERR_REQUIRE_ESM
Using require() to import an ESM-only package.
fix
Convert to import syntax or use dynamic import().
TypeError: Cannot read properties of undefined (reading 'setBaseUrl')
Calling Glitch.config.Config.setBaseUrl before initializing Glitch (e.g., using wrong import).
fix
Ensure you import Glitch correctly as default and then call Glitch.config.Config.setBaseUrl.
Upgrade
Version history
3.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
2
Amazon
1
Resources
glitch-javascript-sdk — npm install glitch-javascript-sdk · libregistry