Headless blog using Garchi CMS & Nuxt 3 - Part 1
Tags: webdev, javascript, nuxt
Published: 2023-07-19 08:24:48

Nuxt 3 is an incredibly amazing Vue.js meta-framework. Its exceptional performance, delightful developer experience, and plethora of features make it a popular choice among developers. In this post, we'll explore how we can harness Nuxt 3's capabilities in conjunction with Garchi CMS, a powerful headless CMS, to create a headless blog.

Let's first demystify a couple of key terms before diving in.

**1. Headless CMS**

A headless CMS is a type of content management system that provides back-end content management functionalities without any predefined front-end delivery layer. It disseminates content through APIs to any platform or device, empowering developers to construct custom front-ends. This method ensures greater flexibility, scalability, and swifter content delivery.

**2. Garchi CMS**

Garchi CMS is our proprietary, cloud-based (SaaS) headless CMS. Initially built for the e-commerce industry, it has since been extended to accommodate similar systems like e-learning platforms, blogs, and more. Its core appeal lies in its minimalism and the inclusion of REST APIs. No need to install packages or perform any initial setup other than generating an API token. Its lightweight nature allows it to be used as a component in a diverse range of applications or software.

Tech stacks we will use

1. Nuxt 3
2. Tailwind CSS
3. Garchi CMS

Now that we're up to speed, let's configure our blog's backend on Garchi CMS. For simplicity, we won't be including authentication, but feel free to integrate it with services like Firebase, Supabase, or any other of your choosing.

Start by visiting [Garchi CMS](https://garchi.co.uk) website and registering a free account.

Upon successful registration, you'll land on a dashboard with a default space.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i2fpjcgt0pg0lwtjs0io.png)

'Space' in Garchi CMS can be thought of as a workspace dedicated to a single system. For example, one space might be reserved for blog articles, while another could cater to product listings. You can either continue with the default space or create a new one.

I will go with the default space and we should see a dashboard like this

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oa2rii0a5iqzl9kizv10.png)

We'll begin by establishing categories. You can find this option in the sidebar, under 'Data Set -> Manage Categories'. Add a new category, for example, 'Blog'.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hwchunmshjukb3kfkyq.png)

This will be our parent category for blogs and within that we can have sub categories. So I will create another category say Web Dev.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ywtw4s6b4oav9rba6dw5.png)

With our categories established, we can proceed to add items. Garchi CMS's item schema echoes its e-commerce roots, but you can extend it with additional features or data points using the 'Add extra details' function.

To create a new item (which would be a blog post in our case), click on 'Add New Item'.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4y5yle2xc6xqh3acs6e.png)

For our example, let's generate a simple blog on Vue 3, classified under the 'Blog' and 'Web Dev' categories. To expedite the process, we'll use Garchi's built-in GPT support to generate an item description (which will be our blog article body). Although our example utilizes text content, you can include images, videos, and embeds. 

(Don't worry this current article is all written by me :D) 

We can keep the selling price to 0.

So we would have something like this


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/trryz97xcdsv961fpdqv.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qtbpxsrlplm5rfsqfo6r.png)

Once you've added the necessary details, you can either 'Save and Publish' immediately or schedule it for a later time.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xxl6fgxo8pzgwgr6fu9x.png)

You can augment your post with additional information using the 'Add extra details' option under the item. Let's add details like the author's name, publication date, and avatar.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lxnto7fe37ed7abbbwik.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xcjinqj6ibims54r8hdw.png)

These additional details are formatted as key-value pairs, and you'll need to save each section individually. These pairs will be useful to extract metadata or filter items using the Garchi CMS API later.

Next, add an image for the blog post by clicking on the image icon.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57l81zmfz90iurz7om4n.png)

Garchi CMS allows you to add up to four images per post. However, to keep things simple, we'll only add one image for now.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6w2732mcwx7wm5sgxs6d.png)

Finally, generate an API key to use Garchi CMS APIs from the Nuxt 3 end. Click on 'API' in the sidebar and then 'Create New Token'.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qwwi8msql1y9f8fwfjzw.png)

You should now see your API key. Keep this safe, as it's essential for billing purposes. You can also invite more team members to collaborate on your project.

That's it for this part. We'll continue setting up the Nuxt 3 end in our [next part](https://dev.to/adityar15/headless-blog-using-garchi-cms-nuxt-3-part-2-3ao8).