# @envelop/graphql-jit

Latest version **11.2.1** (published 2026-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @envelop/graphql-jit
pnpm add @envelop/graphql-jit
yarn add @envelop/graphql-jit
bun add @envelop/graphql-jit
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 11.2.1 |
| Published | 2026-09-16 |
| First published | 2021-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 3 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 8529 |
| Author | Dotan Simha <dotansimha@gmail.com> |
| Maintainers | dotansimha, enisdenjo, theguild-bot |

## Links

- npm: https://www.npmjs.com/package/@envelop/graphql-jit
- Repository: https://github.com/graphql-hive/graphql-yoga
- Homepage: https://github.com/graphql-hive/graphql-yoga/tree/main/packages/envelop/plugins/graphql-jit#readme
- npm.io page: https://npm.io/package/@envelop/graphql-jit

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) ^2.5.0
- [graphql-jit](https://npm.io/package/graphql-jit.md) 0.8.7
- [@whatwg-node/promise-helpers](https://npm.io/package/@whatwg-node/promise-helpers.md) ^1.2.3

## Recent versions

- 11.2.1 (latest) — 2026-09-16
- 12.0.0-alpha-20260420122826-afff629b648b45dc56cbf71f10a44eb4006be3c3 (alpha) — 2026-04-20
- 9.1.3-rc-20250306153119-ed3979491f3ac71caf439dd723f2d12d26b1000f (rc) — 2025-03-06
- 11.2.0 — 2026-08-19
- 11.1.1-alpha-20260211135637-93c20e8d6487b818cbaeae5d79720080f2cdb30f — 2026-02-11
- 11.1.1-alpha-20260211135549-d5b47440cdcf7b0c44848a5d2d061d5bd2270ca4 — 2026-02-11
- 11.1.1-alpha-20260211135457-17dcb4f75d8b14c54c5b72820d4adc64ee17a76b — 2026-02-11
- 11.1.1 — 2026-02-11
- 11.1.1-alpha-20260211134540-a42c1c0e06864232b43671a2c90543caf9e7a99a — 2026-02-11
- 11.1.1-alpha-20260211133743-c4aa2c6402a6830521632f3ae388267ba187aba3 — 2026-02-11
- 11.1.0 — 2026-01-20
- 11.1.0-alpha-20260120170745-adbe13e06b251f86813e84382d87a6113a9c11cf — 2026-01-20
- 11.1.0-alpha-20260120165659-e6c64c712e52f7da442c51fed7a2aa5436afed6c — 2026-01-20
- 11.1.0-alpha-20260120165332-6d6a496b7a518ed85a7ce7c43c610183dabe24ca — 2026-01-20
- 11.1.0-alpha-20260120164856-c20d9370e5c23c9e9add81795b0f6f9d39863860 — 2026-01-20
- … 2168 more at https://npm.io/package/@envelop/graphql-jit/versions

## README

## `@envelop/graphql-jit`

This plugins replaces the original `execute` of GraphQL with
[`graphql-jit`](https://github.com/zalando-incubator/graphql-jit).

## Getting Started

```
yarn add @envelop/graphql-jit
```

## Usage Example

```ts
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useGraphQlJit } from '@envelop/graphql-jit'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    // ... other plugins ...
    useGraphQlJit(
      {
        // your compiler options here. See https://github.com/zalando-incubator/graphql-jit#compiledquery--compilequeryschema-document-operationname-compileroptions
      },
      {
        onError: (e: Error) => {} // custom error handler
      }
    )
  ]
})
```

## Conditional Execution

If you wish to conditionally use the JIT executor based on the incoming request, you can use
`enableIf` config flag and return a `boolean` based on the `ExecutionArgs`:

```ts
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useGraphQlJit } from '@envelop/graphql-jit'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    // ... other plugins ...
    useGraphQlJit(
      {
        // your compiler options here. See https://github.com/zalando-incubator/graphql-jit#compiledquery--compilequeryschema-document-operationname-compileroptions
      },
      {
        enableIf: executionArgs => executionArgs.contextValue.shouldUseJit
      }
    )
  ]
})
```

## Configuring JIT cache

You can configure the JIT cache with the following options:

```ts
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useGraphQlJit } from '@envelop/graphql-jit'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    // ... other plugins ...
    useGraphQlJit(
      {
        // your compiler options here
      },
      {
        cache: lru() // Pass in a custom cache instance, by default a new LRU cache is created which uses the default `max` and `ttl` settings
      }
    )
  ]
})
```

## Notes

You can find more details here: https://github.com/zalando-incubator/graphql-jit

---
_Source: https://npm.io/package/@envelop/graphql-jit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
