> ## 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.

# Overview

> The Data Model is where you design your app's database schema, define relationships, and configure data validation.

The Data Model is where you design your app's database schema, define relationships, and configure data validation. Every change is published in real time and stays in sync with the auto-generated GraphQL and REST APIs that your frontend and integrations consume.

## What lives in the Data Model

The Data Model sidebar groups the schema into three item types:

| Item type      | What it is                                                  | Where to learn more                                   |
| -------------- | ----------------------------------------------------------- | ----------------------------------------------------- |
| **Tables**     | The standard database tables that store your records.       | [Tables](/features/backend/data-model/tables)         |
| **Views**      | Virtual tables defined by a saved SQL `SELECT` query.       | [Views](/features/backend/data-model/views)           |
| **Data Types** | Reusable named enums you can apply to fields across tables. | [Data Types](/features/backend/data-model/data-types) |

## The two tabs on every table

When you open a table, you switch between two tabs:

* **Schema** — the visual schema designer. Add and remove fields, configure validation, define relationships, and create indexes. See [Tables](/features/backend/data-model/tables) and [Fields](/features/backend/data-model/fields).
* **Data** — a spreadsheet-style viewer for the records inside the table. Add, edit, filter, sort, import, and export rows. See [Data Viewer](/features/backend/data-model/data-viewer).

## Auto-generated APIs

Every table and view in the Data Model is automatically exposed through:

* A **GraphQL API** with type-safe queries, mutations, and real-time subscriptions. See the [GraphQL API Explorer](/features/backend/graphql-api-explorer/overview).
* A **REST API** with CRUD endpoints per table. See the [REST API Explorer](/features/backend/rest-api-explorer/overview).

When you add, rename, or remove a field, both APIs update immediately. You don't write resolvers, controllers, or routes by hand.

## Schema is stored as structured JSON

The Data Model is persisted as a structured JSON representation of your schema, not flat SQL files. Code generation reads from this representation so the rest of your project — types, queries, validation — stays in sync. You configure the model through the UI; you don't edit raw SQL files.

## Permissions live elsewhere

Per-table access control is **not** configured inside the Data Model. Every table is governed by role-based permissions defined in **App Services → Role-Based Access**. See [Role-Based Access](/features/backend/app-services/role-based-access).

## Where to go next

<CardGroup cols={2}>
  <Card title="Tables" icon="table" href="/features/backend/data-model/tables">
    Create, rename, and delete tables.
  </Card>

  <Card title="Fields" icon="list" href="/features/backend/data-model/fields">
    The 9 field types and their configuration options.
  </Card>

  <Card title="Data Types" icon="tags" href="/features/backend/data-model/data-types">
    Reusable enums shared across tables.
  </Card>

  <Card title="Views" icon="eye" href="/features/backend/data-model/views">
    Virtual tables defined by a SQL query.
  </Card>

  <Card title="Indexes" icon="bolt" href="/features/backend/data-model/indexes">
    Speed up lookups and enforce uniqueness.
  </Card>

  <Card title="Relationships" icon="diagram-project" href="/features/backend/data-model/relationships">
    Foreign keys and cardinality between tables.
  </Card>

  <Card title="Data Viewer" icon="grid" href="/features/backend/data-model/data-viewer">
    Browse and edit records.
  </Card>

  <Card title="Importing & exporting" icon="file-csv" href="/features/backend/data-model/importing-data">
    Move data in and out via CSV.
  </Card>
</CardGroup>

## FAQ

<AccordionGroup>
  <Accordion title="Do I need to write SQL to use the Data Model?">
    No. You design tables, fields, relationships, and indexes through the visual UI. The only place SQL is required is when you create a [View](/features/backend/data-model/views), which is defined by a saved `SELECT` query.
  </Accordion>

  <Accordion title="What database is Archie running under the hood?">
    Each workspace gets a dedicated PostgreSQL database. The Data Model maps directly to PostgreSQL tables, columns, indexes, and enum types.
  </Accordion>

  <Accordion title="Where do I configure who can read or write each table?">
    Permissions live in [App Services → Role-Based Access](/features/backend/app-services/role-based-access), not in the Data Model. The Data Model defines the shape of your data; Role-Based Access governs which user types can read, write, or administer it.
  </Accordion>

  <Accordion title="Do I have to update my GraphQL or REST endpoints when I change the schema?">
    No. Both APIs are generated from the Data Model and refresh automatically whenever the schema changes.
  </Accordion>

  <Accordion title="Can I edit the schema as raw SQL files in my repo?">
    No. The schema is stored as structured JSON, not SQL files. Use the Data Model UI to make changes — code generation and the auto-generated APIs read from that representation.
  </Accordion>
</AccordionGroup>
