GraphQXL Node Wrapper
raw JSON →node-graphqxl is a JavaScript/TypeScript development dependency that provides a Node.js wrapper for the GraphQXL compiler. GraphQXL itself is an extension of the GraphQL Schema Definition Language (SDL) designed to facilitate the creation of large and scalable server-side GraphQL schemas by introducing features like inheritance, generics, and imports, which are typically found in programming languages. This package (currently at version 0.40.2) makes the `graphqxl` command-line interface (CLI) binary available within Node.js projects, allowing developers to compile `.graphqxl` schema files into standard GraphQL SDL. It is a build-time tool, not a runtime library for executing GraphQL queries. The primary use case is in schema-first GraphQL development workflows, enabling enhanced schema modularity and reusability. As a 0.x.x versioned project, it should be noted that the API and behavior may evolve rapidly.
Common errors
error command not found: graphqxl ↓
npx graphqxl or define it as a script in your package.json (e.g., "scripts": { "compile": "graphqxl src/schema.graphqxl" }) and then execute with npm run compile or yarn compile. error Error: Failed to compile GraphQXL schema: ... (followed by parsing errors) ↓
.graphqxl file. Consult the GraphQXL documentation (github.com/gabotechs/graphqxl) for correct syntax, especially for features like inheritance, generics, or imports. Warnings
gotcha node-graphqxl is primarily a CLI wrapper. It provides the `graphqxl` executable to your `node_modules/.bin` path and is intended for use in `package.json` scripts or direct CLI calls. There is no public programmatic JavaScript API for compiling GraphQXL schemas directly within your Node.js code. ↓
breaking As a pre-1.0.0 project (version 0.x.x), `node-graphqxl` and the underlying GraphQXL language are subject to frequent breaking changes between minor and patch releases. Always check release notes when upgrading. ↓
gotcha GraphQXL is a compile-time language extension for GraphQL SDL, not a runtime library. It compiles `.graphqxl` files into standard `.graphql` SDL, which then needs to be used by a separate GraphQL server library (e.g., Apollo Server, Express GraphQL) to serve an API. ↓
Install
npm install node-graphqxl yarn add node-graphqxl pnpm add node-graphqxl Quickstart
{
"name": "my-graphqxl-project",
"version": "1.0.0",
"description": "A project using GraphQXL for schema definition.",
"main": "index.js",
"scripts": {
"generate:schema": "graphqxl src/schema.graphqxl > dist/schema.graphql",
"start": "node src/server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"node-graphqxl": "^0.40.2"
}
}
// src/schema.graphqxl (example content)
// type User {
// id: ID!
// name: String!
// }
//
// type Query {
// users: [User!]
// }
// To run this example, save the above JSON in package.json and the commented out content in src/schema.graphqxl.
// Then run: npm install && npm run generate:schema