# How DSUI works

> Learn how services, adapters, and plugins fit together, and where your credentials stay.

DSUI is a workspace for the services in your data stack. It doesn't replace those services. It connects to them, shows their workflows in one place, and keeps service-specific behavior inside adapters.

## The building blocks

- **Workspace**: the DSUI app you open in your browser. It lists your services and shows the pages each adapter provides.
- **Service**: one configured connection to a data tool, such as a PostgreSQL database or an Airflow instance. You declare services in `dsui.yaml` or add them in the workspace.
- **Adapter**: code that teaches DSUI to work with one kind of service. DSUI builds each adapter from source and runs it in its own subprocess.
- **Plugin**: trusted code that extends the whole installation with pages, background jobs, settings, and authentication. DSUI loads plugins into the server process.
- **DSUI Agent**: a process that forwards requests to services inside a private network. See [private networks](/docs/guides/private-networks).

## From configuration to workspace

`dsui.yaml` declares the adapters DSUI loads and the services that use them. DSUI replaces `${NAME}` with the value of the environment variable `NAME`, so credentials stay out of the file:

```yaml {2,9}
adapters:
  postgresql:
    source: git
    repository: "git+https://github.com/northgraindata/dsui"
    path: packages/adapter-postgresql

services:
  - id: warehouse
    adapter: postgresql
    name: Application database
    connection:
      host: postgres
      database: app
      username: ${POSTGRES_USER}
      password: ${POSTGRES_PASSWORD}
```

At startup, DSUI validates this file, builds each adapter listed under `adapters`, and connects each service to its adapter. If an adapter fails to build, the workspace still starts without it and the terminal names the adapter that failed.

The key under `adapters` must match the ID the adapter declares. DSUI refuses to load an adapter registered under a different ID.

## How a request flows

```text
Browser
  -> DSUI server
  -> adapter subprocess
  -> your service
```

The browser talks only to the DSUI server. The server runs resources and actions in the adapter subprocess, and the adapter calls your service with the credentials from your configuration. Credentials stay on the server, so the pages the browser receives never contain them.

## What an adapter provides

- **Connection methods**: how DSUI reaches the service, for example `memory` or `file` for DuckDB.
- **Resources**: read-only data from the service, with a refresh policy.
- **Actions**: commands that change something, such as running a query or restarting a job.
- **Pages**: workflows built from DSUI's shared components.
- **Stores**: state kept for an adapter or a page.
- **Jobs and signals**: background work and events about a service.

## Adapters and plugins

| | Adapter | Plugin |
| --- | --- | --- |
| Scope | One kind of service | The whole installation |
| Where it runs | Isolated subprocess | The DSUI server process |
| Typical use | Show and operate a database or an orchestrator | Add a page across services, react to events, authenticate people |
| Built with | [Adapter SDK](/docs/adapter-sdk/overview) | [Plugin SDK](/docs/plugin-sdk/overview) |

## Access control

DSUI defines four roles: `owner`, `admin`, `operator`, and `viewer`. A viewer can inspect, an operator can also run actions, and an admin or owner can also change configuration.

DSUI has no sign-in of its own. Without an authentication plugin, every request runs as a local owner. If more than one person uses your installation, put DSUI behind a reverse proxy that handles sign-in, or install an authentication plugin.

![Services connected to one DSUI workspace](/docs/assets/dsui-runtime-overview.png)
