Skip to content

Commit 0be539f

Browse files
refactor: remove HTML boilerplate from layouts — use auto-shell
- Stripped <!DOCTYPE>, <html>, <head>, <body> from layout - Added app.head config to stx.config.ts (title, meta, bodyClass, scripts) - Renamed layouts/app.stx → layouts/default.stx - Updated all 12 pages to @extends('layouts/default') The framework now auto-generates the document shell from config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ae736b6 commit 0be539f

34 files changed

+110
-374
lines changed

docs/api-reference.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@
22
title: API Reference
33
description: Complete API reference for all bun-queue classes and methods.
44
---
5-
6-
# API Reference
7-
8-
## Queue
9-
10-
The main class for creating and managing job queues.
11-
12-
### Constructor
13-
14-
```typescript
15-
import { Queue } from '@stacksjs/bun-queue'
16-
17-
const queue = new Queue<T>(name: string, options?: QueueConnectionConfig)
18-
```
19-
20-
### Properties
21-
22-
| Property | Type | Description |
235
|----------|------|-------------|
246
| `name` | `string` | Queue name |
257
| `prefix` | `string` | Redis key prefix |

docs/config.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,6 @@ title: Configuration File
33
description: Configure bun-queue using a configuration file.
44
---
55

6-
# Configuration File
7-
8-
bun-queue can be configured using a `queue.config.ts` file or by passing options directly to the `Queue` constructor.
9-
10-
## Constructor Options
11-
12-
```typescript
13-
import { Queue } from '@stacksjs/bun-queue'
14-
15-
const queue = new Queue('tasks', {
16-
// Redis connection
17-
redis: {
18-
url: 'redis://localhost:6379',
19-
// or provide an existing client:
20-
// client: myRedisClient,
21-
},
22-
236
// Key prefix for all Redis keys (default: 'queue')
247
prefix: 'myapp',
258

docs/configuration.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,6 @@
22
title: Queue Configuration
33
description: Configure bun-queue with various options for Redis, rate limiting, metrics, and more.
44
---
5-
6-
# Queue Configuration
7-
8-
bun-queue provides extensive configuration options to customize queue behavior.
9-
10-
## Basic Configuration
11-
12-
```typescript
13-
import { Queue } from 'bun-queue'
14-
15-
const queue = new Queue('tasks', {
16-
redis: {
17-
url: 'redis://username:password@localhost:6379'
18-
},
19-
prefix: 'myapp', // Prefix for Redis keys (default: 'queue')
20-
verbose: true, // Enable verbose logging
21-
logLevel: 'info', // Log level: 'debug' | 'info' | 'warn' | 'error' | 'silent'
225
})
236
```
247
@@ -51,7 +34,9 @@ bun-queue reads these environment variables:
5134
- `REDIS_URL`: Redis connection string (default: `redis://localhost:6379`)
5235

5336
```bash
37+
5438
# .env
39+
5540
REDIS_URL=redis://localhost:6379
5641
```
5742

docs/creating-jobs.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@
22
title: Creating Jobs
33
description: Learn how to create and add jobs to the queue with various options.
44
---
5-
6-
# Creating Jobs
7-
8-
Jobs are the fundamental units of work in bun-queue. Each job contains data that will be processed by a worker.
9-
10-
## Basic Job Creation
11-
12-
The simplest way to add a job is to call the `add` method on a queue:
13-
14-
```typescript
15-
import { Queue } from 'bun-queue'
16-
17-
const queue = new Queue('tasks')
18-
19-
// Add a simple job
20-
const job = await queue.add({
21-
task: 'process-image',
22-
imageUrl: 'https://example.com/image.jpg'
235
})
246

257
console.log(`Job ${job.id} added to the queue`)

docs/cron-expressions.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ A cron expression consists of five fields that specify when a job should run:
1414
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
1515
│ │ │ │ │
1616
│ │ │ │ │
17+
1718
* * * * *
19+
1820
```
1921

2022
### Special Characters
2123

