Strapi: The headless CMS

Shubham Sharma
3 min readJan 30, 2021

Introduction

Imagine that you are maintaining a large website with tens of pages and a lot of text, images, videos, gifs etc. To embed all this data within the code will not only bloat the size of your code repository but also make your website content difficult to manage. For every change in the content, however small it may be, you would need a developer and it might take time to deploy those changes.

There comes the concept of a CMS (Content Management System). As the name suggests, a CMS takes responsibility for storing your content in an organised manner and helping you retrieve relevant data for your client side application. CMSs can be broadly classified as either Traditional or Headless. A good example of a traditional CMS can be Wordpress in which the client side and the content management system are tightly coupled. However, such an approach lacks reusability as your CMS would in that case cater to only one type of client application say a react web app and not an angular app or an android app or an iOS app or something else. To achieve reusability, and to separate client side output from the content, one needs the headless approach. In this blog, let’s explore Strapi: The Open Source & Headless CMS.

Strapi

As mentioned before, Strapi is an open source CMS whose code is available on github and hundreds of contributors contribute to it. The content is totally de-coupled from client side application and is stored on a cloud. You can host your strapi server locally also and customise its APIs. All CRUD operations can be performed on the content in the form of REST APIs.

Installation

Strapi is self-hosted and its installation is fairly simple. One can refer to the official strapi docs for getting started. One can get started with CLI, docker and many more. Link to that is the following:

Getting Started

Once you have setup strapi, you can open localhost:${PORT}/admin. PORT is 1337 by default. It will show a form for you to register yourself and set username, password and email.

Once that is done, it will show you a nice dashboard.

Strapi Dashboard

On the left you can see a sidebar containing sections COLLECTION TYPES, SINGLE TYPES, PLUGINS and GENERAL. The Users collection type is present by default as one admin user got created when you did signup. You can add more users by going into Users collection type and clicking the Add New Users button.

It shows a form with input boxes. Fill in the relevant details. Confirmed flag can be used to distinguish one set of users from another. Let’s say, users who verified their email vs those who did not. Blocked is another flag for users.

Content-Types Builders

Content-Types Builders, gives you the option of creating new collection types, single data types and components. Collection types are used for the kind of data where there are multiple instances of the same schema or structure like Users. On the other hand, Single types are used for the kind of data which would have only one instance like Home page data, menu data etc.

To create a new collection aka table, choose Create new collection type in the COLLECTION TYPES section.

--

--