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

> ## Agent Instructions
> The docs are served at https://docs.devias.io. Every path in these docs is relative to that root: /llms.txt is https://docs.devias.io/llms.txt.
> Devias is an open-source platform that works as an operating system for a business: a core (records, views, workflows, agents, permissions) with installable modules.
> Pages are typed by folder. concepts/ explains what things are, guides/ gives procedures, reference/ is exhaustive (SDK, CLI, HTTP API), operate/ covers hosting. Use /start/glossary for exact terms.
> Every id in a module (module, object, field, view, action, workflow, step, connection, variable, event, policy) is a uuid. Generate them with `devias id <count>`. Never invent dotted or readable ids.
> Run `devias plan` and read its output before `devias apply`. Apply only what the plan says.
> The OpenAPI document, including the routes of the modules in the reference setup, is at /reference/api/openapi.json.
> Devias is young and changes quickly. If a page and the source repository (github.com/devias-io/devias) disagree, the repository is right.

# Database

> How Devias stores data. Compares the embedded PGlite database (the default when DATABASE_URL is unset) with PostgreSQL 18, shows the local Docker Compose Postgres on port 5433, and explains migrations, MIGRATE_ON_BOOT and pnpm db:migrate.

Devias stores its data in PostgreSQL. Records are kept as JSON, so adding a field never means changing a table.

## Embedded database or Postgres

| | Embedded | Postgres |
| - | - | - |
| **Use it for** | Trying Devias, development, small demos | Anything real |
| **Setup** | None | A Postgres 18 database and a connection string |
| **Where the data is** | A folder on the server's disk | Your database |

The embedded database is PGlite: Postgres compiled to run inside the server. It is what you get when `DATABASE_URL` is not set, and its files are kept in `apps/server/.data/pglite` (change it with `PGLITE_DATA_DIR`).

## Use Postgres

Point the server at a database with `DATABASE_URL`:

```bash theme={"dark"}
DATABASE_URL=postgres://user:password@host:5432/devias
```

For local work, the repository includes a Docker Compose file with a ready-made Postgres:

```bash theme={"dark"}
docker compose up -d postgres
```

It listens on port 5433, with the user, password and database all named `devias`. It is for development only.

## Migrations

The database schema is created and updated by **migrations**, plain SQL files in `apps/server/drizzle`.

* On the embedded database they run automatically when the server starts.
* On Postgres they don't, unless you set `MIGRATE_ON_BOOT=1`. Otherwise, run them yourself before starting a new version:

```bash theme={"dark"}
pnpm db:migrate
```

> [!WARNING]
>
> Back up your database before upgrading, as you would for any application. Everything your team creates is stored there.

## Related

* [Deploy](https://docs.devias.io/operate/deploy.md): run the server and the studio.
* [Environment variables](https://docs.devias.io/operate/environment.md): every setting in one table.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.