feat: new guide - Deploy a Kinde app on Cloudflare Workers#664
feat: new guide - Deploy a Kinde app on Cloudflare Workers#664tamalchowdhury wants to merge 12 commits intomainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a Cloudflare Workers deployment guide; adjusts frontmatter (sidebar order, titles, relatedArticles) across multiple docs; restructures the Next.js SDK guide with middleware and a new client-side AuthProvider, converting RootLayout to a synchronous export; expands the edge-workers overview with platform-specific guidance. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Middleware
participant AppServer
participant KindeAuth
Client->>Middleware: HTTP request to route
Middleware->>AppServer: Check session / validate token
AppServer->>KindeAuth: Verify token / exchange code / fetch user
KindeAuth-->>AppServer: Return verification / user session
AppServer-->>Middleware: Session validated
Middleware-->>Client: Serve content or redirect to login
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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. Comment |
Deploying kinde-docs-preview with
|
| Latest commit: |
2d0d900
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bf825746.kinde-docs-preview.pages.dev |
| Branch Preview URL: | https://tamal-feat-cloudflare-worker.kinde-docs-preview.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx (1)
247-256:⚠️ Potential issue | 🟠 Major
isAuthenticated()is async but is called withoutawaitin a non-async function.
getKindeServerSession().isAuthenticated()returns aPromise(see migration note at line 2144 and correct usage on lines 531, 595). Withoutawait, the condition on line 250 always evaluates to truthy (a Promise object), so the guard never fires. Readers copying this snippet will have a broken auth check.Proposed fix
- export default function Dashboard() { + export default async function Dashboard() { const { isAuthenticated } = getKindeServerSession() - if (!isAuthenticated()) { + if (!(await isAuthenticated())) { return <div>You are not authenticated</div> } return <div>Dashboard</div> }
🤖 Fix all issues with AI agents
In `@src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx`:
- Around line 168-178: The docs currently put KINDE_CLIENT_SECRET in the
wrangler.toml [vars] block which exposes it in repo history; update the guide to
recommend keeping only non-secret values in [vars] and instruct readers to set
the client secret using Cloudflare's secret storage (e.g., tell them to run npx
wrangler secret put KINDE_CLIENT_SECRET) and note that secrets set via wrangler
secret are encrypted and not stored in wrangler.toml; reference the
wrangler.toml snippet and the KINDE_CLIENT_SECRET variable so editors can
replace the literal secret with guidance text and the CLI command.
- Around line 103-111: Remove the invalid JavaScript-style comment inside the
JSON code block and ensure the block contains only valid JSON; specifically,
edit the code block that shows package.json scripts (the "scripts" object
containing "preview", "deploy", and "cf-typegen") by deleting the line with "//
package.json" or moving that note above the code block as plain text so the JSON
remains parseable when copied.
In `@src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx`:
- Around line 233-239: The code example for the React component Home has a
malformed closing sequence ")}" that merges the JSX return closing and the
function body closing on one line; update the Home component so the JSX return
is closed with a separate closing parenthesis and semicolon (or newline) and the
function body is closed on the next line with a standalone brace, keeping proper
indentation for the return block that contains <LoginLink> and <RegisterLink>.
In `@src/content/docs/integrate/third-party-tools/kinde-edge-workers.mdx`:
- Around line 88-91: Update the Nuxt on Vercel link under the "Nuxt on Vercel"
section: replace the old URL
`https://vercel.com/docs/frameworks/nuxt#edge-functions` with the current path
`https://vercel.com/docs/frameworks/full-stack/nuxt` and confirm whether the
`#edge-functions` anchor exists; if the anchor is missing or different, remove
or adjust the fragment to point to the correct section on the Nuxt doc page so
the link resolves correctly.
🧹 Nitpick comments (2)
src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx (2)
62-67: Table row aboutKindeProvidercould be more precise.The advice "Avoid for SSR - use server-side auth patterns" is helpful, but it may be worth briefly noting why (e.g., it depends on client-side APIs or hydration behavior incompatible with the Workers edge runtime). A single parenthetical or link to the troubleshooting section below (line 200) would help readers connect the dots without having to scroll.
88-99: Consider noting thatcompatibility_dateshould be kept current.The hardcoded
"2026-02-06"is fine as a starting reference, but readers copying this months later may not realize they should update it. A brief inline comment in the TOML (e.g.,# use today's date) would help.
src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx
Show resolved
Hide resolved
src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx (1)
245-257:⚠️ Potential issue | 🟠 Major
isAuthenticated()returns a Promise — calling it withoutawaitin a non-async function is always truthy.The
Dashboardcomponent was changed fromasyncto a plain function, butisAuthenticated()still returns a promise (as documented in this same file at line 532 and in the migration notes at line 2146). APromiseobject is truthy, so!isAuthenticated()is alwaysfalseand the "not authenticated" branch is unreachable.Either restore
async/awaitor add a note that this example uses the client-side pattern.Proposed fix (restore async/await to match the SDK behavior)
- export default function Dashboard() { - const { isAuthenticated } = getKindeServerSession() + export default async function Dashboard() { + const { isAuthenticated } = getKindeServerSession() - if (!isAuthenticated()) { + if (!(await isAuthenticated())) { return <div>You are not authenticated</div> } return <div>Dashboard</div> }
🤖 Fix all issues with AI agents
In `@src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx`:
- Around line 62-66: Update the table row about Environment variables to clarify
secrets vs public vars: change the Cloudflare Workers cell text from "Must be in
`wrangler.toml` `[vars]` section" to something like "Public vars in
`wrangler.toml` `[vars]`; secrets via `wrangler secret put`" so it matches Step
3 and prevents putting secrets such as KINDE_CLIENT_SECRET into `[vars]`; ensure
references to `wrangler.toml`, `[vars]`, `wrangler secret put`, and
KINDE_CLIENT_SECRET are used to locate and update the table entry.
🧹 Nitpick comments (1)
src/content/docs/integrate/third-party-tools/kinde-edge-workers.mdx (1)
64-64: Nit: "JWT tokens" is redundant (the T in JWT stands for Token).Consider using "verify JWTs" or "verify JWT access tokens" instead of "verify JWT tokens."
Proposed fix
-If you need to **verify JWT tokens** in Cloudflare Workers (for API protection or custom authentication flows), use our JWT verification guide: +If you need to **verify JWTs** in Cloudflare Workers (for API protection or custom authentication flows), use our JWT verification guide:
src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx`:
- Around line 226-230: Update the troubleshooting step so it does not instruct
users to add secrets to the `[vars]` section of wrangler.toml: change step 2 to
clarify that only non-secret Kinde environment variables belong in `[vars]` and
explicitly state that KINDE_CLIENT_SECRET (and any other client secrets) must be
stored as secrets via wrangler secret (or environment-specific secret storage)
rather than committed in `[vars]`; reference the existing step text that
mentions `wrangler.toml`, `KINDE_CLIENT_SECRET`, and the `[vars]` section when
making the edit.
src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx
Show resolved
Hide resolved
|
@tamalchowdhury also add in a note that when they change to use a custom domain within Cloudflare that that URL will be updated in a few places where the env vars are used. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/content/docs/developer-tools/guides/deploy-on-cloudflare-workers.mdx`:
- Around line 256-258: Add a trailing period to the sentence that ends with
"without the `nodejs_compat_populate_process_env` compatibility flag" in the
paragraph starting "Environment variables must be defined in `wrangler.toml`..."
and, while editing that paragraph, make the Cloudflare link ("Cloudflare Next.js
documentation") more prominent (e.g., move it earlier in the sentence or
emphasize the link text) so it’s clearer to readers.
- Around line 159-161: Update the Aside note to explicitly list which URLs must
be updated when using a custom domain: mention KINDE_SITE_URL,
KINDE_POST_LOGIN_REDIRECT_URL, and KINDE_POST_LOGOUT_REDIRECT_URL in
wrangler.toml as well as the callback and logout redirect URLs configured in the
Kinde dashboard; state that all these values should point to the new custom
domain and give brief guidance to update both wrangler.toml and the Kinde
dashboard settings.
Description (required)
Related issues & labels (optional)
Summary by CodeRabbit