Registry / api-utilities / lokka
library1.7.0jsnpmunverified

Simple JavaScript client for GraphQL. Version 1.7.0 is the latest stable release, but the project is in maintenance mode with no active development. It works in browser, Node.js, and React Native. Unlike more modern clients like Apollo or urql, Lokka does not support React hooks, subscriptions, or advanced caching. It uses a transport layer pattern (e.g., lokka-transport-http) and provides a basic query/mutation API with fragment support and a simple watchQuery cache. It is best suited for simple GraphQL queries in non-React environments.

npm install lokka
INSTALL
IMPORT
SIG · LOKKA
L
lokka
api-utilitiesjavascriptv1.7.0
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.

Lokka
import { Lokka } from 'lokka'
const Lokka = require('lokka').Lokka
Use ESM import for modern environments. CJS require also works but the default export is an object, so you need .Lokka.
Transport
import { Transport } from 'lokka-transport-http'
const Transport = require('lokka-transport-http').Transport
Install the transport package separately. ESM and CJS both work.
default
import lokka from 'lokka'
Default import is not available; use named import { Lokka }.

Sets up a Lokka client with HTTP transport and performs a simple query to fetch Star Wars film titles.

import { Lokka } from 'lokka'; import { Transport } from 'lokka-transport-http'; const client = new Lokka({ transport: new Transport('https://graphql-swapi.parseapp.com/') }); client.query(` { allFilms { films { title director releaseDate } } } `).then(result => { console.log(result.allFilms); }).catch(err => { console.error(err); });
Debug
Known issues
gotchaLokka is outdated and no longer actively maintained. Consider using Apollo Client or urql for new projects.
fix
Migrate to a modern GraphQL client like Apollo Client (@apollo/client).
affects: >=0.0.0
gotchaTransport layer must be installed separately (e.g., lokka-transport-http). Missing transport will cause runtime errors.
fix
Install required transport: npm install lokka-transport-http
affects: >=0.0.0
gotchaDefault import from 'lokka' does not exist. Must use named import: import { Lokka } from 'lokka'.
fix
Change import to named import: import { Lokka } from 'lokka'
affects: >=1.0.0
gotchaCJS require('lokka') returns an object, not the class directly. You need require('lokka').Lokka.
fix
Use const { Lokka } = require('lokka');
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'lokka-transport-http'
Transport package not installed.
fix
npm install lokka-transport-http
TypeError: lokka_1.default is not a constructor
Wrong import style for Lokka.
fix
import { Lokka } from 'lokka'
Error: No transport provided
Lokka client instantiated without transport option.
fix
new Lokka({ transport: new Transport('URL') })
Upgrade
Version history
1.7.0latest on npm
Audit
Dependencies
lokka-transport-httprequiredRequired transport layer for HTTP connections; must be installed separately.
Agent activity
2 hits · last 30 days
node
2
Resources
packagelokka
lokka — npm install lokka · libregistry