Skip to content

Commit ef8cf73

Browse files
tswicegoodclaude
andcommitted
[dashboards] open-brain-dashboard-next: add Cloudflare Workers deploy support
Adds the @opennextjs/cloudflare adapter so the dashboard can deploy to Cloudflare Workers alongside the open-brain-rest gateway, keeping the whole second-brain stack on a single platform. The older @cloudflare/next-on-pages adapter caps at Next 15.5.x and doesn't support this dashboard's Next 16, so OpenNext is the only path that works without a major-version downgrade. Builds on the next 16.2.4 patch bump merged from contrib/tswicegood/dashboard-next-bump (which clears OpenNext's next>=16.2.3 peer dep on its own). Changes: - @opennextjs/cloudflare and wrangler as dev deps. - open-next.config.ts and wrangler.jsonc — the two config files OpenNext needs at the project root. Worker name defaults to ob-dashboard; deployers can rename in wrangler.jsonc. - README: new "Deploy to Cloudflare Workers" subsection alongside the existing Vercel one, including the build-time vs. runtime distinction for NEXT_PUBLIC_API_URL vs. SESSION_SECRET (catching that was the difference between a working deploy and a half- configured one). - .gitignore: exclude .open-next/ and .wrangler/ build artifacts. Vercel deploy path is unchanged; this is purely additive. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e4f74d1 commit ef8cf73

6 files changed

Lines changed: 10131 additions & 4436 deletions

File tree

dashboards/open-brain-dashboard-next/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
node_modules/
22
.next/
33
.vercel/
4+
.open-next/
5+
.wrangler/
46
.env
57
.env.local
68
.env.local.example

dashboards/open-brain-dashboard-next/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,30 @@ Or connect the folder to Vercel via the dashboard. Set the environment variables
9393
> [!TIP]
9494
> The free Vercel tier is sufficient. The dashboard makes server-side API calls to your Open Brain REST endpoint — there's no heavy compute.
9595
96+
### Step 5 (alternative): Deploy to Cloudflare Workers (optional)
97+
98+
If you're already on Cloudflare for the [`open-brain-rest`](../../integrations/cloudflare-rest-worker/) gateway, you can host the dashboard on the same platform via the [`@opennextjs/cloudflare`](https://opennext.js.org/cloudflare) adapter. The older `@cloudflare/next-on-pages` adapter caps at Next 15.5.x and doesn't support this dashboard's Next 16.
99+
100+
The repo ships the two config files this needs out of the box (`open-next.config.ts` and `wrangler.jsonc`); rename the Worker in `wrangler.jsonc` if you want something other than `ob-dashboard`.
101+
102+
```bash
103+
# 1. Make sure .env has NEXT_PUBLIC_API_URL set — it's read at *build*
104+
# time and baked into the client bundle.
105+
npx opennextjs-cloudflare build
106+
107+
# 2. First-time deploy creates the Worker.
108+
npx opennextjs-cloudflare deploy
109+
110+
# 3. Set SESSION_SECRET as a *runtime* secret on the deployed Worker.
111+
# (NEXT_PUBLIC_API_URL is build-time only, so no Worker secret for it.)
112+
wrangler secret put SESSION_SECRET --name ob-dashboard
113+
```
114+
115+
The dashboard ends up at `https://ob-dashboard.<your-cf-subdomain>.workers.dev`.
116+
117+
> [!TIP]
118+
> `NEXT_PUBLIC_API_URL` is build-time, `SESSION_SECRET` is runtime. If you change the API URL later you have to rebuild and redeploy; rotating the session secret only needs `wrangler secret put`.
119+
96120
## Expected Outcome
97121

98122
When working correctly:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { defineCloudflareConfig } from "@opennextjs/cloudflare";
2+
3+
export default defineCloudflareConfig({});

0 commit comments

Comments
 (0)