22-
- `*`: Matches any value (wildcard)
23-
- `,`: Separates multiple values (e.g., `1,3,5`)
24-
- `-`: Specifies a range (e.g., `1-5`)
25-
- `/`: Specifies a step value (e.g., `*/2` means every 2 units)
24+
* `*`: Matches any value (wildcard)
25+
* `,`: Separates multiple values (e.g., `1,3,5`)
26+
* `-`: Specifies a range (e.g., `1-5`)
27+
* `/`: Specifies a step value (e.g., `*/2` means every 2 units)
2628

2729
## Common Cron Expressions
2830

@@ -51,7 +53,7 @@ Example with timezone:
5153
```typescript
5254
await queue.scheduleCron({
5355
cronExpression: '30 9 * * *', // Every day at 9:30am
54-
timezone: 'America/New_York', // Eastern Time
56+
timezone: 'America/New*York', // Eastern Time
5557
data: {
5658
// job data
5759
}
@@ -60,15 +62,15 @@ await queue.scheduleCron({
6062

6163
### Common Timezones
6264

63-
- `UTC`: Coordinated Universal Time
64-
- `America/New_York`: Eastern Time (US & Canada)
65-
- `America/Chicago`: Central Time (US & Canada)
66-
- `America/Denver`: Mountain Time (US & Canada)
67-
- `America/Los_Angeles`: Pacific Time (US & Canada)
68-
- `Europe/London`: UK time
69-
- `Europe/Paris`: Central European Time
70-
- `Asia/Tokyo`: Japan Standard Time
71-
- `Australia/Sydney`: Australian Eastern Time
65+
* `UTC`: Coordinated Universal Time
66+
* `America/New*York`: Eastern Time (US & Canada)
67+
* `America/Chicago`: Central Time (US & Canada)
68+
* `America/Denver`: Mountain Time (US & Canada)
69+
* `America/Los*Angeles`: Pacific Time (US & Canada)
70+
* `Europe/London`: UK time
71+
* `Europe/Paris`: Central European Time
72+
* `Asia/Tokyo`: Japan Standard Time
73+
* `Australia/Sydney`: Australian Eastern Time
7274

7375
## Advanced Examples
7476

@@ -128,5 +130,5 @@ await queue.unscheduleCron('daily-job')
128130

129131
## Additional Resources
130132

131-
- [Crontab Guru](https://crontab.guru/): Interactive cron expression editor
132-
- [List of TZ database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones): Complete list of valid timezone identifiers
133+
* [Crontab Guru](https://crontab.guru/): Interactive cron expression editor
134+
* [List of TZ database time zones](https://en.wikipedia.org/wiki/List*of*tz*database*time*zones): Complete list of valid timezone identifiers

docs/cron-jobs.md

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@
22
title: Cron Jobs
33
description: Schedule recurring jobs using cron expressions.
44
---
5-
6-
# Cron Jobs
7-
8-
bun-queue supports scheduling recurring jobs using standard cron expressions.
9-
10-
## Scheduling a Cron Job
11-
12-
```typescript
13-
import { Queue } from 'bun-queue'
14-
15-
const notificationQueue = new Queue('notifications')
16-
17-
// Schedule a job to run every minute
18-
const jobId = await notificationQueue.scheduleCron({
19-
cronExpression: '* * * * *',
20-
data: {
21-
title: 'Status Check',
22-
message: 'All systems operational'
235
}
246
})
257

