Top 10 Solutions to Mastering Strapi CMS

Jennie Lee
6 min readApr 9, 2024

--

Looking for a Postman alternative?

Try APIDog, the Most Customizable Postman Alternative, where you can connect to thousands of APIs right now!

Introduction

In today’s digital age, content management systems (CMS) have become an essential tool for businesses and developers alike. These platforms enable easy content creation, editing, and management, allowing businesses to efficiently publish and update their content. One such CMS that has gained significant popularity is Strapi CMS.

Strapi is an open-source headless CMS that provides a user-friendly interface for designing APIs and managing content. It allows developers to focus on creating exceptional digital experiences without worrying about the complexities of backend development. In this tutorial, we will explore the top 10 solutions for mastering Strapi CMS, and learn how to build a school website using the CMS with Vanilla JS.

Getting Started with Strapi CMS

Before diving into the technical details of building a school website with Strapi CMS, let’s start by understanding the key features and resources available for learning and tutorials on Strapi.

Introduction to Strapi and its Features

Strapi CMS stands out from other CMS platforms due to its ease of use and flexibility. It provides a powerful administration panel that allows users to create and manage their content, define custom content types, and set up relationships between content types. Strapi supports various field types like text, media, number, and date, allowing users to create diverse content.

One of the prominent features of Strapi CMS is its headless architecture. Unlike traditional CMS, Strapi separates the frontend and backend completely. This enables developers to use any frontend technology they prefer, such as Vanilla JS or frameworks like React or Vue.js. Strapi CMS serves as a content provider, allowing developers to fetch content through APIs and integrate it into their frontend applications seamlessly.

Resources Available for Learning and Tutorials on Strapi

Strapi is relatively new compared to other CMS platforms like Contentful or WordPress. However, the Strapi team has developed a robust community-centered ecosystem. They provide comprehensive documentation, tutorials, and video resources to help developers get started with Strapi easily.

The Strapi documentation is an excellent resource that covers a wide range of topics, including installation, configuration, and development with Strapi. Additionally, there are several online tutorials and video courses available on platforms like YouTube and Udemy, which provide step-by-step instructions on working with Strapi CMS.

Setting up and Configuring Strapi CMS

To start building a school website using Strapi CMS, you need to set up and configure the CMS on your local machine. Here are the steps to follow:

  1. Install Node.js: Strapi CMS requires Node.js to run. Install Node.js by downloading the latest stable version from the official website and following the installation instructions.
  2. Install Strapi: Open your terminal or command prompt and run the following command to install the Strapi CLI globally:
npm install strapi@latest -g
  1. Create a New Strapi Project: Once the installation is complete, create a new Strapi project by running the following command:
strapi new my-project

Replace my-project with the desired name of your project.

  1. Configure Database: Strapi supports various databases like SQLite, MySQL, MongoDB, and PostgreSQL. Choose a database according to your requirements and configure it in the ./config/database.js file of your Strapi project.
  2. Start Strapi Server: Start the Strapi server by navigating to your project directory in the terminal and running the following command:
cd my-project
npm run develop

This will start the Strapi development server on http://localhost:1337 by default.

With the Strapi CMS successfully set up and configured, we can now move on to building a school website using Strapi.

Building a School Website with Strapi CMS

In this section, I will share my experience of building a school website using Strapi CMS and provide solutions to common issues encountered during the process. Let’s explore these issues step-by-step:

  1. Successfully Installing Strapi: If you face any difficulties during the installation process, make sure you have installed the correct version of Node.js and followed the installation instructions correctly. You can also refer to the Strapi documentation or seek help from the community if needed.
  2. Resolving Installation Errors: Sometimes, you may encounter installation errors due to conflicts in dependencies or system requirements. To resolve such errors, make sure your system meets the requirements mentioned in the Strapi documentation. Additionally, try clearing your node_modules folder and running a fresh installation.
  3. Fetching Images from the CMS: Strapi CMS allows you to upload and manage images in your content. To fetch images from the CMS, you can use the Strapi API to query and retrieve the images. Here’s an example using Vanilla JS:
