> ## Documentation Index
> Fetch the complete documentation index at: https://archie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Model

> The data-model spec — a synchronized view of the tables, relationships, and types defined in your Backend → Data Model.

The Data Model spec page is a synchronized view of your project's data model. It shows the same tables, columns, relationships, and types as [Backend → Data Model](/docs/features/backend/data-model/overview) — the two surfaces edit the same underlying schema.

## Why it lives in two places

The data model is both a specification (it constrains what code Archie generates) and an operational surface (you query it, view rows, run migrations). Specifications shows it as a spec; Backend shows it with the full editor.

For most editing — adding tables, configuring fields, defining relationships, creating views, managing indexes — go to [Backend → Data Model](/docs/features/backend/data-model/overview). The spec view is read-mostly: a sidebar listing tables and types, and a panel showing the selected entity's structure.

## What's here

* **Tables** — list of all tables with their columns and types
* **Data Types** — enums and other custom types
* **Relationships** — foreign keys and cardinality (1:1, 1:N, M:N)
* **Indexes** — read-only summary; configure in Backend → Data Model

If a table or data type is selected in the sidebar, the right panel shows its full structure including field types, defaults, nullability, and relationships to other tables.

## How the data model feeds code

The data model is one of the most directly load-bearing specifications:

* **Database schema** — every table becomes a Postgres or MySQL table
* **GraphQL API** — every table generates queries (`tableName`, `tableNames`) and mutations (`createTableName`, `updateTableName`, `deleteTableName`)
* **REST API** — same operations exposed as REST endpoints
* **TypeScript types** — codegen produces typed clients from the schema

Changes to the data model regenerate the matching parts of the code on the next pass. Destructive changes (dropping columns, dropping tables) require explicit confirmation before applying.

## FAQ

<AccordionGroup>
  <Accordion title="Why can't I add tables here?">
    The full editor lives in [Backend → Data Model](/docs/features/backend/data-model/overview). Specifications is the design view; Backend is where you build, query, and migrate. Both edit the same schema.
  </Accordion>

  <Accordion title="What's the difference between this and Strategy → Data Architecture?">
    Strategy → Data Architecture is prose and diagrams describing the data design at the architecture level. Data Model is the actual table definitions — the concrete schema that becomes the database. The two work together.
  </Accordion>

  <Accordion title="If I add a table in Backend, will it show up here automatically?">
    Yes. The two views are synchronized. Edits in either place reflect in both.
  </Accordion>
</AccordionGroup>
