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

# Adapters

> Named database connections that tools reference for query execution.

An adapter is a named binding between Hyperterse and your database. You declare the connector and connection string in an adapter config file; tools point at adapters by name with the `use` field. The framework handles pooling, health checks, and graceful shutdown.

## Defining an adapter

Each adapter file declares a connector type and a connection string:

```yaml theme={null}
name: primary-db
connector: postgres
connection_string: '{{ env.DATABASE_URL }}'
options:
  sslmode: require
```

The `connector` field selects the database engine. The `connection_string` accepts `{{ env.VAR }}` placeholders, which Hyperterse resolves from environment variables when the server starts. Never commit plaintext credentials — always use environment variables or a secrets manager.

## Supported connectors

Hyperterse ships with many built-in connectors:

<CardGroup cols={2}>
  <Card title="PostgreSQL" icon="database" href="/databases/postgresql">
    SQL queries via `postgresql://` connection strings.
  </Card>

  <Card title="MySQL" icon="database" href="/databases/mysql">
    SQL queries via DSN-format connection strings.
  </Card>

  <Card title="SQLite" icon="database" href="/databases/sqlite">
    Local SQLite files and remote libSQL/Turso over HTTP.
  </Card>

  <Card title="MongoDB" icon="leaf" href="/databases/mongodb">
    JSON command payloads via `mongodb://` connection strings.
  </Card>

  <Card title="Redis" icon="bolt" href="/databases/redis">
    Key-value operations via `redis://` connection strings.
  </Card>
</CardGroup>

## Referencing adapters from tools

Tools point to an adapter by name:

```yaml theme={null}
# excerpt from a tool definition
use: primary-db
statement: 'SELECT * FROM users WHERE id = {{ inputs.user_id }}'
```

A project can define multiple adapters, and different tools can reference different ones:

<Tree>
  <Tree.Folder name="app" defaultOpen>
    <Tree.Folder name="adapters" defaultOpen>
      <Tree.File name="users-db.terse" comment="PostgreSQL for user data" />

      <Tree.File name="analytics-db.terse" comment="MySQL for analytics" />

      <Tree.File name="cache.terse" comment="Redis for caching" />
    </Tree.Folder>
  </Tree.Folder>
</Tree>

## Lifecycle

Every adapter your tools use starts in parallel when the server boots. Each connector opens its pool and checks connectivity. If any check fails (bad host, credentials, timeout), Hyperterse exits so you do not serve tools that would fail every call.

On shutdown (`SIGINT` / `SIGTERM`), all connectors close concurrently after in-flight queries complete.

## Further reading

See [Adapter configuration reference](/reference/adapter-config) for the complete field specification, including driver-specific options for each connector.
