Git-Based Vs API-Centric Headless CMS
Since monolithic CMS (content management system) platforms like WordPress and Drupal were popularized in the mid 2000s, the web development ecosystem has changed considerably. Most recently, with the advent of mobile devices, the shift has been towards content delivery that is decoupled from the various frontends it is served to.
Traditional CMS platforms still make up a large portion of the total market share, but due to many drawbacks, including poor performance, security concerns, cost, and lack of developer freedom, the headless CMS ecosystem is growing rapidly - both among smaller businesses and large enterprises.
Within the headless CMS space, there are 2 main approaches: API-centric and Git-based. This article will discuss some of the trade-offs of choosing either type of headless CMS, depending on the types of projects your company is working on.
Overview of Git-based vs API-centric CMSs
The headless CMS ecosystem is still relatively new - and to date, the 2 main approaches have been either Git-based or API-centric solutions.
The Git version control system (VCS) is a technology that stores developer files in a repository and tracks changes made over time. Repositories can be branched and merged, allowing teams to make changes without the risk of making permanent breaking changes to code while it is being tested.
A Git-based CMS is able to manage the content in a user-friendly interface, and integrate with the Git repository to update changes made, which then triggers a rebuild of the frontend. Typically, this is done online using platforms like GitHub, which can be accessed easily by remote teams.
An API (application programming interface) is how applications communicate with each other and send/consume data. An API-centric CMS allows content creators to manage their content in a user-friendly interface, which will update their content data in a database.
This data, typically in REST or GraphQL format, can then be consumed by their applications (either server-side, or directly by the frontend, depending on the type of project).
Git-Based CMS Trade-offs
As Git-based CMSs are dependent on the Git version control system, there are some trade offs related to this approach:
- Git comes with backup functionality built in, reducing risk of breaking changes.
- Most developers already use Git for their frontend code, so keeping content in the same space can be convenient and easy to keep track of.
- No vendor lock-in - Git is an open source technology used by most developers in the industry.
- Low cost and ease of use - Git and most Git-based CMSs are free (or low-cost) to use and easy to set up.
- Not as scalable for multiple front ends.
- Not as robust for updating live or heavy static content, due to limitations of Git architecture.
- Data querying limitations, compared to a dedicated API customized for frontend consumption.
API-Centric CMS Trade-offs
API-centric CMS are more difficult to generalize, since the differences among platforms in this category may vary widely in terms of features and functionality.
- Better suited for applications serving multiple frontends, especially when those frontends are consuming customized API endpoints.
- Able to handle large, complicated data sets more effectively than Git-based CMSs.
- More robust at handling content that changes frequently.
- More customizable - there are very few limitations in terms of how API-centric CMS are built, as they do not need to conform to Git.
- Backup is not automatically built-in, as with Git.
- Many API-centric CMSs are SaaS offerings, which can become expensive if storage or performance requirements are increased.
- Self-hosted API-centric CMSs can require a lot of developer overhead to set up and maintain.
- More complexity overall - integrating your API-centric CMS with your application can involve more developer involvement to ensure APIs are being managed and/or consumed properly.
Comparing the Pros and Cons of Each Approach
Both Git-based and API-centric headless CMSs are effective solutions compared to legacy monolithic CMSs, but developers will need to choose which approach works best for them, depending on their requirements.
Convenience of Working with a Git-based CMS
The most obvious benefit of choosing a Git-based CMS is that most developers are already familiar with this system, and using it for their frontend code. Adding a Git-based CMS is typically free (or very low cost) and relatively easy to set up - giving content creators a way to update their content without having to make a request to a developer each time.
Lack of Overall Scalability
Git-based CMSs work well when you understand the scale of your project and plan your content and data formats ahead of time, optimized for the frontends you need. For scaling to much larger projects with multiple frontends, however, the Git-based approach is likely to run into limitations.
Customizability of Working with an API-centric CMS
APIs are the universal format for data consumption, meaning they can integrate with basically any type of frontend and be optimized accordingly. Whether your CMS has a single API gateway to handle all frontends, or even a BFF (‘backend for frontends’) architecture to customize endpoints for each frontend, the result is that you can scale your application almost without limit.
In terms of ‘future proofing’ your project, the API-centric approach is nearly always going to be the better option, assuming this is within the scope of your project.
Higher Developer Overhead
When dealing with API management, developers will need to be involved to ensure the APIs are working properly, securely, and efficiently. This may be overkill for some smaller projects, and will depend on the specific use-cases of your application.
Common Use Cases
The following are some of the more common use cases for both Git-based and API-centric CMSs:
SSG (Static Site Generator) Websites
SSG websites are increasing in popularity, spurred on by the expansion of the Jamstack ecosystem. Popular frameworks like Jekyll, Hugo, Gatsby, Gridsome, Next and Nuxt are ideal for building static websites that can be served on CDNs at blazing speeds.
While both Git-based and API-centric CMS are excellent choices for managing content on SSG sites, Git-based are particularly simple and easy to set up for smaller projects like blogs, portfolio sites, or simple landing pages.
For more complicated sites used by large enterprises, API-centric architecture will nearly always be preferred.
E-commerce sites built with next-generation frameworks like React, Vue, or Angular will benefit from headless CMSs. Similar to SSG websites, the size and complexity of the project will determine the best approach to take - for simpler and smaller projects, the Git-based approach is more likely to be feasible, while projects aiming for scalability and ‘future-proofing’ their growth should strongly consider an API-centric approach.
If your goal is to create a multi-platform application using many different frontends (like different native apps for mobile devices), then you will almost certainly need to take an API-centric approach when choosing a CMS.
Git-based integrations can also work, depending on the project, but will be limited compared to having a robust API powering your different frontends.
Microservice Heavy Architecture
If your project is complex, and consuming data from many different sources, then you will also want to strongly consider an API-centric approach to choosing your CMS. Most good API-centric headless CMSs will have API gateway functionality built in, allowing you to bundle different microservices for your front ends to consume. This can be much more difficult using Git-based integrations as the application grows in scale and complexity.
So, Which Approach Should I Choose?
As discussed, both approaches are excellent, depending on your requirements. If you are building a simpler or leaner project in which you prefer to keep developer overhead and costs to a minimum, then you should consider the advantages of a Git-based approach. This will also ensure that your content is backed up.
For larger projects requiring more customization and scalability, and when you want to ‘future proof’ your work as it grows over time, then you should strongly consider taking an API-centric approach.
Have any Questions?
If you'd like to know more about headless CMS solutions for your enterprise, please don't hesitate to reach out to our team to answer any of your questions.