Skip to main content

Introduction to CMS: Building a Simple Blog with Strapi

· 3 min read

TL;DR: Learn how to set up a basic blog using Strapi, a headless CMS. We'll go through installing Strapi, creating content types, adding posts, and fetching them via API.

Introduction

Content Management Systems (CMS) help you manage digital content without diving into code every time. Strapi is a headless CMS, meaning it provides an API to manage and deliver content, making it flexible for modern web apps.

In this tutorial, we'll build a simple blog with Strapi: set it up, create content types, add posts, and fetch them via API.

CMS Hero Image

Setup

First, install Node.js and npm from the official Node.js website.

Then, create a new Strapi project by running:

npx create-strapi-app@latest

Strapi Installation

This will install Strapi and start a development server.

Now we can start the server by below command:

npm  run develop

Next, open http://localhost:1337/admin in your browser to create an admin user for the Strapi dashboard.

Strapi Admin Setup

Creating Content Types

Inside the dashboard, go to Content-Types Builder → Create new collection type.

For our blog, let's create a collection called Post with these fields:

  • Title (Text)
  • Content (Rich Text)
  • Author (Text)

Save the collection type, and you're ready to add posts.

Adding Content

Go to Content Manager → Post → Create new entry.

Fill in your blog post details (title, content, author) and save it.

Fetching Content

Strapi automatically generates a REST API for each content type. For our blog posts, the endpoint is:

http://localhost:1337/api/posts

To access it securely, you'll need an API token:

  • Go to Settings → API Tokens in the dashboard.
  • Create a new token with read access to Posts.

Now you can fetch posts from your frontend using this endpoint.

API Request Example

Now you can use this endpoint to fetch and display the blog posts in your frontend application.

Conclusion

You've just built a basic blog with Strapi! 🎉

  • Installed Strapi
  • Created a Post content type
  • Added blog entries
  • Fetched them through the REST API

This setup gives you a foundation to expand further — add categories, images, authentication, or even switch to Strapi's GraphQL plugin.