Storage
Local (disk)
Zero-config storage that writes uploads to the local disk.
| Cloud | Self-Hosted |
|---|---|
| ⚠️ Not durable | ✅ Supported |
The Local adapter ships with @vitnode/core — no extra package or cloud account
needed. It writes files to a public/uploads directory and serves them as
static files.
Usage
Import the adapter
import { LocalStorageAdapter } from "@vitnode/core/api/adapters/storage/local";
import { buildApiConfig } from "@vitnode/core/vitnode.config";
export const vitNodeApiConfig = buildApiConfig({
storage: {
adapter: LocalStorageAdapter(),
},
});Serve the files
On the standalone Node API, mount the adapter's static descriptor with Hono's
serveStatic before VitNodeAPI so uploads are served at /api/uploads/*:
import { serveStatic } from "@hono/node-server/serve-static";
const staticStorage = vitNodeApiConfig.storage?.adapter?.static;
if (staticStorage) {
app.get(
staticStorage.mountPath,
serveStatic({
root: staticStorage.root,
rewriteRequestPath: path => path.replace(staticStorage.stripPrefix, ""),
}),
);
}
VitNodeAPI({ app, vitNodeApiConfig });Inside a Next.js app the public/ directory is already served at the site
root, so no serveStatic is needed — just point the adapter's public path at it:
adapter: LocalStorageAdapter({ publicPath: "/uploads" }),Options
Prop
Type