Author: David Fagbuyiro
In this tutorial, we will be looking at what Strapi is, how to install Strapi, and a few global key features in Strapi. I will also talk about the importance of these features with a brief explanation of the features and installation process.
An Overview of Strapi
Strapi is an open-source headless CMS for creating quick and readily-manageable APIs. It allows developers to easily create flexible API structures with a beautiful user interface.
Strapi can be used with a variety of databases, including PostgreSQL, and many others. Strapi enables users to consume APIs from a content type via Get, Post, Delete, and Put requests, mostly performed manually.
Installing Strapi
To install Strapi successfully, a few basic things must be put in place.
Strapi does not support Node 15. Only LTS versions are supported (v14 and v16). Other versions of Node.js may not be compatible with the latest release of Strapi.
We will use Node 14, so after downloading Node 14 (LTS) from the Node official site during your installation, make sure you are connected to the internet during the installation so it can download all the other attachments needed.
What is Strapi?
Strapi is an open-source, Node. JS-based, headless CMS that saves the user a variety of time-consuming tasks at the same time as giving them the liberty to apply their preferred equipment and frameworks.
How to Install Strapi
Once you have the above software installed, enter the on your Terminal the following commands:
yarn command
yarn create strapi-app my-project --quickstart
Or
npx command
npx create-strapi-app@latest my-project --quickstart
Steps to Follow After the Installation
- Open your command prompt and type the below command to confirm if it has been installed successfully and what version has been installed.
#For Node.js, you type:
node -v
#For the NPM version, type:
npm -v
- After the version confirmation, you need to enter the below command to create the first Strapi project:
npx create-strapi-app@latest my-strapiproject1
Running the above command will prompt you to choose your installation type.
- Navigate to the first option “Quickstart” with your navigation keys “up and down", then press the Enter key to proceed and follow the instructions to continue.
- The final step is to run your created project by typing the below command in your command prompt after successfully creating your first strapi project and installing the required packages.
On your terminal, navigate to the folder where strapi is installed and run the command below to start the strapi application.
npm run develop
The above command will open the registration page for the application. Once you've registered successfully, you'll be redirected to your dashboard page to manage your application.
Benefits of Using Strapi
Better Rendering
You can now produce pages at deployment time and serve them over a CDN. With Strapi and a site generator, only the most applicable zone of the mound is running when a user makes a request, speeding the entire operation by degrading the series of ways.Advanced Security
You do not have to worry about vulnerability or insecurities while utilizing Strapi with your static websites. You do not have any reason or need for a server-side language to be executed, thereby reducing your attack surface area and the threat of malware code injection.Establishment Features
Strapi Enterprise Edition includes developed Role-Based Access Control( RBAC), Single Sign On( SSO), and establishment Support.Scaling Traffic Over Cost
Because your files are loaded through the CDN, when your app gets further queries, the CDN effortlessly compensates for improved traffic.
Global Key Strapi Features
- RBAC: RBAC refers to Role Based Access Control, which is a group of operations and permissions that you can grant to users. Assigning permissions to users or user groups is more complicated than using roles to add, delete, or modify permissions. Roles become especially helpful as the size and complexity of your user base grow.
The three roles in Strapi Community Edition are:
- Super Admins: The Super Admins have access to and control of all features and settings.
- Editor: The Editors can edit, publish, and manage user-generated content.
- Authors: The authors are limited to managing and publishing the information they have produced.
You may configure all of your users in the permissions settings' user section, where you can find them all. You will have access to a created URL link upon user creation that you can provide to your new user to complete their registration.
More Custom Roles are available in the Enterprise Edition: unlimited custom roles in the Bronze, Silver, and Gold plans. The Bronze is available for free to students, open-source, and non-profits.
- Dynamic zones
Teams may design reusable content models with the least number of changes feasible with Dynamic Zones.
Dynamic zones are areas of your application where you let content editors dynamically choose what component to include. So, when you design the application, you define which components can be included in a dynamic zone when creating each content instance( e.g. the homepage). Editors then decide which component to select for that zone. A dynamic zone includes one or more components.
- Providers
Providers extend the plugin's essential capabilities, such as uploading media files to Rackspace instead of the local server or using Amazon SES for emails instead of Sendmail. Certain plugins can be enhanced by installing and configuring additional providers.
You can find a list of Providers available in the Strapi Marketplace.
Installing Providers in Strapi
The following format can be used to install new providers with npm or yarn @strapi/provider-- --save. For example, to install providers using the Aws S3:
# Install the AWS S3 provider for the Upload plugin
npm install @strapi/provider-upload-aws-s3 --save
# Install the Sendgrid provider for the Email plugin
npm install @strapi/provider-email-sendgrid --save
Configuring Providers
In the. /config/plugins.js
file, newly installed providers are enabled and configured. If this file does not already exist, it must be created. Each provider will have a unique set of configuration options. To learn more, go to the corresponding entry for that provider in the Marketplace or npm (opens a new window). The example below shows the configurations for the Upload plugins.
// path: ./config/plugins.js
module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: 'aws-s3', // For community providers, pass the full package name (e.g. provider: 'strapi-provider-upload-google-cloud-storage')
providerOptions: {
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
region: env('AWS_REGION'),
params: {
Bucket: env('AWS_BUCKET'),
},
},
},
},
// ...
});
Please, click here for the configuration of the email plugins and how to create providers after installation. Strapi's default security middleware includes a very stringent contentSecurityPolicy that limits loading images and media to "self" only. For more information, see the example setup on the provider page or the middleware documentation.
4. Draft and Publish
This Draft and Publish feature allows you to leave your content as a draft and publish it at a later time using the draft and publish tool. The draft and publish feature is turned on for all newly generated collections and single types. However, the feature can be turned off at the content-type level (i.e. it can be enabled for one content-type but disabled for another).
To use the Draft and Publish feature in Strapi, you need to have your content-type already created. You can create a collection type using the collection type builder plugin.
Once you are done with that, from the sidebar, navigate through Content Manager > Select Collection Type and click on Create a New Entry.
Fill in the input you want to display and click on the Save button. Now we are done with the draft, the next step is to publish your article. Click on the publish button beside the save button. That is how to use the Draft and Publish feature in Strapi.
To deactivate the draft and publish feature for a content-type:
- Select Content-type Builder under Plugins on the sidebar.
- Choose the collection or individual type for which you wish to disable the draft and publish function.
- To access the configuration, click the Edit button.
- Select "Advanced Settings" from the tab.
- Select the FALSE option in the DRAFT/PUBLISH area.
- To confirm the feature's removal, click the Finish button.
Note: Some roles and permissions may be necessary for publishing content. For instance, the default roles in the community version only permit authors to generate and edit drafts, whereas editors are allowed to publish content.
Unpublishing Content
Published contents may be taken down and reverted to draft status. Click on the Unpublish button in the content editor's top right corner to remove content from publication.
Internationalization in Strapi
As a Strapi user, you can develop, manage, and distribute localized content in several languages, or "locales," using the Internationalization (i18n) plugin. Refer to the W3C definition for more details on the idea of internationalization.
The i18n plugin allows admin panel users to generate several localized versions of their content (see user guide). It also permits developers to create localized projects by collecting and consuming the appropriate content based on the user's country/language.
All Strapi applications running version 3.6.0 or higher include the Internationalization plugin by default. Lower versions require a migration (see Update Strapi version) as well as manual installation of the plugin.
The plugin can be installed using the Terminal by running one of the following commands:
npm run strapi install i18n
Features of the Internationalization Plugin (i18n)
The i18n plugin is beneficial in so many ways. Let’s discuss some of the features of the i18n plugin.
- Flexibility: It uses various components and modifies the structure of each locale as well as dynamic zones.
- Clear Navigation: When reviewing the list of contents or updating an entry, you can easily switch between locales.
- Smooth Editing: With a single click, you can copy and paste text from one locale to another, keeping some content consistent across all locales.
How to Add a New Language to Locales:
To add “Spanish” to our language locales:
- Click on “Settings” under the “General” section.
- Click on “Internationalization” right under the “Global Settings”.
- Click on “Add new Locale.”
- Select “Spanish (es)” in the Locales section and then save.
Conclusion
Understanding the Strapi features play an important role in content management. I hope after going through this article, you now understand how to install Strapi, the version of node.js that works with Strapi, some key features to know about Strapi and the main roles of the users in the Strapi community edition according to RBAC. You also learned the installation of the internationalization plugin and how to add a new language to our Locales. For more Strapi features and installation please visit the Strapi marketplace.