Title: `void/kv` and `void/storage` for `target: 'node'`, backed by Redis and S3 · Issue #454 · voidzero-dev/void · GitHub
Open Graph Title: `void/kv` and `void/storage` for `target: 'node'`, backed by Redis and S3 · Issue #454 · voidzero-dev/void
X Title: `void/kv` and `void/storage` for `target: 'node'`, backed by Redis and S3 · Issue #454 · voidzero-dev/void
Description: Parts of the text were generated using an LLM, but the core purpose and intent of the proposal were written by a human. Summary I'd like to use void/kv and void/storage with target: 'node' (and bun / deno), backed by Redis and S3-compati...
Open Graph Description: Parts of the text were generated using an LLM, but the core purpose and intent of the proposal were written by a human. Summary I'd like to use void/kv and void/storage with target: 'node' (and bun...
X Description: Parts of the text were generated using an LLM, but the core purpose and intent of the proposal were written by a human. Summary I'd like to use void/kv and void/storage with target: 'node...
Opengraph URL: https://github.com/voidzero-dev/void/issues/454
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`void/kv` and `void/storage` for `target: 'node'`, backed by Redis and S3","articleBody":"**Parts of the text were generated using an LLM, but the core purpose and intent of the proposal were written by a human.**\n\n## Summary\n\nI'd like to use `void/kv` and `void/storage` with `target: 'node'` (and `bun` / `deno`), backed by Redis and S3-compatible storage, so the same app code runs on Cloudflare and on our own servers.\n\nThis would extend what Void already does for databases. `void/db` isn't limited to D1: with `database: 'pg'` or `'mysql'` and a `DATABASE_URL`, the same API works with your own PostgreSQL or MySQL server ([Choosing a Dialect](https://void.cloud/guide/database#choosing-a-dialect)). This proposal applies the same idea to KV and Storage: the API stays the same, and the app brings its own Redis or S3-compatible service.\n\nSince Void is built for Cloudflare Workers, I'd like to check the direction before writing code: would you accept this in Void core, or should it live in an external plugin or a fork?\n\n\"Self-hosting\" here means running the app on a Node.js server or container, not the self-hosted Void Platform.\n\n## Motivation\n\nI believe solid self-hosting is important for Void to become a first-class choice for full-stack apps. Many teams can't run everything on a single provider: they have existing infrastructure, data residency or compliance requirements, or want to avoid lock-in. Next.js, for comparison, supports all of its features on a Node.js server or in a Docker container ([Deploying](https://nextjs.org/docs/app/getting-started/deploying)).\n\nWhat sets Void apart from other frameworks is its built-in, typed server APIs: `void/db`, `void/kv`, `void/storage`, `void/auth` and `void/env`, with types carried from database queries to the UI. With `target: 'node'`, none of these are available today. What remains is mostly routing and pages, which many frameworks already provide, so a self-hosted Void app loses most of its advantage as a full-stack framework.\n\n`void/ai` and `void/sandbox` probably don't need self-hosted support. They wrap Cloudflare services (Workers AI and Containers), and a self-hosted app can call a model provider or run containers directly.\n\nThis issue starts with KV and Storage. If the direction works, `void/db`, `void/auth` and `void/env` could follow with the same approach.\n\n## Current behavior\n\n- `void/kv` and `void/storage` are in `CF_ONLY_IMPORTS`, so importing them with `target: 'node'` fails at build time ([plugin-node-target.ts](https://github.com/voidzero-dev/void/blob/3b2a3b82cb3c7070310a1575aecb490594796658/packages/void/src/plugin-node-target.ts#L10-L18)).\n- The docs suggest using an external provider through standard Node.js libraries instead ([No Cloudflare bindings](https://void.cloud/integrations/nodejs-bun-deno#no-cloudflare-bindings)).\n\nSo an app that uses `kv` or `storage` can't move to `target: 'node'` by changing config. Every call site has to be rewritten against another client, and an app that also deploys to Cloudflare ends up with two code paths.\n\n## Proposal\n\n### 1. Adapters behind the existing APIs\n\n- `void/storage` (`R2Bucket`) → S3 API: AWS S3, R2's S3 API, Garage, SeaweedFS, …\n- `void/kv` (the `KVNamespace` methods the `kv` client calls) → Redis protocol: Redis, Valkey, …\n\nThe generated Node entry creates them at startup and provides them as `KV` / `STORAGE`. `kv`, `storage`, `createKV()` and `createStorage()` keep their types, so app code stays the same on both targets.\n\n`remote: true` already works this way: `ProxyKVNamespace` / `ProxyR2Bucket` implement these interfaces over another transport and throw a clear error for unsupported features ([runtime/remote](https://github.com/voidzero-dev/void/tree/3b2a3b82cb3c7070310a1575aecb490594796658/packages/void/src/runtime/remote)). Full parity with Cloudflare isn't a goal: differences such as `list()` ordering, consistency and size limits would be documented. Client libraries would be optional dependencies, so the Cloudflare target and its install size stay unchanged.\n\n### 2. Config\n\nThis mirrors `database: 'pg'` + `DATABASE_URL` ([config](https://void.cloud/reference/config#database)):\n\n```ts\n// void.config.ts\nexport default defineConfig({\n target: 'node',\n kv: 'redis', // KV_URL=redis://valkey:6379\n storage: 's3', // STORAGE_URL=s3://\u003ckey>:\u003csecret>@object-store:8333/uploads (format TBD)\n});\n```\n\nThe server reads these URLs from the environment when it starts, not at build time. That keeps credentials out of `dist/` and lets the same image run in several environments.\n\n### 3. Docker Compose example\n\nA playground app (e.g. `playground/node-self-hosted/`) with a `compose.yaml` that runs the app, Valkey and an S3-compatible server such as SeaweedFS or Garage, plus a short section in the Node.js, Bun, and Deno guide. The same setup could back integration tests for the adapters.\n\nCloudflare-target behavior and defaults don't change.\n\n## Where it would touch\n\n- `plugin-node-target.ts`: allow `void/kv` / `void/storage` when a backend is configured.\n- `router/compile.ts`: the Node route table uses a no-op `withRuntimeEnv` ([L159-L163](https://github.com/voidzero-dev/void/blob/3b2a3b82cb3c7070310a1575aecb490594796658/packages/void/src/router/compile.ts#L159-L163)), and `compileNodeApp` adds only `ASSETS` to the env it passes to the routes ([L1349](https://github.com/voidzero-dev/void/blob/3b2a3b82cb3c7070310a1575aecb490594796658/packages/void/src/router/compile.ts#L1349)). Both would need to provide `KV` / `STORAGE`.\n- New adapter modules, config schema and types, and docs.\n\n## Question: where should this live?\n\n1. **Void core.** The adapters ship with Void, either in `void` with optional peer dependencies or as `@void/*` packages in this repo. They're configured in `void.config.ts`, documented in the guides and tested in CI here.\n2. **External plugin.** The adapters live in a separate package, and core gets only the small extension points it needs. I'd send PRs for:\n - a supported way to give the generated Node, Bun and Deno entries bindings created at startup, for example a module path in `void.config.ts` that exports `{ KV, STORAGE }`;\n - letting the guard allow `void/kv` / `void/storage` when those bindings are provided.\n\n There's a similar precedent in `void/database-provider`, which lets third-party packages add providers to `void db connect`.\n3. **Fork.** Running these APIs outside Cloudflare is out of scope for Void, and this should be maintained separately.\n\nIf 1 or 2 works for you, I'd be happy to implement it, starting with Storage (S3), and I'll follow your preference on details such as config shape and which methods to support.","author":{"url":"https://github.com/ogawa0071","@type":"Person","name":"ogawa0071"},"datePublished":"2026-10-16T14:22:53Z","url":"https://github.com/voidzero-dev/void/issues/454"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a003e435-c6ad-2aab-c12a-cc42d5562618 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A276:37E613:1850D4A:2159D73:6AFB8C0B |
| html-safe-nonce | f498fc9ac52faefc49a82849c4fc795e2011d89db3a2c712467ee89722bbff23 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjc2OjM3RTYxMzoxODUwRDRBOjIxNTlENzM6NkFGQjhDMEIiLCJ2aXNpdG9yX2lkIjoiMTA5NDMyMDI2ODI0MDQ1NjcxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c4bbcd84b71a4fe5cf13e9e3152d5351038557dd07ab8f6ba66c401a08362171 |
| hovercard-subject-tag | issue:5885794844 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/voidzero-dev/void/454/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9a3146baeb5df631ce834017b921588c9ead975e99fa72d6b60a7b46e7546262/voidzero-dev/void/issues/454 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9a3146baeb5df631ce834017b921588c9ead975e99fa72d6b60a7b46e7546262/voidzero-dev/void/issues/454 |
| og:image:alt | Parts of the text were generated using an LLM, but the core purpose and intent of the proposal were written by a human. Summary I'd like to use void/kv and void/storage with target: 'node' (and bun... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ogawa0071 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9694464143465782ecae2a97650b2a2b0708d5c31c74f41ee86da57e315e2735 |
| turbo-cache-control | no-preview |
| go-import | github.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git |
| octolytics-dimension-user_id | 149750581 |
| octolytics-dimension-user_login | voidzero-dev |
| octolytics-dimension-repository_id | 1164437080 |
| octolytics-dimension-repository_nwo | voidzero-dev/void |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1164437080 |
| octolytics-dimension-repository_network_root_nwo | voidzero-dev/void |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 05d967182208691fc7f2e6af52e82fa7fabf6bd5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width