@@ -37,7 +19,9 @@ Standard 5-field cron expression:
3719
│ │ │ ┌───────────── month (1-12)
3820
│ │ │ │ ┌───────────── day of week (0-6, 0=Sunday)
3921
│ │ │ │ │
22+
4023
* * * * *
24+
4125
```
4226

4327
### Examples
@@ -82,7 +66,7 @@ await queue.scheduleCron({
8266
jobId: 'hourly-update-job',
8367

8468
// Optional: Timezone (default: system timezone)
85-
timezone: 'America/New_York',
69+
timezone: 'America/New*York',
8670

8771
// Optional: Maximum number of executions
8872
limit: 100,
@@ -114,7 +98,7 @@ await queue.scheduleCron({
11498
// Hourly job in Eastern Time
11599
await queue.scheduleCron({
116100
cronExpression: '0 * * * *',
117-
timezone: 'America/New_York',
101+
timezone: 'America/New*York',
118102
data: { task: 'hourly-sync' }
119103
})
120104
```
@@ -212,7 +196,7 @@ await queue.scheduleCron({
212196
```typescript
213197
await queue.scheduleCron({
214198
cronExpression: '30 9 * * *', // 9:30 AM daily
215-
timezone: 'America/New_York',
199+
timezone: 'America/New*York',
216200
data: {
217201
type: 'daily-report',
218202
recipients: ['manager@example.com']
@@ -254,7 +238,7 @@ await queue.scheduleCron({
254238
cronExpression: '0 3 * * *', // 3 AM daily
255239
data: {
256240
type: 'db-cleanup',
257-
tables: ['temp_data', 'expired_sessions']
241+
tables: ['temp*data', 'expired_sessions']
258242
},
259243
jobId: 'daily-cleanup'
260244
})

docs/dead-letter-queues.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@
22
title: Dead Letter Queues
33
description: Handle permanently failed jobs with dead letter queues.
44
---
5-
6-
# Dead Letter Queues
7-
8-
Dead letter queues (DLQ) capture jobs that have failed multiple times and cannot be processed, allowing you to inspect and reprocess them later.
9-
10-
## Enabling Dead Letter Queue
11-
12-
### Queue-Level Configuration
13-
14-
Enable DLQ for all jobs in a queue:
15-
16-
```typescript
17-
import { Queue } from 'bun-queue'
18-
19-
const queue = new Queue('emails', {
20-
defaultDeadLetterOptions: {
21-
enabled: true,
22-
queueSuffix: '-dead-letter', // Creates 'emails-dead-letter'
235
maxRetries: 3, // Move to DLQ after 3 failures
246
removeFromOriginalQueue: true
257
}

docs/failed-jobs.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,6 @@ title: Failed Job Handling
33
description: Learn how to handle, retry, and manage failed jobs.
44
---
55

6-
# Failed Job Handling
7-
8-
bun-queue provides comprehensive tools for handling and managing failed jobs.
9-
10-
## Retry Configuration
11-
12-
Configure automatic retries when adding jobs:
13-
14-
```typescript
15-
await queue.add(data, {
16-
attempts: 5, // Maximum retry attempts
17-
backoff: {
18-
type: 'exponential', // 'fixed' or 'exponential'
19-
delay: 1000 // Base delay in milliseconds
20-
}
21-
})
22-
```
23-
246
### Backoff Strategies
257

268
**Fixed Backoff:**

docs/guide/cron-jobs.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ await queue.add(
7171
│ │ │ ┌───────────── month (1 - 12)
7272
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
7373
│ │ │ │ │
74+
7475
* * * * *
76+
7577
```
7678

7779
### Common Cron Expressions
@@ -95,7 +97,7 @@ interface RepeatOptions {
9597
limit?: number // Maximum number of repetitions
9698
count?: number // Current repetition count
9799
cron?: string // Cron expression
98-
tz?: string // Timezone (e.g., 'America/New_York')
100+
tz?: string // Timezone (e.g., 'America/New*York')
99101
startDate?: Date | number // Start date for the schedule
100102
endDate?: Date | number // End date for the schedule
101103
}
@@ -112,7 +114,7 @@ await queue.add(
112114
{
113115
repeat: {
114116
cron: '0 9 * * 1-5',
115-
tz: 'America/New_York'
117+
tz: 'America/New*York'
116118
}
117119
}
118120
)
@@ -255,6 +257,6 @@ await alertQueue.add(
255257

256258
## Next Steps
257259

258-
- Configure [dead letter queues](./dead-letter-queue.md)
259-
- Learn about [distributed locks](./distributed-locks.md)
260-
- Set up [rate limiting](./rate-limiting.md)
260+
* Configure [dead letter queues](./dead-letter-queue.md)
261+
* Learn about [distributed locks](./distributed-locks.md)
262+
* Set up [rate limiting](./rate-limiting.md)

0 commit comments

Comments
 (0)