Static, Decoupled and Headless Modes

Cosmos has three different modes of content delivery: Static, Decoupled and Headless.  You can use one mode or mix and match depending on your needs.  Here we describe each and give tips on which might be right for you. 

Static Mode

“Static” is the simplest, lowest cost to operate, highly available, and best performing of all options. It consists of four components as shown below:  a database, the content editor app, and the static website. The editor app automatically publishes pre-rendered web pages to storage that hosts files for the static website.

Here are some reasons to choose this option:

1. Automatic High Availability and Redundancy

Cosmos uses Cosmos DB as its database and in this mode, it uses Azure Storage accounts to host your website. By making small changes to configuration, each can be automatically replicated in multiple zones within a region, and/or replicated in different regions (for example US West and US East).

2.High Performance

Static websites are typically faster because they serve pre-rendered HTML files directly. This reduces server processing time and speeds up page load times.

3. Scalability

Since static files can be easily cached and distributed across multiple regions and/or zones, static websites can handle a large number of simultaneous requests without putting much strain on the server.  Add a CDN and Cosmos scalability is as good as it gets with any system.

4. Security

Static websites have fewer attack vectors compared to dynamic websites because they don't rely on server-side processing or databases. This reduces the risk of security vulnerabilities and makes them more resilient under high traffic conditions.

5. Reliability

With fewer moving parts and dependencies, static websites are less likely to experience downtime or performance issues, even under heavy traffic.

6. Low Cost to Host

Static websites are inexpensive to host and operate.  Azure storage accounts are free, and the only cost is storage consumption and outbound bandwidth. The Editor application requires an App Service Plan and Cosmos DB has an inexpensive “serverless” mode. Taken together the cost of hosting both can easily be well under $15 a month.

Decoupled Mode

Decoupled mode separates the “editor” (where content is created and managed) from the frontend (where content is presented to users).  Static assets like images, CSS and JavaScript files are still stored in BLOB storage with a static website like with Static Mode, but the HTML web page is dynamically generated by the “Publisher.”

Here are some reasons to choose this option:

1. Real-time Web Page Updates

Use this mode if your website needs web pages that have to be updated in real time. Near-static website performance is achieved because static assets are still hosted by a static website backed by BLOB storage.

2. Require Authentication

Not all websites are for anonymous access.  The publisher can be configured to require users to be authenticated. It can also proxy static assets from BLOB storage with authentication required.

3. Need dynamic functionality

The publisher also has functionality that the static website does not, such as an API for supporting customer contact forms, PowerBI integration, and a simple search functionality.  Modify the publisher to add your own capabilities.

Headless Mode

Like Decoupled Mode, headless separates the “editor” from the publisher. Unlike decoupled mode where the publisher emits web pages in HTML, in this case the publisher emits content through a REST API.

Here are some reasons to use Headless Mode: 

1. Omnichannel Delivery

Content can be delivered to multiple platforms (websites, mobile apps, IoT devices, etc.) through APIs, ensuring a consistent experience across all channels.

2. Flexibility for Developers

APIs and microservices architecture make it easier for developers to integrate and extend functionalities, leading to faster development cycles. This mode is well suited for web developers using Angular, React, Vue and others; and integrates easily for those using Android or iOS.