Registry / devops / remix-graphql

remix-graphql

JSON →
library0.2.1jsnpmunverified

Utility library for integrating GraphQL with Remix apps. Version 0.2.1 provides functions to handle loader and action requests using local GraphQL schemas/resolvers or remote APIs, and to set up GraphQL resource routes. It ships TypeScript types and requires peer dependencies @remix-run/dev, @remix-run/react, @remix-run/serve, grapqhl^16.2, and remix. Key differentiators: server-only usage enforced via .server imports, support for schema-first and code-first schema definition, and future batching of queries from multiple loaders.

npm install remix-graphql
INSTALL
IMPORT
SIG · REMIX-GRAPHQL
R
remix-graphql
devopsjavascriptv0.2.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.

processRequestWithGraphQL
import { processRequestWithGraphQL } from 'remix-graphql/index.server'
import { processRequestWithGraphQL } from 'remix-graphql'
Must import from .server file to avoid client bundle issues; import from default path throws error.
createGraphQLAPI
import { createGraphQLAPI } from 'remix-graphql/index.server'
import { createGraphQLAPI } from 'remix-graphql'
Same .server import requirement.
GraphQLSchema
import { GraphQLSchema } from 'graphql' or define via SDL
import { GraphQLSchema } from 'remix-graphql'
Schema definition is from the graphql package, not remix-graphql.

Shows how to set up a GraphQL resource route using createGraphQLAPI with a local schema and root value.

// app/routes/graphql.ts server-side resource route import { createGraphQLAPI } from 'remix-graphql/index.server'; import { buildSchema } from 'graphql'; const schema = buildSchema(` type Query { hello: String } `); const rootValue = { hello: () => 'Hello world!', }; export const { loader, action } = createGraphQLAPI({ schema, rootValue, });
Debug
Known issues
breakingImporting from 'remix-graphql' (without .server) throws an error in client bundles
fix
Import from 'remix-graphql/index.server' instead.
affects: >=0.1.0
gotchaSchema must be a GraphQLSchema object; SDL strings are not accepted directly
fix
Use buildSchema or makeExecutableSchema to create the schema object.
affects: >=0.1.0
gotchaAll imports from remix-graphql must be from server-only files (e.g., .server.ts)
fix
Ensure imports are from 'remix-graphql/index.server' and that the file has .server extension.
affects: >=0.1.0
deprecatedThe 'remix' package is deprecated; use '@remix-run/dev' instead
fix
Replace 'remix' with '@remix-run/dev' in package.json dependencies.
affects: >=0.1.0
Errors
Common errors & fixes
Error: You are importing remix-graphql in a client-side module. See https://github.com/thomasheyenbrock/remix-graphql#readme
Importing from 'remix-graphql' (default export path) in a module that ends up in client bundle.
fix
Change import to 'remix-graphql/index.server' and ensure the file using it has .server extension.
GraphQLError: Syntax Error: Expected Name, found String
Passing a raw SDL string instead of a GraphQLSchema object to processRequestWithGraphQL or createGraphQLAPI.
fix
Use buildSchema or makeExecutableSchema to convert SDL to schema object.
Cannot find module 'remix-graphql/index.server' or its corresponding type declarations.
Missing .server file or incorrect import path; TypeScript cannot resolve the module.
fix
Ensure you are importing 'remix-graphql/index.server' and that the file is named with .server extension.
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
@remix-run/devrequiredpeer dependency required for Remix dev tooling
@remix-run/reactrequiredpeer dependency required for Remix React integration
@remix-run/serverequiredpeer dependency required for Remix server
graphqlrequiredpeer dependency required for GraphQL operations
remixrequiredpeer dependency required for Remix core
Agent activity
6 hits · last 30 days
node
6
Resources
remix-graphql — npm install remix-graphql · libregistry