Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .changeset/funny-cobras-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
"@vorsteh-queue/adapter-kysely": minor
---

Add Kysely ORM adapter for PostgreSQL with type-safe database operations

**Features:**

- `PostgresQueueAdapter`: PostgreSQL support using Kysely ORM
- Raw SQL with `SKIP LOCKED` for race condition prevention
- UTC-first design with proper timezone handling
- Database schema uses UTC defaults: `timezone('utc', now())` for PostgreSQL
- All timestamps explicitly stored as UTC for consistent behavior

**Usage:**

```typescript
import { Kysely, PostgresDialect } from "kysely"
import { Pool } from "pg"

import { PostgresQueueAdapter } from "@vorsteh-queue/adapter-kysely"
import { Queue } from "@vorsteh-queue/core"

const db = new Kysely({
dialect: new PostgresDialect({
pool: new Pool({ connectionString: "postgresql://..." }),
}),
})

const adapter = new PostgresQueueAdapter(db)
const queue = new Queue(adapter, { name: "my-queue" })

// Register job handlers
queue.register("send-email", async (payload: { to: string }) => {
// Send email logic
return { sent: true }
})

// Add jobs
await queue.add("send-email", { to: "[email protected]" })

// Start processing
queue.start()
```
5 changes: 5 additions & 0 deletions .changeset/loose-parrots-glow copy 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vorsteh-queue/adapter-drizzle": patch
---

Add `PostgresQueueAdapter` as alias to `PostgresDrizzleQueueAdapter`
5 changes: 5 additions & 0 deletions .changeset/loose-parrots-glow copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vorsteh-queue/adapter-prisma": patch
---

Add `PostgresQueueAdapter` as alias to `PostgresPrismaQueueAdapter`
8 changes: 8 additions & 0 deletions .changeset/loose-parrots-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"create-vorsteh-queue": patch
"@vorsteh-queue/adapter-drizzle": patch
"@vorsteh-queue/adapter-prisma": patch
"@vorsteh-queue/core": patch
---

update dependencies
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,19 +311,20 @@ This project was developed with AI assistance, combining human expertise with AI
# Install dependencies
pnpm install

# Run all tests
pnpm test
# Autofix format issues
pnpm format:fix

# Fix issues in the `package.json` ( order, version mismatch )
pnpm lint:ws -f

# Run specific test suites
pnpm test:core # Core package tests
pnpm test:drizzle-postgres # PostgreSQL adapter tests
pnpm test:drizzle-mariadb # MariaDB adapter tests
# Lint
pnpm lint

# Type check
pnpm typecheck

# Lint
pnpm lint
# Run all tests
pnpm test

# Build packages
pnpm build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Vorsteh Queue is a powerful, type-safe queue engine designed for PostgreSQL 12+.
## Key Features

- **Type-safe**: Full TypeScript support with generic job payloads
- **Multiple adapters**: Drizzle ORM (PostgreSQL), Prisma ORM (PostgreSQL), and in-memory implementations
- **Multiple adapters**: Drizzle ORM (PostgreSQL), Prisma ORM (PostgreSQL), Kysely (PostgreSQL) and in-memory implementations
- **Priority queues**: Numeric priority system (lower = higher priority)
- **Delayed jobs**: Schedule jobs for future execution
- **Recurring jobs**: Cron expressions and interval-based repetition
Expand Down
8 changes: 8 additions & 0 deletions apps/docs/content/docs/01.getting-started/02.installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@ If you prefer to add Vorsteh Queue to an existing project:
className={{ container: "not-prose", code: "not-prose" }}
/>

### Prisma ORM (PostgreSQL)

<PackageInstall
packages={["@vorsteh-queue/core", "@vorsteh-queue/adapter-kysely"]}
className={{ container: "not-prose", code: "not-prose" }}
/>

## Database Setup

After installation, you'll need to set up the required database tables. Each adapter provides migration scripts or schema definitions:

- **Drizzle**: Use the provided schema and run migrations
- **Prisma**: Add the schema to your `schema.prisma` and run `prisma migrate`
- **Kysely**: Use the provided schema and run migrations

Refer to the specific adapter documentation for detailed setup instructions.

Expand Down
13 changes: 2 additions & 11 deletions apps/docs/content/docs/02.packages/adapter-drizzle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,9 @@ If you don't want to use the pre-defined schema, you can create your own schema

### Migration

