The `gel` package is the official Node.js client library for interacting with Gel databases. It provides a robust, type-safe API for executing queries, managing transactions, and interacting with Gel's data model. The current stable version, as per the prompt, is 2.2.0, with frequent minor and patch releases, often in conjunction with `@gel/generate` and `@gel/ai` packages, indicating active development and rapid iteration. Key differentiators include strong TypeScript support, an ORM-less approach focusing on direct query execution, automatic connection discovery for local development, and extensive query generation capabilities through its companion tools. It's designed for Node.js environments (v18.0.0+) and also supports TypeScript projects (v4.4.0+).
npm install gelVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic client creation, connection configuration with transaction options, and executing various query types (`query`, `querySingle`, `queryRequiredSingle`) to handle different result cardinalities gracefully.
Upgrade your Node.js runtime to version 18.0.0 or newer.
Update TypeScript to version 4.4+ in your project's `package.json` and `tsconfig.json`.
Always use the appropriate query method based on the expected cardinality of your query's result to avoid runtime errors or incorrect type assumptions.
Ensure `GEL_DSN` is correctly configured in your production environment with a valid connection string in the format `gel://USERNAME:PASSWORD@HOSTNAME:PORT/DATABASE`.
Review the latest `@gel/ai` package documentation and Gel server release notes (especially Gel 6.0) and migrate your AI-related code to align with updated API structures.
Change `const gel = require('gel')` or `const { createClient } = require('gel')` to `import * as gel from 'gel'` or `import { createClient } from 'gel'`. Ensure your project is configured for ESM (e.g., by adding `"type": "module"` to your `package.json`).Verify that your `GEL_DSN` environment variable is correctly configured, ensure your Gel database instance is running and accessible at the specified host/port, and check any local or cloud firewall rules.
Always check for `null` when using `.querySingle()`: `const user = await client.querySingle<{ name: string }>('select User { name } limit 1'); if (user) { console.log(user.name); } else { console.log('User not found'); }`If your query might return zero or many elements, use `.querySingle()` (for zero or one element, returning `T | null`) or `.query()` (for any number of elements, returning `T[]`) instead of `.queryRequiredSingle()`.
No dependency data recorded yet.