Registry / api / laraqlgraph

laraqlgraph

JSON →
library1.0.1jsnpmunverified

LaraQL is a lightweight, Eloquent-inspired JavaScript ORM for Lighthouse GraphQL, currently at version 1.0.1 as of 2025. It brings the familiar Laravel syntax to frontend development, allowing developers to use methods like all(), find(), where(), and paginate() to query GraphQL APIs. Released on GitHub under nodesol/laraql, it differentiates itself by providing a clean, Eloquent-like interface for Lighthouse backends, with support for complex where conditions, pagination, and custom headers. The library is still early-stage and may have limited community adoption.

npm install laraqlgraph
INSTALL
IMPORT
SIG · LARAQLGRAPH
L
laraqlgraph
apijavascriptv1.0.1
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.

Model
import { Model } from 'laraql'
const Model = require('laraql')
The package is ESM-only; CommonJS require() will not work.
Model.init()
import { Model } from 'laraql'; Model.init({ url: '...', headersCallback: () => ({}) })
Model.init({ url: '...' }); // Missing headersCallback may cause authentication errors
init() must be called once with at least a url. headersCallback is optional but recommended for auth.
User.find()
await User.find(1, ['id', 'name'])
await User.find(1)
Passing fields array is optional; if omitted, all fields are requested, which may be heavy.

Initializes the Model class with a GraphQL endpoint, defines a User model, and fetches all users with selected fields.

import { Model } from 'laraql'; Model.init({ url: process.env.GRAPHQL_URL ?? 'https://your-api.com/graphql', headersCallback: () => ({ Authorization: `Bearer ${process.env.API_TOKEN ?? ''}` }) }); class User extends Model {} async function fetchUsers() { const users = await User.all(['id', 'name', 'email']); console.log(users); } fetchUsers();
Debug
Known issues
gotchaPackage is not on npm registry; install from GitHub: npm install nodesol/laraql
fix
Add nodesol/laraql as a dependency in package.json pointing to GitHub repository.
affects: all
gotchaModel.init() must be called before any model operation; otherwise errors occur.
fix
Call Model.init() in your application bootstrap before any model usage.
affects: >=1.0.0
gotchaPackage is ESM-only; CommonJS require() fails with MODULE_NOT_FOUND.
fix
Use import syntax or set type: 'module' in package.json.
affects: >=1.0.0
gotchaMethods all(), find(), where() rely on GraphQL schema conventions; may not work with arbitrary backends.
fix
Ensure backend uses Lighthouse directives like @paginate and @guard as expected.
affects: all
gotchaNo TypeScript definitions provided; use TypeScript at your own risk.
fix
Create manual type declarations or use JSDoc for type hints.
affects: all
Errors
Common errors & fixes
Error: Model is not defined
Model.init() not called before using model classes.
fix
Call Model.init({ url: '...' }) in your bootstrap code before any model operations.
Cannot find module 'laraql' or its corresponding type declarations
Package installed from non-standard source or missing module resolution.
fix
Install from GitHub: npm install nodesol/laraql; ensure package.json references the correct path.
TypeError: response.paginatorInfo is undefined
Backend does not support the @paginate directive output format.
fix
Verify backend pagination implementation matches Lighthouse conventions.
NullInjectorError: No provider for GraphQLClient
Model.init() not called properly, missing dependencies.
fix
Re-run Model.init() with correct url and optional headers.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
graphql-requestrequiredUsed internally for making GraphQL HTTP requests; bundled dependency.
Agent activity
38 hits · last 30 days
node
30
OpenAI (training)
1
Resources
laraqlgraph — npm install laraqlgraph · libregistry