Fuse is a GraphQL framework designed to provide end-to-end type safety for frontend teams working with GraphQL APIs at scale. It offers a streamlined development experience by handling schema generation, client-side querying, and server-side execution. Currently, the stable version is 0.12.1, with frequent patch and minor releases addressing bug fixes, performance improvements, and feature enhancements. Key differentiators include its tight integration with tools like `gql.tada` for codegen, a focus on typesafety from schema to UI, and specific plugins for frameworks like Next.js that automate server setup. It aims to simplify the complexities of GraphQL development by abstracting away much of the boilerplate, allowing developers to focus on data modeling and application logic.
npm install fuseVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a GraphQL query using `graphql` from `@/fuse` and execute it server-side using `execute` from `@/fuse/server`, rendering the result.
Ensure `next.config.js` includes the Fuse plugin. Let Next.js handle the dev server start; `fuse dev` is for non-Next.js environments.
Avoid direct imports of `__internal_execute`. Use the standard `execute` function from `@/fuse/server` for server-side operations, which should abstract this internal detail.
If you have an existing codegen, ensure it's compatible or adjust your setup. If starting fresh, be aware that `gql.tada` is the default. Consult the Fuse documentation for integrating with specific codegen tools.
Keep your `fuse` package up-to-date by regularly running `npm update fuse` or `yarn upgrade fuse` to incorporate security fixes and other improvements.
Run `npx create-fuse-app` to set up the project and ensure `tsconfig.json` or equivalent bundler config has path aliases defined. Also, ensure `npx fuse dev` (or your Next.js dev server) is running to generate the client.
Verify that your `tsconfig.json` includes the generated types directory (e.g., `include: ['./src/**/*.ts', './src/**/*.tsx', './.fuse/types.ts']`) and that your IDE's TypeScript server is restarted. Ensure the `graphql` tag is correctly used to infer types.
Ensure your GraphQL schema files are correctly located and valid. Run `npx fuse dev` (or start your Next.js app) to initialize the schema and codegen. Check the console for schema parsing errors.