# Why EmDash

> Evaluate EmDash's editing model, architecture, operating requirements, and trade-offs.

Source: https://emdashcmseverything.com/official-docs/why-emdash/

EmDash is a content management system built for Astro. It adds an editor-facing admin panel to the
same application as your website. Astro pages read the content from a database when they render.

This page explains that choice so you can decide whether it fits your project.

## How content reaches the site

An editor creates or updates an entry in the admin panel. EmDash saves the entry in the configured
database. When Astro renders a page, your page calls an EmDash query function and receives the
published entry.

EmDash connects those queries to [Astro's Live Content Collections](https://docs.astro.build/en/guides/content-collections/#live-collections),
which load content on demand instead of only during a build. A server-rendered page can therefore
show a published edit on its next request. A prerendered page remains static until you rebuild it.

Astro components still control the site's HTML and design. EmDash manages structured content; it is
not a visual page builder.

## Who it is for

EmDash is a good fit when all of the following are true:

- The website is built with Astro.
- Editors need to manage content without editing repository files.
- Developers want the CMS and website in one application and deployment.
- Developers can operate a database and media storage with the site.

Common examples include agency-built sites handed to client editors, an Astro site maintained by a
small development team, and a WordPress migration where the frontend is being rebuilt with Astro.

EmDash does not run PHP, WordPress themes, or WordPress plugins. It can import WordPress content, and
the migration guides explain how WordPress concepts and plugin behavior map to EmDash. The site
design and any custom plugin behavior still need to be implemented for Astro and EmDash.

## Editing and development

**Editors use the admin panel**
Editors work with forms generated from your collections and fields. Depending on their
permissions, they can manage drafts, publishing, media, taxonomies, menus, and widget areas.

**Developers use Astro**
Developers write the pages, layouts, and components that display the content. EmDash query
functions return entries, errors, pagination information, and cache hints.

**The content model can change**
Administrators can add collections and fields in the admin panel. Developers can export the
model as a seed file and generate TypeScript declarations for collection names and fields.

Generated declarations describe the model at the time they were generated. During local
development, EmDash refreshes `emdash-env.d.ts` when the model changes. Other workflows that use
`emdash types` need to regenerate their output after a schema change.

## Comparison with other Astro content sources

The following options solve different problems. A file-based collection keeps content in the
repository. A separate headless CMS runs its own admin application and supplies content over a
network API. EmDash keeps the admin and content runtime inside the Astro application.

| Decision | EmDash | File-based Astro collection | Separate headless CMS |
| --- | --- | --- | --- |
| Where editors work | Admin panel served by the Astro application | Repository files and development tools | CMS provider or separately operated admin application |
| When pages load content | When a server-rendered page is requested | During development or a site build | During a build or request, through a network API |
| Where the model is defined | EmDash database, through the admin panel or CLI | Source code in the repository | CMS configuration |
| What the team operates | Astro application, database, and media storage | Astro application and build pipeline | Astro application plus the CMS account or service |
| How releases are separated | Admin and frontend deploy together | Content and frontend usually build together | CMS and frontend deploy independently |

Choose file-based collections when content belongs in version control and contributors are
comfortable with a Git workflow. Choose a separate headless CMS when several applications need one
independently deployed content service. Choose EmDash when editors and the Astro site benefit from
one application and your team accepts the shared deployment.

## Hosting and data

EmDash supports two main deployment shapes:

- **Cloudflare Workers:** Cloudflare D1 stores content and R2 stores media.
- **Node.js:** SQLite, libSQL, or PostgreSQL stores content. The local filesystem or an
  S3-compatible service stores media.

The database contains the content model as well as entries. Administrators can change that model
while the site is running. Adding a field preserves existing entries, but the existing entries have
no value for the new field until an editor or migration supplies one.

> **Schema changes affect stored data**
>
> Deleting a field removes that field's values from every entry. Deleting a collection removes the
> collection and all of its entries. Most field type changes require a planned content migration.
> Back up production data and rehearse destructive changes before applying them.

## Plugins

Plugins can react to content and media events and add settings, routes, admin pages, dashboard
widgets, or editor controls. EmDash has two plugin formats with different trust boundaries:

- Native plugins run as part of the host application and have its access.
- Standard-format plugins can run in an isolated runtime when you configure a sandbox runner and
  grant the capabilities they need.

Review the [plugin formats](https://emdashcmseverything.com/official-docs/plugins/creating-plugins/choosing-a-format/) before choosing or building
an extension.

## Reasons to choose another approach

EmDash is unlikely to fit when the project is not built with Astro, all content must remain in the
source repository, or several unrelated frontends need a CMS that deploys independently. It also
adds operational work: the team is responsible for the database, media storage, backups, upgrades,
and the application that serves the admin panel.

If this model fits, follow [Create your first EmDash site](https://emdashcmseverything.com/official-docs/getting-started/) for a local tutorial or
[Add EmDash to an existing Astro project](https://emdashcmseverything.com/official-docs/existing-project/) for an existing application.
