Skip to content

Hyperdrive

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250823.0/node_modules/@cloudflare/workers-types/index.ts:7345

readonly connectionString: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250823.0/node_modules/@cloudflare/workers-types/index.ts:7363

A valid DB connection string that can be passed straight into the typical client library/driver/ORM. This will typically be the easiest way to use Hyperdrive.


readonly database: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250823.0/node_modules/@cloudflare/workers-types/index.ts:7390


readonly host: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250823.0/node_modules/@cloudflare/workers-types/index.ts:7370


readonly password: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250823.0/node_modules/@cloudflare/workers-types/index.ts:7386


readonly port: number

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250823.0/node_modules/@cloudflare/workers-types/index.ts:7374


readonly user: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250823.0/node_modules/@cloudflare/workers-types/index.ts:7379

connect(): Socket

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250823.0/node_modules/@cloudflare/workers-types/index.ts:7357

Connect directly to Hyperdrive as if it’s your database, returning a TCP socket.

Calling this method returns an idential socket to if you call connect("host:port") using the host and port fields from this object. Pick whichever approach works better with your preferred DB client library.

Note that this socket is not yet authenticated — it’s expected that your code (or preferably, the client library of your choice) will authenticate using the information in this class’s readonly fields.

Socket