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


In this tutorial I'll be showing you how I built a Vue.js app with Authentication using Cosmic JS and AWS Lambda prior to deploying to Netlify. Let's get started.
In this tutorial, Cosmic JS co-founder Tony Spiro shows you how to quickly and easily add dynamic content to your Next.js app.
When you're laser focused on writing songs, getting the most out of your studio time, and finding gigs, you can't be bothered with setting up a static site for your band or dealing with abstruse CMS systems.
To demonstrate how easy it is to get started with Cosmic JS, we'll utilize the Cosmic JS CLI to quickstart a React Auth App. This app shows implementation of Authentication in ReactJS, NextJS and NodeJS using the Cosmic JS API. This app has all the basic modules like signin, signup, view/edit profi
Build a static web page for your company or personal portfolio using the Gatsby static site generator and the Cosmic JS Content Management Platform.
One of the largest problems I’ve faced while working on projects is having to deal with integrating content and events into third-party services.It’s time consuming, and as the demands in the application in question grows, so does the mental strain in having to keep up to pace with all the changes