Skip to content

Conversation

@tamalchowdhury
Copy link
Collaborator

@tamalchowdhury tamalchowdhury commented Nov 7, 2025

tutorial - check plan change eligibility

Learn how to set up automatic downgrade eligibility checks using Kinde billing and workflows.

Related issues & labels (optional)

  • Updates the workflow section with a new tutorial

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive tutorial for configuring automatic downgrade eligibility checks using Kinde billing and workflows, including step-by-step setup instructions, dashboard configuration, workflow deployment, and testing guidance.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Walkthrough

A new tutorial documentation file is added providing comprehensive guidance on configuring automatic plan downgrade eligibility checks using Kinde billing and workflows, spanning Prisma schema setup, user interface implementation, API endpoints, billing configuration, and workflow deployment steps.

Changes

Cohort / File(s) Summary
Plan Change Eligibility Tutorial
src/content/docs/workflows/workflow-tutorials/check-plan-change-eligibility.mdx
New tutorial document covering end-to-end setup for implementing automatic downgrade eligibility checks: Prisma schema and migrations, dashboard UI with server actions, API endpoints for usage tracking, billing plans and features configuration, and workflow creation for blocking downgrades based on usage limits. Includes code samples and deployment instructions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify accuracy and completeness of tutorial steps across all 7 parts
  • Validate code samples for syntax correctness and best practices
  • Check that workflow and billing configuration guidance aligns with current Kinde documentation

Poem

🐰✨ A new path unfolds with hop and bound,
Where downgrades and eligibility are found,
From schema to workflow, a tutorial so grand,
Helping developers across the land! 📚🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a tutorial about checking plan change eligibility. It is specific, concise, and clearly describes the primary addition to the codebase.
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
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tamal/feat/billing-wf-check-plan-change

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 and usage tips.

@cloudflare-workers-and-pages
Copy link

Deploying kinde-docs-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 89c5386
Status: ✅  Deploy successful!
Preview URL: https://c5863ed4.kinde-docs-preview.pages.dev
Branch Preview URL: https://tamal-feat-billing-wf-check-vzfm.kinde-docs-preview.pages.dev

View logs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
src/content/docs/workflows/workflow-tutorials/check-plan-change-eligibility.mdx (5)

40-40: Fix framework naming consistency and improve sentence clarity.

The framework should be referenced as "Next.js" (not "NextJS") per official naming conventions. Additionally, the phrase "in order to assess" can be simplified to "to assess" for conciseness. The introduction also appears to have a missing comma.

Suggested correction for line 40:

In this tutorial, you'll set up a way to check a customer's feature usage to assess if they can downgrade their plan.

Also applies to: 47-47


53-53: Standardize framework naming to "Next.js".

Multiple instances of "NextJS" should be corrected to "Next.js" throughout the document for consistency with official branding.

Also applies to: 58-58


790-803: Consider rewording repetitive sentence structures for better readability.

Lines 795-797 have three consecutive sentences beginning with "Select." While not incorrect, varying sentence structure improves documentation flow. For example:

  • Line 795: "Select the three dots..." → "Click the three dots..."
  • Line 797: "Select Make live..." → "Click Make live..."

1010-1010: Correct grammar for "sign in" usage.

Change "Sign into your [Kinde dashboard]" to "Sign in to your [Kinde dashboard]." The phrase "sign in to" is standard English for websites/software; "sign into" is primarily used in legal contexts ("signed into law").


1028-1028: Fix remaining framework naming and hyphenation issues.

  • Line 1028: Change "NextJS project" to "Next.js project"
  • Line 1033: Change "sign up process" to "sign-up process" (hyphenated form for noun usage)

Also applies to: 1033-1033

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7539406 and 89c5386.

📒 Files selected for processing (1)
  • src/content/docs/workflows/workflow-tutorials/check-plan-change-eligibility.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
src/content/docs/workflows/workflow-tutorials/check-plan-change-eligibility.mdx

[typographical] ~40-~40: It appears that a comma is missing.
Context: ...ility. ## About this tutorial In this tutorial you’ll set up a way to check a customer...

(DURING_THAT_TIME_COMMA)


[style] ~40-~40: Consider a more concise word here.
Context: ...ay to check a customer’s feature usage, in order to assess if they can downgrade their plan...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~40-~40: The official spelling of this programming framework is “Next.js”.
Context: ...y can downgrade their plan. We’ll use a NextJS project as part of the example. ## Wha...

(NODE_JS)


[uncategorized] ~47-~47: The official spelling of this programming framework is “Next.js”.
Context: ...yed to the internet, such as the [Kinde NextJS starter kit](https://github.com/kinde-s...

(NODE_JS)


[uncategorized] ~53-~53: The official spelling of this programming framework is “Next.js”.
Context: ...### Part 1: Prisma setup 1. Go to your NextJS project in your terminal. (e.g, `cd kin...

(NODE_JS)


[style] ~796-~796: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... User plans and select Save. 4. Select the three dots next to the pricing tabl...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~797-~797: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...d and select Edit pricing table. 5. Select Make live and select Save. 6. G...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[grammar] ~1010-~1010: The verb ‘Sign into’ is not standard English, except in the context of the law (“The bill was signed into law”). Write “Sign in to”. For websites and computers, other options are “log in to” or “log on to”.
Context: ...ed. ## Step 4: Deploy the workflow 1. Sign into your [Kinde dashboard](https://kinde.co...

(SIGN_INTO)


[uncategorized] ~1028-~1028: The official spelling of this programming framework is “Next.js”.
Context: ...est the workflow 1. Deploy your sample NextJS project to the internet, [such as Verce...

(NODE_JS)


[uncategorized] ~1033-~1033: The noun “sign-up” is spelled with a hyphen.
Context: ...project in a browser and go through the sign up process. You will see the plan selectio...

(SIGN_UP_HYPHEN)

🔇 Additional comments (4)
src/content/docs/workflows/workflow-tutorials/check-plan-change-eligibility.mdx (4)

123-699: Well-implemented UI and server logic.

The dashboard component, server actions, and styling demonstrate solid Next.js patterns with proper error handling, form validation, and accessibility considerations. The entitlement-checking logic properly integrates with Kinde's Account API, and cache invalidation with revalidatePath is correctly used.


702-753: Solid API endpoint implementation.

The endpoint correctly uses force-dynamic to ensure real-time usage data retrieval (critical for this use case), properly validates the kindeId parameter, and returns the expected JSON structure for workflow consumption.


807-948: Well-explained workflow implementation with comprehensive code documentation.

The workflow correctly implements plan change eligibility checking by comparing current usage against requested plan limits. The code explanation section (lines 950–1006) is thorough and walks developers through the logic effectively. Integration with environment variables is properly configured for the next steps.


1-1054: Comprehensive, well-structured tutorial with solid code examples.

This tutorial effectively guides developers through setting up automatic plan downgrade eligibility checks using Kinde billing and workflows. The code examples follow Next.js and TypeScript best practices, the step-by-step instructions are clear and logical, and the testing section provides realistic validation steps. The integration of Prisma, server actions, Kinde authentication, and workflows is well-coordinated.

Primary observations:

  • Code quality is high with proper error handling, validation, and accessibility considerations
  • Instructions are thorough and include helpful deployment/environment setup details
  • The testing scenario effectively validates the entire workflow

Minor issues flagged above relate to framework naming consistency ("NextJS" → "Next.js") and grammatical/style improvements that have been addressed in separate comments.

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.

2 participants