Skip to content

docs: document custom storage drivers - #4464

Open
vittorioexp wants to merge 2 commits into
nitrojs:mainfrom
vittorioexp:docs/custom-storage-drivers
Open

docs: document custom storage drivers#4464
vittorioexp wants to merge 2 commits into
nitrojs:mainfrom
vittorioexp:docs/custom-storage-drivers

Conversation

@vittorioexp

Copy link
Copy Markdown
Contributor

Summary

Closes #3847.

Documents how to register custom unstorage drivers via a file path in nitro.config, with an example based on maintainer guidance.

Test plan

  • Docs-only change

Made with Cursor

Explain that driver must be a built-in name or module path, with an example. Closes nitrojs#3847.
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

@vittorioexp is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 83253544-29b8-44c2-af5e-61e1de072b29

📥 Commits

Reviewing files that changed from the base of the PR and between dc5fd65 and f240faf.

📒 Files selected for processing (1)
  • docs/1.docs/8.storage.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/1.docs/8.storage.md

📝 Walkthrough

Walkthrough

Adds documentation for configuring Nitro storage with built-in driver names or custom driver module paths, including a defineDriver example and configuration options passed to the driver factory.

Changes

Storage driver configuration

Layer / File(s) Summary
Custom driver configuration
docs/1.docs/8.storage.md
Documents custom driver modules, filesystem path references, additional configuration options, and the Unstorage custom driver guide.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses a valid conventional-commits docs prefix and clearly matches the documentation change.
Description check ✅ Passed The description directly explains the custom storage driver documentation update and issue closure.
Linked Issues check ✅ Passed The docs now clarify that Nitro accepts built-in driver names or module paths, not inline driver functions or objects, matching #3847.
Out of Scope Changes check ✅ Passed The PR only changes the storage docs and stays aligned with the linked issue's documentation scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/1.docs/8.storage.md`:
- Around line 110-112: Update the Upstash example imports to use the default
export from unstorage/drivers/upstash instead of a named import, and document
`@upstash/redis` as a prerequisite dependency for users copying the example.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c92d638b-0ab7-49ad-9a3c-8f2c67fd8f0e

📥 Commits

Reviewing files that changed from the base of the PR and between c1ff6ba and dc5fd65.

📒 Files selected for processing (1)
  • docs/1.docs/8.storage.md

Comment thread docs/1.docs/8.storage.md Outdated
Comment on lines +110 to +112
```ts [drivers/upstash.ts]
import { defineDriver } from "unstorage";
import { upstashDriver } from "unstorage/drivers/upstash";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== docs/1.docs/8.storage.md (relevant section) =="
nl -ba docs/1.docs/8.storage.md | sed -n '90,130p'

echo
echo "== search for upstash mentions =="
rg -n "upstash|`@upstash/redis`|defineDriver|unstorage/drivers/upstash" docs/1.docs/8.storage.md docs -S

Repository: nitrojs/nitro

Length of output: 241


🌐 Web query:

unstorage upstash driver default import @upstash/redis documentation

💡 Result:

The Unstorage Upstash driver is imported using the default export from the package location 'unstorage/drivers/upstash' [1][2]. To use the Upstash driver in your Unstorage project, you must have the '@upstash/redis' package installed [1]. The driver is initialized as follows: import { createStorage } from "unstorage"; import upstashDriver from "unstorage/drivers/upstash"; const storage = createStorage({ driver: upstashDriver({ base: "unstorage", // url: "...", // Optional: or set UPSTASH_REDIS_REST_URL env var // token: "...", // Optional: or set UPSTASH_REDIS_REST_TOKEN env var }), }); The driver automatically looks for the UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN environment variables if they are not explicitly provided in the options [1]. For comprehensive details on configuring the underlying Upstash client, you should refer to the official @upstash/redis documentation [1][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== relevant lines from docs/1.docs/8.storage.md =="
sed -n '90,130p' docs/1.docs/8.storage.md

echo
echo "== upstash-related matches in docs/1.docs/8.storage.md =="
grep -nE 'upstash|`@upstash/redis`|defineDriver|unstorage/drivers/upstash' docs/1.docs/8.storage.md || true

Repository: nitrojs/nitro

Length of output: 1876


Use the default Upstash import and add the dependency note.
unstorage/drivers/upstash is a default export, so this named import will break the example. Add @upstash/redis as a prerequisite for copy-paste users.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/1.docs/8.storage.md` around lines 110 - 112, Update the Upstash example
imports to use the default export from unstorage/drivers/upstash instead of a
named import, and document `@upstash/redis` as a prerequisite dependency for users
copying the example.

Comment thread docs/1.docs/8.storage.md Outdated

```ts [drivers/upstash.ts]
import { defineDriver } from "unstorage";
import { upstashDriver } from "unstorage/drivers/upstash";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bad for the example of custom drivers / relavant to wrap to patch but making from scratch, ony needs implemeneting the interface

Address review feedback: from-scratch drivers implement the unstorage interface; wrapping is only for patching existing drivers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkg-pr-new

pkg-pr-new Bot commented Jul 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4464

commit: f240faf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom drivers

2 participants