Hi! First of all, thank you for creating bunqueue. It's an amazing, lightweight alternative for background jobs in Bun.
However, I noticed a significant bundle bloat after installing the package. The size of node_modules expands drastically from 75.8 MB to 223.1 MB upon adding bunqueue.
After looking into the package structure and package.json, I found two areas where we can significantly optimize this.
1. Separate MCP into a standalone package (e.g., @bunqueue/mcp or bunqueue-mcp)
Right now, the core bunqueue package includes Model Context Protocol (MCP) support out of the box. While this is great for AI agent workflows, it forces all standard users to install heavy dependencies that they don't actually need for basic queue functionality.
Specifically, it brings in:
@modelcontextprotocol/sdk
zod
Proposed Solution:
Extract the MCP server/features into a separate package, for instance, bunqueue-mcp or @bunqueue/mcp.
- Users who just need a high-performance SQLite queue can install
bunqueue (keeping it extremely lightweight).
- Users building AI agent integrations can install both
bunqueue and bunqueue-mcp.
2. Move bun from peerDependencies to engines
Currently, package.json specifies:
"peerDependencies": {
"bun": "^1.3.9"
}
Using peerDependencies for a runtime like bun is generally considered an anti-pattern in the modern JS ecosystem. It forces package managers (especially npm/pnpm/yarn when used in mixed or transition environments) to perform unnecessary dependency resolution checks or throw warnings/errors during installation.
Proposed Solution:
The correct way to restrict or enforce the runtime environment is to use the engines field:
"engines": {
"node": ">=... ", // if applicable
"bun": ">=1.3.9"
}
Benefits
- Lightweight Footprint: Brings back the "zero-overhead / ultra-fast" promise of the SQLite-backed queue.
- Better DX: Speeds up CI/CD install times and saves disk space for thousands of developers.
- Modular Architecture: Easier to maintain and version the MCP integration separately from the core queue logic.
Hi! First of all, thank you for creating
bunqueue. It's an amazing, lightweight alternative for background jobs in Bun.However, I noticed a significant bundle bloat after installing the package. The size of
node_modulesexpands drastically from 75.8 MB to 223.1 MB upon addingbunqueue.After looking into the package structure and
package.json, I found two areas where we can significantly optimize this.1. Separate MCP into a standalone package (e.g.,
@bunqueue/mcporbunqueue-mcp)Right now, the core
bunqueuepackage includes Model Context Protocol (MCP) support out of the box. While this is great for AI agent workflows, it forces all standard users to install heavy dependencies that they don't actually need for basic queue functionality.Specifically, it brings in:
@modelcontextprotocol/sdkzodProposed Solution:
Extract the MCP server/features into a separate package, for instance,
bunqueue-mcpor@bunqueue/mcp.bunqueue(keeping it extremely lightweight).bunqueueandbunqueue-mcp.2. Move
bunfrompeerDependenciestoenginesCurrently,
package.jsonspecifies:Using
peerDependenciesfor a runtime likebunis generally considered an anti-pattern in the modern JS ecosystem. It forces package managers (especially npm/pnpm/yarn when used in mixed or transition environments) to perform unnecessary dependency resolution checks or throw warnings/errors during installation.Proposed Solution:
The correct way to restrict or enforce the runtime environment is to use the
enginesfield:Benefits