Powerful ORM for   and Edge environments

 

Drift KV: A high-performance, type-safe ORM for TypeScript, optimized for Deno KV, Node.js, and Edge environments. Features real-time subscriptions, job queues, and a plugin system.

npm install @drift-kv/core

Key Features

Universal TypeScript Support

Experience seamless integration across platforms with Drift KV's universal TypeScript support. Whether you're building for Deno, Node.js, or Edge environments, maintain complete type safety and consistent execution.

Type-Safe Queries

Write safer database operations with the robust type system in Drift KV. Get full IntelliSense support and type inference that catches errors at compile-time, making your queries more reliable and maintainable. No more runtime errors!

Real-Time Subscriptions

Transform your applications with the real-time capabilities of Drift KV. Implement instant data synchronization with powerful filtering options and complex event patterns for modern collaborative features.

Edge-Ready Job Queues

Handle background tasks efficiently in any environment with Drift KV's advanced queue system. Leverage features like delayed execution and retries while maintaining optimal performance at the edge and serverless environments.

Get Started with Drift

Installation

npm install @drift-kv/core

Basic Usage


import { Drift, DriftEntity } from "drift-kv";
import { z } from "zod";

// Initialize the database client
const client = await Deno.openKv('./db.sqlite');

// Define the User entity schema
const user = new DriftEntity({
  name: "user",
  options: {
    timestamps: true,
  },
  schema: (z) => ({
    name: z.string().min(3).max(100),
    email: z.string().email(),
  }),
});

// Set up Drift KV instance
const drift = new Drift({
  client,
  schemas: {
    queues: {},
    entities: {
      user: user,
    },
  },
});

// Create a new user
await drift.entities.user.create({
  data: {
    name: "Felipe",
    email: "felipe@example.com",
  },
});

// Find all users
const users = await drift.entities.user.findMany();

// Update a user
await drift.entities.user.update({
  where: { email: "felipe@example.com" },
  data: {
    name: "Felipe Updated",
  },
});

// Delete a user
await drift.entities.user.delete({
  where: { email: "felipe@example.com" },
});
Felipe Barcelos

Felipe Barcelos

I'm a passionate software engineer and entrepreneur from 🇧🇷, dedicated to creating powerful and developer-friendly tools for the modern web ecosystem.

Frequently Asked Questions

Built for Deno KV

Discover Drift KV: The Ultimate Type-Safe ORM for Deno KV

Experience a powerful ORM with real-time subscriptions, job queues, and seamless compatibility across Deno KV, Node.js, Bun.js, and Edge environments.