Why to consider Cosmic JS as your next CMS


First, a little backstory

When I began planning a new project for my portfolio slash blog website I knew I had several requirements. Some of which were server side rendering, ES6/ES7 transpilation, and a quick and non-complicated minifying process for builds. But lastly there is also a need for a Content Management System (CMS) and I was tired of everyone suggesting WordPress.. So I went on a hunt to find my new favorite CMS. And the one requirement I had was for it to be code agnostic, meaning if I ever migrate my site to a different technology or codebase I won't need to move all my content yet again.


What is Cosmic JS?

Cosmic JS seemed to check all the boxes for me such as being code agnostic, while being cost friendly. You essentially pay for "buckets" which could be compared to a single database. Afterwards you create object types within those buckets which can be compared to tables in a database. Your created object types then define the schema for all the objects inside, whether you need a Post object, Comment, User, whatever you can come up with!

You design the schema of metadata they will hold and their relationship to other object types. This appealed to me very much and they have an awesome NodeJS API package which fit very nicely with my NuxtJS project.


The Cosmic Interface

One of the features that really makes Cosmic shine is their user interface to modify your content, objects, and object types. When building your object metadata schema you can do so within the interface very easily. However if you'd prefer, you can also do everything with the API instead. Below is a screenshot of a developer feature for adding metafields to an object type.

The interface is non-developer friendly for content creators or editors. You can add multiple users to access your bucket and they have some great user role permission settings.

  • Admin
  • Developer
  • Editor
  • Contributor

These are very useful if you need to add additional developers, or simply someone that shouldn't see the developer features and only allowed to edit or create content. You basically get full access control over what's inside your bucket.

However, if your user does have access to the developer features they get to see a really cool toggle to switch between the different views for developer or editor.


Connecting your app to your data

Cosmic makes accessing your data very simple which is a huge plus for me as it cuts down on development time and allows for more flexibility with how you integrate your data.

You have the option to make applications with dynamic routing which could build a webpage based on a "pages" object type, and different paths for a "posts" object type. You really have a lot of freedom to create whatever you can imagine. When you have a dynamic application, adding new content or modifying existing content becomes a breeze for both content creators and developers. Which is a common challenge in today's typical environment.

Javascript API Example 

Here is a sample snippet for fetching a list of objects of a certain object type within your bucket.

const Cosmic = require('cosmicjs')
const api = Cosmic()
// Specify your bucket
const bucket = api.bucket({
  slug: 'your-unique-bucket-id',
})

// Specify an Object Type
const data = (await bucket.getObjects({
  type: 'groomsmen',
  limit: 3
})).objects

You can see more examples in the Cosmic Documentation.


Ok, Here is the Developer Stand Point

No software is perfect, I know. So what are the negatives to using something like Cosmic JS? What are the technical details surrounding Cosmic?

Well there is something called vendor lock-in which makes a customer dependent on a vendor for products and services, unable to use another vendor without substantial switching costs. While this is a factor it's minuscule compared to vendor lock-in with Microsoft's Azure, or Google cloud services (for example, because cosmic is much more than just a CMS).

I like the freedom cosmic gives you. You can pick and choose what services you want cosmic to provide you, since they do much more than allow you to just manage and store content. They can host and deploy your app, enhance your application with extensions, and host cloud functions, such as AWS Lambda which is currently in beta.


Why consider migrating your CMS?

If you value any of the advantages I've mentioned above I encourage you to create a free trial with cosmicJS and perhaps test out a proof of concept. From experience it's hard to find another CMS that compares with Cosmic for all that they provide. It's really a well-rounded service that has proven to work well with many technology stacks as being code-agnostic is very important for a content system in my opinion. So far I've been really enjoying using Cosmic in my projects, and I've said goodbye to WordPress a long time ago.


Conclusion

We welcome suggestions and submissions for new open-source projects. If you'd like to contribute and join our Community, or have any comments or questions about building apps with Cosmic JS, reach out to us on Twitter and join the conversation on Slack.

Was this article helpful?

Thank you! Your input helps us improve our articles and resources. If you have any other questions or comments, please contact support.

You may also like


Video: Build a Cosmic JS-powered blog using Gatsby
I’m going to demonstrate how to get started integrating your Cosmic-powered content with your favorite third-party applications using Zapier.
All of your images you upload to Cosmic JS are already transformed to imgix URLs, a powerful real-time image processing and CDN delivery solution. Let's take these images to the next level by optimizing image formats, compressing, intelligently cropping, & more!
Cosmic JS allows developers to deploy their codebases to the Cosmic JS App Server for staging, testing and demo purposes, and is now offering new production deployment options available with some of your favorite deployment services.
Every blog needs a solid Content Management System (CMS). This allows content owners to control their content without having to hire a developer to make every single change to their site. Cosmic JS is a great choice for a CMS. In this how-to article, we’ll connect a React/Next.js app to Cosmic JS .
5 Website Boilerplates: React, Node.js, Vue, Nuxt.js and Next.js