
Security News
/Company News
Socket Is Sponsoring Composer and Packagist
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.
@fluojs/drizzle
Advanced tools
Drizzle ORM integration for Fluo with ALS transaction context, async module factory, and optional dispose hook.
English 한국어
Drizzle ORM integration for fluo with a transaction-aware database wrapper and an optional dispose hook.
npm install @fluojs/drizzle
current() seam that switches between the root handle and the active transaction handleimport { ConfigService } from '@fluojs/config';
import { Module } from '@fluojs/core';
import { DrizzleModule } from '@fluojs/drizzle';
import { drizzle } from 'drizzle-orm/node-postgres';
import { Pool } from 'pg';
@Module({
imports: [
DrizzleModule.forRootAsync({
inject: [ConfigService],
useFactory: async (config: ConfigService) => {
const pool = new Pool({
connectionString: config.getOrThrow<string>('DATABASE_URL'),
});
return {
database: drizzle(pool),
dispose: async () => {
await pool.end();
},
};
},
}),
],
})
export class AppModule {}
DrizzleDatabase.current() inside repositoriesimport { DrizzleDatabase } from '@fluojs/drizzle';
import { eq } from 'drizzle-orm';
import { users } from './schema';
export class UserRepository {
constructor(private readonly db: DrizzleDatabase) {}
async findById(id: string) {
return this.db.current().select().from(users).where(eq(users.id, id));
}
}
await this.db.transaction(async () => {
const tx = this.db.current();
await tx.insert(users).values(user);
await tx.insert(profiles).values(profile);
});
import { UseInterceptors } from '@fluojs/http';
import { DrizzleTransactionInterceptor } from '@fluojs/drizzle';
@UseInterceptors(DrizzleTransactionInterceptor)
class UsersController {}
DrizzleTransactionInterceptor runs each HTTP request through DrizzleDatabase.requestTransaction(...). During application shutdown, DrizzleDatabase aborts any still-active request transaction, waits for its transaction callback to settle or roll back, and only then runs the optional dispose(database) hook. This ordering lets drivers finish rollback/cleanup work before pools or externally managed resources are closed.
createDrizzlePlatformStatusSnapshot(...) and DrizzleDatabase.createPlatformStatusSnapshot() expose the same contract to diagnostics surfaces:
readiness.status is not-ready while Drizzle is shutting down or stopped, and when strictTransactions is enabled without database.transaction(...) support.health.status is degraded while request transactions are draining during shutdown and unhealthy after disposal.details.activeRequestTransactions, details.lifecycleState, details.strictTransactions, and details.supportsTransaction describe the current request transaction and transaction-capability state.ownership.externallyManaged: true and ownership.ownsResources: false mean the package runs your configured dispose hook but does not claim ownership of the underlying driver resources.Use DrizzleModule.forRoot(...) / forRootAsync(...) to register Drizzle. When you need to compose Drizzle support inside a custom defineModule(...) registration, import the module entrypoint there as well.
import { defineModule } from '@fluojs/runtime';
import { DrizzleDatabase, DrizzleModule, DrizzleTransactionInterceptor } from '@fluojs/drizzle';
const database = {
transaction: async <T>(callback: (tx: typeof database) => Promise<T>) => callback(database),
};
class ManualDrizzleModule {}
defineModule(ManualDrizzleModule, {
exports: [DrizzleDatabase, DrizzleTransactionInterceptor],
imports: [DrizzleModule.forRoot({ database })],
});
DrizzleModule.forRoot(options) / DrizzleModule.forRootAsync(options)DrizzleDatabaseDrizzleTransactionInterceptorDRIZZLE_DATABASE, DRIZZLE_DISPOSE, DRIZZLE_OPTIONScreateDrizzlePlatformStatusSnapshot(...)DrizzleModuleDrizzleModule.forRoot(options) / DrizzleModule.forRootAsync(options)forRootAsync(...) accepts AsyncModuleOptions<DrizzleModuleOptions<...>>.strictTransactions: true to throw if transaction support is missing.@fluojs/runtime: owns module startup and shutdown sequencing@fluojs/http: provides the interceptor pipeline used for request transactions@fluojs/prisma and @fluojs/mongoose: alternate ORM/ODM integrations with the same fluo runtime modelpackages/drizzle/src/vertical-slice.test.tspackages/drizzle/src/module.test.tspackages/drizzle/src/public-api.test.tsFAQs
Drizzle ORM integration for Fluo with ALS transaction context, async module factory, and optional dispose hook.
The npm package @fluojs/drizzle receives a total of 34 weekly downloads. As such, @fluojs/drizzle popularity was classified as not popular.
We found that @fluojs/drizzle demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.

Research
/Security News
Benign-looking npm packages split malicious functionality across a dependency chain that deploys a cross-platform RAT targeting Alibaba developers.

Research
/Security News
Two Joyfill npm beta releases contain an import-time implant that uses blockchain transactions to retrieve a remote-access trojan.