fetch('http://localhost:1337/uploads')
.then(response => response.json())
.then(data => {
console.log(data); // Handle the data and display the images on your website
})
.catch(error => console.error(error));
  1. Working with API ID Routes: Strapi generates unique alphanumeric IDs for each content entry. When working with API ID routes, you can use the following approach to fetch a specific content entry:
fetch('http://localhost:1337/content-type-name/id')
.then(response => response.json())
.then(data => {
console.log(data); // Handle the data and display the content on your website
})
.catch(error => console.error(error));

Replace content-type-name with the actual content type name you want to fetch, and id with the alphanumeric ID of the specific content entry.

  1. Handling Image Disappearances on Heroku with Postgres: If you deploy your Strapi backend on Heroku with a PostgreSQL database, you may occasionally experience image disappearances. To resolve this issue, make sure your Heroku PostgreSQL database has enough storage capacity. Additionally, consider using cloud storage services like AWS S3 or Cloudinary to store your images securely.
  2. Changing the Default Admin URL: By default, the Strapi admin panel is accessible at /admin. To change the default admin URL, you can modify the ./config/server.js file in your Strapi project. Set the admin.path property to the desired URL and restart the Strapi server.
  3. Deploying the Strapi Backend on Heroku: To deploy your Strapi backend on Heroku, follow these steps:
  • Create a new Heroku app and configure it with the necessary environment variables.
  • Commit and push your Strapi project to a Git repository.
  • Connect your Git repository to the Heroku app and deploy the changes.
  • Once the deployment is complete, your Strapi backend will be accessible at the Heroku app’s URL.
  1. Pushing Changes to the Strapi Backend: When making changes to your Strapi project locally, follow these steps to push the changes to the Strapi backend:
  • Make the necessary changes to your Strapi project.
  • Commit the changes to your Git repository.
  • Use a continuous integration (CI) tool or manually deploy the changes to your hosting platform.

Bonus Resources for Working with Strapi CMS

In addition to the solutions discussed above, there are several bonus resources available for developers working with Strapi CMS:

Frontend Developer Resources for Headless CMS

  • React Strapi Tutorial: A step-by-step tutorial on building a blog with Strapi and React.
  • Vue.js Strapi Tutorial: A comprehensive guide on integrating Vue.js and Strapi to build a modern web app.

Official Strapi Documentation

The official Strapi documentation provides in-depth guidance on various aspects of using Strapi CMS. It covers everything from installation and configuration to advanced topics like creating custom plugins and working with GraphQL.

Deploying Strapi with Postgres on Heroku

The Strapi documentation includes a detailed guide on deploying a Strapi backend with Postgres on the Heroku platform. This guide covers the necessary steps and configurations for seamless deployment.

Other Valuable Resources for Working with Strapi

  • Strapi YouTube Channel: The official Strapi YouTube channel hosts several video tutorials and interviews related to Strapi CMS.
  • Strapi Forum: The Strapi forum is an active community where developers can ask questions, share knowledge, and find solutions to their queries.
  • Strapi Gitter Chat: The Strapi Gitter chat is a real-time chat platform where developers can connect with other Strapi enthusiasts and get instant help.

Conclusion

In this tutorial, we have explored the top 10 solutions for mastering Strapi CMS and learned how to build a school website using the CMS with Vanilla JS. We started by understanding the need for a CMS like Strapi and compared it with other CMS platforms. We then covered the necessary steps to set up and configure Strapi CMS, including installing Node.js and creating a new Strapi project.

We dived into building a school website using Strapi CMS and discussed common issues encountered during the process, along with their solutions. Additionally, we explored bonus resources such as frontend developer tutorials, the official Strapi documentation, deploying Strapi with Postgres on Heroku, and more.

By following the solutions and resources provided in this tutorial, you can become proficient in working with Strapi CMS and leverage its benefits for your own projects. Happy coding!

Thank you for reading, and I encourage you to explore the possibilities of Strapi CMS in your future projects.

Looking for a Postman alternative?

Try APIDog, the Most Customizable Postman Alternative, where you can connect to thousands of APIs right now!

--

--

Jennie Lee
Jennie Lee

Written by Jennie Lee

Software Testing Blogger, #API Testing

No responses yet