In the battle between KeystoneJS vs Strapi, traditional vs headless CMSs’, which one is a better fit for you?
What is a CMS? A Content Management System is a developer-friendly application that can be used to manage the creation and modification of digital content. A CMS should have all the needed functionality everyday users need, and should be developer-friendly too; it should integrate to any modern JS front-end framework, and power your website with high speed. Keystone Js and Strapi are both popular CMSs’, with Strapi being more popular than Keystone Js currently.
npm init keystone-app my-keystone-app
cd my-keystone-app yarn dev
Sign in to the admin panel using the initially generated user credentials
Example ‘list’ model:
Creating “lists” in keystone is easy, here are 2 examples:
Adding a todo using the auto-generated admin ui:
To use Keystone’s API, we make a POST with a query to “/admin/api”
Keystone’s starter “todo” project’s front-end:
What is Strapi & why should I use it? Strapi markets itself as an efficient API creation tool, that helps you get an application up and running quickly.
OPTIONAL: Strapi Docker
Using this docker file should allow you to follow along regardless of your operating system: https://github.com/shahinrostami/stra…
yarn create strapi-app my-project --quickstart npx create-strapi-app my-project --quickstart
Now that our project is created, we have a final step to create our first administrator login. To do so, navigate to http://localhost:1337/admin
Once our admin user is created, we’re redirected to the Admin dashboard. From here, you can manage and configure your API quickly.
Let’s create our own content type!
We can do this through the admin panel using the default content-type builder plugin.
Click “+ create new collection type”, here I’m creating a collection “Notes,” then continue.
Here, we have different types of data supported by Strapi and some example use cases.
Choose ‘text’, here we’re adding the name of who created the note
Using advanced settings, we can add “Anonymous” as our default value for our “Name” field, and make it a required input.
We can quickly add additional fields to our Notes collection type by clicking “+ Add another field.” Once finished, click continue.
Be sure to click “Save” once finished building your content type. Our Strapi server needs to restart.
When it’s done, our content type is ready to view through the admin panel.
If we click ‘+ Add New Note,’ we can create our first note through the admin panel. Click save, now you can see our newly-created note in this list.
Quickly add a second note. Now we’re going to interact with our API and content using web requests. Navigate to https://localhost:1337/Notes DOCKER: https://YOUR_IP_ADDRESS/Notes
Currently, we get a 403 status because we don’t have permission to do this. For the purpose of this demo, let’s expose all of our actions publically. This is for demonstration purposes only!
Navigate to Roles & Permissions in the admin panel, choose ‘Public’ from the list and ‘select all’ under Permissions. Then click ‘Save.’
Now, navigate back
Using a CMS is a better option if you’re creating a large website or will make additions to your site down the line. A good CMS will make it easier to do things like edit existing pages, publish new pages, add an online store, create web forms, and so forth. In my opinion; if you’re looking for something to run a small site, that’s not for a client, not much risk, I believe Keystone Js is great for node.js developers. Else, I would use Strapi.
Cassandra.Link is a knowledge base that we created for all things Apache Cassandra. Our goal with Cassandra.Link was to not only fill the gap of Planet Cassandra, but to bring the Cassandra community together. Feel free to reach out if you wish to collaborate with us on this project in any capacity.
We are a technology company that specializes in building business platforms. If you have any questions about the tools discussed in this post or about any of our services, feel free to send us an email!
Subscribe to our monthly newsletter below and never miss the latest Cassandra and data engineering news!