Skip to main content
An adapter is a named binding between the Hyperterse runtime and a database. You define the connector type and connection string in a .terse file under app/adapters/, and tools reference adapters by name through the use field. The framework handles connection pooling, health checks, and graceful shutdown.

Defining an adapter

Each adapter file declares a connector type and a connection string:
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 are resolved at runtime from environment variables. Never commit plaintext credentials — always use environment variables or a secrets manager.

Supported connectors

Hyperterse ships with four built-in connectors:

Referencing adapters from tools

Tools point to an adapter by name:
# app/tools/get-user/config.terse
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:
app
adapters
users-db.terse
analytics-db.terse
cache.terse

Lifecycle

All adapters referenced by at least one tool are initialized in parallel at startup. Each connector establishes its pool and runs a connectivity check. If any connector fails — unreachable host, invalid credentials, network timeout — the runtime exits immediately. This fail-fast behavior prevents serving tools that would error on every request. On shutdown (SIGINT / SIGTERM), all connectors close concurrently after in-flight queries complete.

Further reading

See Adapter configuration reference for the complete field specification, including driver-specific options for each connector.