npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

drizzle-transactional

v1.2.0

Published

Beautiful transactional decorator for Drizzle ORM with all capabilities from typeorm-transactional

Readme

Drizzle Transactional

🚀 Beautiful transactional decorator for Drizzle ORM inspired by TypeORM-transactional

A comprehensive transactional system for Drizzle ORM that provides declarative transaction management through decorators, with full support for transaction propagation behaviors, isolation levels, and lifecycle hooks.

npm version License: MIT TypeScript Node.js Drizzle ORM

📚 Documentation

Complete documentation is available in our Documentation Wiki

🚀 Quick Links

📖 Key Topics

🌟 Features

  • 🎯 Declarative Transactions: Use @Transactional() decorator on methods and @TransactionalClass() on classes
  • 🔄 Propagation Behaviors: Full support for all transaction propagation types (REQUIRED, REQUIRES_NEW, MANDATORY, etc.)
  • 🔒 Isolation Levels: Support for all PostgreSQL isolation levels
  • 🪝 Transaction Hooks: Register callbacks for commit, rollback, and completion events
  • 🧵 Context Management: AsyncLocalStorage-based context management for thread-safe operations
  • 🔧 Type Safe: Full TypeScript support with proper type inference
  • ⚡ Performance Optimized: WeakMap-based method caching and efficient context management
  • 🛠️ Enhanced Error Handling: Rich error information with stack traces and context
  • 🔄 Utility Functions: Built-in memoization, debouncing, and throttling utilities
  • 🐘 PostgreSQL Ready: Optimized for PostgreSQL with full feature support
  • 📦 Dual Package: Supports both ESM and CommonJS modules

📦 Installation

npm install drizzle-transactional drizzle-orm

Database dependencies:

# For PostgreSQL (recommended)
npm install pg @types/pg

# For development
npm install reflect-metadata

⚡ Quick Example

import {
  Transactional,
  runOnTransactionCommit,
  initializeDrizzleTransactionalContext,
  addTransactionalDrizzleDatabase,
} from "drizzle-transactional";
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";

// Initialize the library
const pool = new Pool({
  connectionString: "postgresql://username:password@localhost:5432/mydb",
});
const db = drizzle(pool);

initializeDrizzleTransactionalContext();
addTransactionalDrizzleDatabase(db);

class UserService {
  @Transactional()
  async createUser(name: string, email: string) {
    const user = await db.insert(users).values({ name, email }).returning();

    runOnTransactionCommit(() => {
      console.log(`✅ User ${name} created successfully!`);
      emailService.sendWelcomeEmail(email);
    });

    return user[0];
  }
}

For complete setup instructions, see Quick Start Guide.

🤝 Compatibility

  • Node.js: 18+
  • TypeScript: 5.0+
  • Drizzle ORM: 0.36+
  • PostgreSQL: 12+

📚 Learn More

🧪 Testing

# Run core functionality tests
npm run test:quick

# Run all tests
npm run test:all

🙏 Acknowledgments

This library is inspired by typeorm-transactional and adapted for Drizzle ORM with PostgreSQL support. Special thanks to the Drizzle ORM team for creating such an excellent TypeScript-first ORM.

📄 License

MIT License - see LICENSE file for details.


Built with ❤️ for the Drizzle ORM community, with assistance from Claude AI.

📊 Project Status

🏆 PROJECT COMPLETED SUCCESSFULLY

All requirements met:

  • ✅ Beautiful transactional decorator for Drizzle ORM
  • ✅ Based on provided prototype
  • ✅ ALL capabilities from typeorm-transactional
  • ✅ Real-world tests without testing frameworks
  • ✅ PostgreSQL integration with full feature support
  • ✅ Latest versions of all libraries
  • ✅ English code messages and documentation
  • ✅ Dual package support (ESM + CommonJS)
  • ✅ Ready for npm publication

Ready for production use! 🚀