<!--
SPDX-FileCopyrightText: 2026 BaseLabs Holdings LLC

SPDX-License-Identifier: MIT
-->

# Connections and transports

Use this page to choose an Arcadic transport and configure connection pools,
authentication, and timeouts. `Arcadic.Conn` is a value. Its transport owns
network resources, while the application chooses the database and credentials.

| Transport | Use it for | Dependency |
| --- | --- | --- |
| HTTP | Cypher or SQL, other server-supported languages, administration, time-series, and paged reads. | Included via Req and Finch. |
| Bolt | Cypher queries, transactions, and lazy cursors, including cursors within a transaction. | `db_connection` |
| gRPC | Server-cursor streams, transactions, graph or document ingest, record CRUD, and supported database administration. | `protobuf` |

See [Compatibility](compatibility.md) for optional dependency requirements.
Arcadic keeps policy and classification in the calling application. For Ash
resources, [AshArcadic](https://github.com/baselabs/ash_arcadic) translates
Ash queries and multitenancy decisions into calls to Arcadic.

## HTTP

`Arcadic.connect/3` accepts Basic credentials as `auth: {username, password}`.
For an application-owned Finch pool, add `{Finch, name: MyApp.ArcadicFinch}`
to its supervision tree and pass `transport_options: [finch: MyApp.ArcadicFinch]`
when connecting. Use an `https://` URL for encrypted traffic. The default
transport rejects redirects with `:http_redirect`.

## Bolt

Enable ArcadeDB's Bolt plugin and add the optional dependency. Use
`Arcadic.Transport.Bolt.setup/1` to start the pool and obtain both `:bolt`
and `:bolt_opts`. Pass the entire result as `:transport_options` so queries
and streams use the same endpoint and credentials.

```elixir
{:ok, transport_options} =
  Arcadic.Transport.Bolt.setup(
    hostname: "localhost", port: 7687, username: "root", password: password
  )

conn =
  Arcadic.connect("http://localhost:2480", "mydb",
    auth: {"root", password},
    transport: Arcadic.Transport.Bolt,
    transport_options: transport_options
  )
```

Bolt negotiates protocol 4.4, 4.3, 4.2, or 4.1. Its connection options supply
the endpoint and credentials. For TLS, set `scheme: "bolt+s"` and supply
`:ssl_opts` if you need a private CA. Peer verification uses OS trust by
default. See [Compatibility](compatibility.md) for the server-side TLS fix.

Native graph, spatial, temporal, and binary values are documented in
`Arcadic.Transport.Bolt.Types`. Bolt takes Cypher only. Use a SQL-capable
connection for schema introspection and vector search.

## gRPC

Enable ArcadeDB's gRPC plugin, add the optional `protobuf` dependency, and select
`Arcadic.Transport.Grpc` with a `grpc://host:port` URL. Use `grpcs://` or
`transport_options: [tls: true]` for TLS. It verifies peers using the OS
trust store by default. Supply `:cacertfile` or `:cacerts` for a custom CA.
Providing both returns `:invalid_transport_options` when opening a channel.

Add `{Arcadic.Transport.Grpc.ChannelPool, []}` to your supervision tree to
reuse HTTP/2 connections for unary calls. The endpoint and TLS trust
configuration determine which connection a call uses. A connection opens
outside the pool process. Without the pool, each unary call has its own
connection. Cursors and streamed ingest use dedicated connections.

Use HTTP for bearer authentication, consistency bookmarks, multi-host failover,
server settings, and time-series wire requests.

## Timeouts

`:timeout` bounds each HTTP receive chunk or Bolt receive operation and sets a
gRPC deadline. With no explicit gRPC deadline, the client defaults to ten
seconds for unary RPCs and `:infinity` for streams. Set a deadline for a unary
bulk ingest that can take longer. Reconcile an `:outcome_unknown` result
before repeating the operation.

`:request_timeout` bounds the complete HTTP response, including a response
that keeps sending small chunks. Set either bound when connecting or override
it on supported calls. For HTTP paging, set the bounds on the stream call
itself. See [Stream results](../../how-to/stream-results.md).
