Registry / devops / altair-static

altair-static

JSON →
library8.5.7jsnpmunverified

Altair Static is a package that serves the static assets (HTML, JS, CSS) of the Altair GraphQL client, allowing you to embed a full-featured GraphQL IDE in any Node.js application. Version 8.5.7 is current; releases follow altair-graphql-client updates. Key differentiators: provides pre-built client assets without needing a frontend build pipeline, supports ESM and CJS, and ships TypeScript definitions.

npm install altair-static
INSTALL
IMPORT
SIG · ALTAIR-STATIC
A
altair-static
devopsjavascriptv8.5.7
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.

renderAltair
import { renderAltair } from 'altair-static';
const renderAltair = require('altair-static').renderAltair;
ESM-only since v5; CJS require works but not recommended.
AltairStatic
import AltairStatic from 'altair-static';
const AltairStatic = require('altair-static').default;
Default export is the main namespace; named exports available.
altairScript
import { altairScript } from 'altair-static';
Returns the JS script content as a string.
altairHtml
import { altairHtml } from 'altair-static';
const { altairHtml } = require('altair-static');
ESM preferred; CJS require works but may be deprecated.
AltairConfig
import type { AltairConfig } from 'altair-static';
const AltairConfig = require('altair-static').AltairConfig;
TypeScript type only; not a runtime value.

Shows how to generate an Altair HTML page with a custom GraphQL endpoint and initial query using renderAltair.

import { renderAltair } from 'altair-static'; const html = renderAltair({ baseURL: '/altair/', endpointURL: 'https://api.example.com/graphql', initialQuery: `query { viewer { id name } }` }); // html is a string containing the full Altair HTML page console.log(html.length > 0); // true
Debug
Known issues
breakingaltair-static v4 changed default export to named exports; require('altair-static').default became undefined.
fix
Use named imports: import { renderAltair } from 'altair-static';
affects: >=4.0.0
deprecatedaltairScript, altairStyles, altairHtml are deprecated in v8; use renderAltair with options instead.
fix
Use renderAltair({}) to generate the full page, or access via altairStatic namespace.
affects: >=8.0.0
gotchaThe `baseURL` option must include trailing slash; otherwise assets fail to load.
fix
Always set baseURL: '/altair/' (not '/altair').
affects: >=5.0.0
gotchaNode.js 6.9.1 minimum is outdated; altair-static v8 requires Node >=12 due to modern JS features.
fix
Upgrade Node to >=12 (recommended 18+).
affects: >=8.0.0
deprecatedCJS require of altair-static is deprecated in v8; may be removed in v9.
fix
Use ESM imports: import { renderAltair } from 'altair-static';
affects: >=8.0.0
Errors
Common errors & fixes
Cannot find module 'altair-static'
Package not installed or incorrect import path.
fix
Run: npm install altair-static
import { renderAltair } from 'altair-static' - SyntaxError: Cannot use import statement outside a module
Running ESM code in a CommonJS environment without type:module.
fix
Add "type": "module" to package.json, or use dynamic import().
require('altair-static').renderAltair is not a function
Using require on a package that exports ESM only (v5+).
fix
Use import or upgrade altair-static to v4 or lower (not recommended).
Altair assets not loading; 404 for /altair/index.js
baseURL missing trailing slash or incorrect path.
fix
Set baseURL with trailing slash, e.g., '/altair/'
Upgrade
Version history
8.5.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
22
OpenAI (training)
1
Resources
altair-static — npm install altair-static · libregistry