Push the schema to your database:
To run the migrations, we recommend to use [`drizzle-kit`](https://orm.drizzle.team/docs/kit-overview).

```bash
npx drizzle-kit push
```

Or generate and run migrations:

```bash
npx drizzle-kit generate
npx drizzle-kit migrate
```
> Drizzle Kit is a CLI tool for managing SQL database migrations with Drizzle.

## References

Expand Down
85 changes: 85 additions & 0 deletions apps/docs/content/docs/02.packages/adapter-kysely.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: Kysely Adapter
navTitle: "@vorsteh-queue/adapter-kysely"
description: Kysely adapter for PostgreSQL providing type-safe database operations with excellent performance.
---

The Kysely adapter provides PostgreSQL support using Kysely, offering excellent TypeScript integration and performance.

## Installation

<PackageInstall packages={["@vorsteh-queue/core", "@vorsteh-queue/adapter-kysely"]} />

## Quick Start

```typescript
import { Kysely } from "kysely"
import { PostgresJSDialect } from "kysely-postgres-js"
import postgres from "postgres"

import type { QueueJobTableDefinition } from "@vorsteh-queue/adapter-kysely/types"
import { PostgresQueueAdapter } from "@vorsteh-queue/adapter-kysely"
import { Queue } from "@vorsteh-queue/core"

interface DB {
queue_jobs: QueueJobTableDefinition
other_table: {
name: string
}
}

// Shared database connection
const client = postgres(
process.env.DATABASE_URL || "postgresql://postgres:password@localhost:5432/queue_db",
{ max: 10 }, // Connection pool
)

const db = new Kysely<DB>({
dialect: new PostgresJSDialect({
postgres: client,
}),
})

const adapter = new PostgresQueueAdapter(db)
const queue = new Queue(adapter)
```

## Supported providers

- PGlite
- Postgres.JS
- Node Progress

## Database Setup

### Schema

The adapter includes a pre-defined migration:

```typescript
// migrations/queue-jobs.ts
import { down, up } from "@vorsteh-queue/adapter-kysely/migrations"

// Use in your schema file
export { up, down }
```

If you don't want to use the pre-defined schema, you can create your own migration.

<RemoteCodeBlock
source="./packages/adapter-kysely/src/migrations/queue_table.ts"
language="ts"
showToolbar={true}
path="queue-jobs.ts"
/>

### Migration

To run the migrations, we recommend to use [`kysely-ctl`](https://github.com/kysely-org/kysely-ctl).

> `kysely-ctl` is the command-line tool for Kysely.

## References

- Sources: https://github.com/noxify/vorsteh-queue/tree/main/packages/adapter-kysely
- NPM: https://www.npmjs.com/package/@vorsteh-queue/adapter-kysely
20 changes: 2 additions & 18 deletions apps/docs/content/docs/02.packages/adapter-prisma.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,9 @@ Add the queue job model to your `schema.prisma`:

### Migration

Push the schema to your database:
To run the migrations, we recommend to use the [`prisma cli`](https://www.prisma.io/docs/orm/tools/prisma-cli).

```bash
npx prisma db push
```

Or generate and apply the migration:

```bash
npx prisma migrate dev --name add-queue-jobs
```

### Generate Client

Generate the Prisma client:

```bash
npx prisma generate
```
> The Prisma command line interface (CLI) is the primary way to interact with your Prisma project from the command line.

## References

Expand Down
1 change: 1 addition & 0 deletions apps/docs/content/docs/02.packages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Vorsteh Queue is built as a modular system with separate packages for different

- **[@vorsteh-queue/adapter-drizzle](/docs/packages/adapter-drizzle)** - Drizzle ORM adapter for PostgreSQL
- **[@vorsteh-queue/adapter-prisma](/docs/packages/adapter-prisma)** - Prisma ORM adapter for PostgreSQL
- **[@vorsteh-queue/adapter-kysely](/docs/packages/adapter-kysely)** - Kysely adapter for PostgreSQL

## CLI Tools

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/features/11.orm-agnostic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ title: ORM Agnostic
icon: Database
---

Works with Drizzle ORM and Prisma ORM for PostgreSQL. Adapter pattern allows easy integration with your existing database setup.
Works with Drizzle ORM, Kysely and Prisma ORM for PostgreSQL. Adapter pattern allows easy integration with your existing database setup.
49 changes: 25 additions & 24 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
"prettier": "@vorsteh-queue/prettier-config",
"dependencies": {
"@icons-pack/react-simple-icons": "13.7.0",
"@mdx-js/loader": "3.1.0",
"@mdx-js/node-loader": "3.1.0",
"@mdx-js/react": "3.1.0",
"@next/mdx": "15.4.5",
"@radix-ui/react-collapsible": "^1.1.11",
"@mdx-js/loader": "3.1.1",
"@mdx-js/node-loader": "3.1.1",
"@mdx-js/react": "3.1.1",
"@next/mdx": "15.5.2",
"@radix-ui/react-collapsible": "^1.1.12",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-dialog": "^1.1.14",
"@radix-ui/react-dropdown-menu": "2.1.15",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "2.1.16",
"@radix-ui/react-id": "1.1.1",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-tabs": "1.1.12",
"@radix-ui/react-tooltip": "^1.2.7",
"@radix-ui/react-tabs": "1.1.13",
"@radix-ui/react-tooltip": "^1.2.8",
"@vercel/og": "0.8.5",
"class-variance-authority": "0.7.1",
"clsx": "2.1.1",
"date-fns": "^4.1.0",
"interweave": "13.1.1",
"lucide-react": "0.534.0",
"lucide-react": "0.542.0",
"multimatch": "7.0.0",
"next": "15.4.5",
"next": "15.5.2",
"next-themes": "latest",
"p-map": "7.0.3",
"react": "19.1.1",
Expand All @@ -51,37 +51,38 @@
"remark-mdx-frontmatter": "5.2.0",
"remark-squeeze-paragraphs": "6.0.0",
"remark-strip-badges": "7.0.0",
"renoun": "9.0.0",
"tm-themes": "1.10.7",
"renoun": "9.5.0",
"tm-grammars": "1.24.8",
"tm-themes": "1.10.9",
"ts-morph": "26.0.0",
"tw-animate-css": "^1.3.6",
"use-debounce": "10.0.5",
"zod": "4.0.14"
"tw-animate-css": "^1.3.8",
"use-debounce": "10.0.6",
"zod": "4.1.5"
},
"devDependencies": {
"@tailwindcss/postcss": "4.1.11",
"@tailwindcss/postcss": "4.1.12",
"@tailwindcss/typography": "0.5.16",
"@types/mdx": "2.0.13",
"@types/node": "22.16.5",
"@types/react": "19.1.9",
"@types/react-dom": "19.1.7",
"@types/react": "19.1.12",
"@types/react-dom": "19.1.9",
"@types/serve-handler": "6.1.4",
"@vorsteh-queue/adapter-drizzle": "workspace:*",
"@vorsteh-queue/adapter-prisma": "workspace:*",
"@vorsteh-queue/core": "workspace:*",
"@vorsteh-queue/eslint-config": "workspace:*",
"@vorsteh-queue/prettier-config": "workspace:*",
"@vorsteh-queue/tsconfig": "workspace:*",
"eslint": "^9.32.0",
"eslint": "^9.34.0",
"next-validate-link": "1.5.2",
"pagefind": "1.3.0",
"pagefind": "1.4.0",
"postcss": "8.5.6",
"prettier": "^3.6.2",
"serve-handler": "6.1.6",
"tailwind-merge": "3.3.1",
"tailwindcss": "4.1.11",
"tailwindcss": "4.1.12",
"tailwindcss-animate": "1.0.7",
"tsx": "4.20.3",
"typescript": "^5.8.3"
"tsx": "4.20.5",
"typescript": "^5.9.2"
}
}
5 changes: 2 additions & 3 deletions apps/docs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Metadata } from "next"
import type React from "react"
import { PackageInstallScript, ThemeStyles } from "renoun/components"
import { ThemeStyles } from "renoun/components"

import "./globals.css"

Expand All @@ -9,15 +9,14 @@ import { ThemeProvider } from "~/components/theme-provider"
export const metadata: Metadata = {
title: "Vorsteh Queue - Reliable Job Queue for Modern Applications",
description:
"A powerful, ORM-agnostic queue engine for PostgreSQL 12+, MariaDB, and MySQL. Handle background jobs, scheduled tasks, and recurring processes with ease.",
"A powerful, ORM-agnostic queue engine for PostgreSQL 12. Handle background jobs, scheduled tasks, and recurring processes with ease.",
}

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<ThemeStyles />
<PackageInstallScript />
<ThemeProvider
attribute={["class", "data-theme"]}
defaultTheme="system"
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/app/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function manifest(): MetadataRoute.Manifest {
name: "Vorsteh Queue - Reliable Job Queue for Modern Applications",
short_name: "Vorsteh Queue",
description:
"A powerful, ORM-agnostic queue engine for PostgreSQL 12+, MariaDB, and MySQL. Handle background jobs, scheduled tasks, and recurring processes with ease.",
"A powerful, ORM-agnostic queue engine for PostgreSQL 12+. Handle background jobs, scheduled tasks, and recurring processes with ease.",
start_url: "/",
display: "standalone",
background_color: "#f8f4e6",
Expand Down
Loading
Loading