SR
Click to open github profile

Use Craft CMS Query Builder in Next

With the Next SDK, you can easily integrate Craft CMS and leverage the Craft Query Builder in your Next projects.

Features

  • Query builder: Easily build and execute queries directly from Next.js, enabling flexible, real-time data retrieval from Craft CMS
  • Server and Client Component Support: Full support for both client and server components with dedicated hooks and functions.
  • Data Driven Components: Connect your data directly with your Vue components, to speed up development.
  • Get Only the Data You Need: Avoid overfetching by using a custom function in the query builder to select only the fields you require.
  • Pretty JSON: JSON transformers are in place to format the response for better readability.
  • Support for Main Element Types: Query addresses, assets, entries and users.
  • Full TypeScript Support: A fully-typed query builder for Craft CMS. Pretty cool, huh? 😎
  • Multisite Helpers: Built-in helpers to support Craft Multisites.

Examples

Want to see how it works?

App.tsx
const { data, error } = await getCraftEntry()
  .section('news')
  .fields(['title']) // add more field handles if you like
  .limit(3)
  .all()

It is as simple as that. 🚀 The response will contain three entries from the 'news' section.

Further Resources

  • Craft Query API: A Craft CMS Plugin, that powers this great stuff.
  • React SDK: A package to use the query builder in React.
  • JS SDK: Foundation to build a query builder with your preferred JS framework.

Copyright © 2025 Samuel Reichör