SR
Click to open github profile

Use Craft CMS Query Builder in Nuxt

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

Features

  • Query builder: Easily build and execute queries directly from Nuxt, enabling flexible, real-time data retrieval from Craft CMS
  • Built in Helper 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 Transformer are in place to prettify the response.
  • Support for Main Element Types: Query addresses, assets, entries and users.

Examples

Want to see how it works?

app.vue
const entry = useCraftQuery('entries')
  .id(1)
  .status('active')
  .siteId(1)
  .one()

It is as simple as that. 🚀 The response will be the entry with id 1.

Further Resources

  • Craft Query API: A Craft CMS Plugin, that powers this stuff.
  • Vue Craft CMS: A package to use the query builder in Vue.
  • Js Craft CMS API: The core package, you can build wrappers around it to support your framework. If you want to build a wrapper around it for your framework -> Hit me up :)

Copyright © 2024 Samuel Reichör