
Security News
Feross on TBPN: Socket's Series C and the State of Software Supply Chain Security
Feross Aboukhadijeh joins TBPN to discuss Socket's $60M Series C, 500%+ ARR growth, AI's impact on open source, and the rise in supply chain attacks.
@agentuity/drizzle
Advanced tools
Drizzle ORM integration with resilient PostgreSQL connections for Agentuity projects
Drizzle ORM integration with resilient PostgreSQL connections for Agentuity projects.
bun add @agentuity/drizzle
import { createPostgresDrizzle, pgTable, text, serial, eq } from '@agentuity/drizzle';
// Define your schema
const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
email: text('email').notNull().unique(),
});
// Create database instance (uses DATABASE_URL by default)
const { db, close } = createPostgresDrizzle({
schema: { users },
});
// Execute type-safe queries
const allUsers = await db.select().from(users);
const user = await db.select().from(users).where(eq(users.id, 1));
// Insert data
await db.insert(users).values({ name: 'Alice', email: 'alice@example.com' });
// Clean up when done
await close();
import { createPostgresDrizzle } from '@agentuity/drizzle';
import * as schema from './schema';
const { db, client, close } = createPostgresDrizzle({
// Connection string (defaults to DATABASE_URL)
connectionString: 'postgres://user:pass@localhost:5432/mydb',
// Your Drizzle schema
schema,
// Enable query logging
logger: true,
// Reconnection settings
reconnect: {
maxAttempts: 5,
initialDelayMs: 100,
maxDelayMs: 30000,
},
// Callbacks
onConnect: () => console.log('Connected to database'),
onReconnected: () => console.log('Reconnected to database'),
});
// Access connection statistics
console.log(client.stats);
// { connected: true, reconnecting: false, totalConnections: 1, ... }
import { createPostgresDrizzle, drizzleAdapter } from '@agentuity/drizzle';
import { createAuth } from '@agentuity/auth';
import * as schema from './schema';
// Create database instance
const { db, close } = createPostgresDrizzle({ schema });
// Create auth with Drizzle adapter
const auth = createAuth({
database: drizzleAdapter(db, {
provider: 'pg',
}),
});
The client property gives you access to the @agentuity/postgres client for raw queries:
const { db, client, close } = createPostgresDrizzle({ schema });
// Use Drizzle for type-safe queries
const users = await db.select().from(schema.users);
// Use the client for raw queries
const result = await client`SELECT NOW()`;
// Check connection status
if (client.connected) {
console.log('Database is connected');
}
// Access connection statistics
console.log(client.stats);
import {
sql,
eq,
and,
or,
not,
desc,
asc,
gt,
gte,
lt,
lte,
ne,
isNull,
isNotNull,
inArray,
notInArray,
between,
like,
ilike,
} from '@agentuity/drizzle';
import {
// Table and schema
pgTable,
pgSchema,
pgEnum,
// Column types
text,
varchar,
char,
integer,
smallint,
bigint,
serial,
smallserial,
bigserial,
boolean,
timestamp,
date,
time,
interval,
json,
jsonb,
uuid,
numeric,
real,
doublePrecision,
inet,
cidr,
macaddr,
macaddr8,
// Constraints
primaryKey,
foreignKey,
unique,
uniqueIndex,
index,
check,
} from '@agentuity/drizzle';
import {
postgres,
PostgresClient,
type CallablePostgresClient,
type PostgresConfig,
type ReconnectConfig,
type ConnectionStats,
} from '@agentuity/drizzle';
import { drizzleAdapter } from '@agentuity/drizzle';
Creates a Drizzle ORM instance with a resilient PostgreSQL connection.
| Parameter | Type | Description |
|---|---|---|
config.connectionString | string | PostgreSQL connection URL. Defaults to DATABASE_URL |
config.connection | PostgresConfig | Full connection configuration object |
config.schema | TSchema | Drizzle schema for type-safe queries |
config.logger | boolean | DrizzleLogger | Enable query logging |
config.reconnect | ReconnectConfig | Reconnection behavior configuration |
config.onConnect | () => void | Called when initially connected |
config.onReconnected | () => void | Called after successful reconnection |
| Property | Type | Description |
|---|---|---|
db | BunSQLDatabase<TSchema> | The Drizzle database instance |
client | CallablePostgresClient | The underlying postgres client |
close | () => Promise<void> | Cleanup function |
Apache-2.0
FAQs
Drizzle ORM integration with resilient PostgreSQL connections for Agentuity projects
The npm package @agentuity/drizzle receives a total of 1,471 weekly downloads. As such, @agentuity/drizzle popularity was classified as popular.
We found that @agentuity/drizzle demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Feross Aboukhadijeh joins TBPN to discuss Socket's $60M Series C, 500%+ ARR growth, AI's impact on open source, and the rise in supply chain attacks.

Security News
OSV withdrew 157 OSV malware reports after automated false positives incorrectly flagged trusted npm and PyPI packages, sending bad records into tools that rely on OSV data.

Research
/Security News
TrapDoor crypto stealer hits 36 malicious packages across npm, PyPI, and Crates.io, targeting crypto, DeFi, AI, and security developers.