Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/supabase #354

Merged
merged 2 commits into from
Mar 4, 2025
Merged

Feat/supabase #354

merged 2 commits into from
Mar 4, 2025

Conversation

clairekinde11
Copy link
Collaborator

@clairekinde11 clairekinde11 commented Mar 4, 2025

New topic. Completed by Tamal

Summary by CodeRabbit

  • Documentation
    • Introduced a comprehensive guide on integrating secure user authentication and database management into a Next.js to-do application.
    • The guide walks through account setup, configuration of authentication endpoints, and creating user-specific data policies.

@clairekinde11 clairekinde11 requested a review from oliwolff1 March 4, 2025 05:54
Copy link
Contributor

coderabbitai bot commented Mar 4, 2025

Walkthrough

A new markdown document is added that provides a comprehensive guide for integrating Kinde authentication with Supabase database management in a Next.js application. The guide details the step-by-step setup of the Kinde application, Supabase project, Next.js development environment, and the creation of a to-do application with secure database policies and user-to-task linking.

Changes

File(s) Change Summary
src/content/docs/.../kinde-supabase.mdx New file added with detailed integration instructions for Kinde authentication and Supabase database setup in a Next.js to-do application

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant NextApp as Next.js App
    participant Kinde
    participant Supabase

    User->>NextApp: Access to-do application
    NextApp->>Kinde: Redirect for authentication
    Kinde-->>User: Present login interface
    User->>Kinde: Submit credentials
    Kinde->>NextApp: Callback with token
    NextApp->>Supabase: Query to-do items (with token)
    Supabase-->>NextApp: Return user-specific to-dos
    NextApp-->>User: Display to-do list
Loading

Suggested reviewers

  • DaveOrDead
  • viv-kinde

Poem

In fields of code I bound and leap,
A guide is born, so clear and deep.
Kinde and Supabase dance in rhyme,
A to-do app built just in time.
Hop along with every line, a rabbit's cheer divine!
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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 (7)
src/content/docs/integrate/third-party-tools/kinde-supabase.mdx (7)

22-42: Step 1: Kinde Application Setup

The instructions for setting up your Kinde application are thorough and easy to follow.

  • Formatting Suggestion: In step 4 (line 27), the label NextJS is used. For correctness and consistency with the official framework name, consider updating it to Next.js.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~27-~27: The official spelling of this programming framework is “Next.js”.
Context: ...Quick start* page opens. 4. Select NextJS from the list of back-end SDKs, then ...

(NODE_JS)


43-104: Step 2: Supabase Project Setup

The guide provides detailed steps for setting up a Supabase project, including project configuration, generating JWT secrets, and creating/inserting data into the todos table.

  • Consistency Note: The table is created as todos (without a hyphen) while textual references occasionally use "to-do". Ensure that your documentation consistently uses one form for clarity. If todos is the intended table name, consider referencing it as such throughout.
🧰 Tools
🪛 LanguageTool

[grammar] ~96-~96: It appears that a hyphen is missing in the plural noun “to-dos”?
Context: ... ``` This command creates a todos table with the following columns: ...

(TO_DO_HYPHEN)


[uncategorized] ~98-~98: Loose punctuation mark.
Context: ...following columns: - task: with a type of text. - **`user_...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~99-~99: Loose punctuation mark.
Context: ... a type of text. - user_id: with a type of text. - **`compl...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~100-~100: Loose punctuation mark.
Context: ...of text. - completed_state: with a type of boolean. We use bool...

(UNLIKELY_OPENING_PUNCTUATION)


[grammar] ~102-~102: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...e. It also inserts four sample todo items. We will need this for later. ...

(TO_DO_HYPHEN)


105-112: Step 3: Next.js Project Initialization

The instructions for initializing a Next.js project are clear.

  • Correction: The heading "Setup a NextJS project with Supabase and Kinde" (line 105) should be updated to "Setup a Next.js project with Supabase and Kinde" to adhere to the official naming.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~105-~105: The official spelling of this programming framework is “Next.js”.
Context: ...his for later. ## Step 3: Setup a NextJS project with Supabase and Kinde 1. Run...

(NODE_JS)


141-160: Step 3: Environment Variables Setup

The instructions for creating the .env.local file are clear.

  • Code Block Language: The command touch .env.local is enclosed in a code block marked as sql. Since it is a shell command, changing the language specifier to bash (or a similar shell-friendly language) would improve clarity.

161-240: Step 3: Header Authentication Component Update

The updated content for components/header-auth.tsx is well-structured and clearly demonstrates the integration of Kinde Auth components.

  • Code Block Language: The code block is marked as sql although the contents are TypeScript/JSX. Updating the marker to tsx will help maintain consistency with the file type.

300-307: Step 4: To-do App Setup (Directory and File Creation)

The terminal commands to create the todo directory and a page.tsx file are clear.

  • Consistency Suggestion: The directory is named todo here. If your guide later refers to "to-do" using a hyphen (as seen in some parts), ensure that this naming is consistent throughout the documentation.
🧰 Tools
🪛 LanguageTool

[grammar] ~302-~302: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...ory, on a new terminal window, create a todo directory with a page.tsx file insid...

(TO_DO_HYPHEN)


309-376: Step 4: To-do Page Implementation

The code for rendering the to-do list page is clean and easy to understand.

  • Enhancement Suggestion: Consider adding basic error handling or loading states for the Supabase query to improve robustness, especially for real-world applications.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccb6c18 and fdf5349.

📒 Files selected for processing (1)
  • src/content/docs/integrate/third-party-tools/kinde-supabase.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
src/content/docs/integrate/third-party-tools/kinde-supabase.mdx

[uncategorized] ~27-~27: The official spelling of this programming framework is “Next.js”.
Context: ...Quick start* page opens. 4. Select NextJS from the list of back-end SDKs, then ...

(NODE_JS)


[grammar] ~96-~96: It appears that a hyphen is missing in the plural noun “to-dos”?
Context: ... ``` This command creates a todos table with the following columns: ...

(TO_DO_HYPHEN)


[uncategorized] ~98-~98: Loose punctuation mark.
Context: ...following columns: - task: with a type of text. - **`user_...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~99-~99: Loose punctuation mark.
Context: ... a type of text. - user_id: with a type of text. - **`compl...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~100-~100: Loose punctuation mark.
Context: ...of text. - completed_state: with a type of boolean. We use bool...

(UNLIKELY_OPENING_PUNCTUATION)


[grammar] ~102-~102: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...e. It also inserts four sample todo items. We will need this for later. ...

(TO_DO_HYPHEN)


[uncategorized] ~105-~105: The official spelling of this programming framework is “Next.js”.
Context: ...his for later. ## Step 3: Setup a NextJS project with Supabase and Kinde 1. Run...

(NODE_JS)


[grammar] ~302-~302: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...ory, on a new terminal window, create a todo directory with a page.tsx file insid...

(TO_DO_HYPHEN)


[grammar] ~435-~435: It appears that a hyphen is missing in the plural noun “to-dos”?
Context: ...n your Supabase project, and open the todos table. 5. Locate the rows correspondi...

(TO_DO_HYPHEN)

🔇 Additional comments (10)
src/content/docs/integrate/third-party-tools/kinde-supabase.mdx (10)

1-9: YAML Front Matter: Validity Check

The YAML front matter is well-formed and contains the necessary metadata. Ensure that the page_id and relatedArticles IDs are valid and maintained consistently throughout the documentation system.


11-16: Introduction Section Clarity

The introduction clearly explains the importance of integrating Kinde for authentication with Supabase for secure data access. The content is concise and provides a good overview of the guide.


17-21: Prerequisites List

The prerequisites listed under "What you need" are clear and provide useful links for users to get started. No issues found.


113-127: Step 3: Dependency Installation and Auth Endpoint Setup

The dependency installation commands and instructions to create the Kinde auth endpoint (lines 127–132) are clear and accurate.


241-290: Step 3: Supabase Client Initialization

The implementation for creating a Supabase client with integrated Kinde authentication and JWT signing is comprehensive.

  • Security/Correctness Check: Verify that the usage of jwt.sign (line 257) is appropriate for your security requirements (e.g., ensuring proper payload handling and token expiration settings). Consider adding additional options or error handling as needed.

292-296: Step 3: Starting the Development Environment

The instructions to start the development server with npm run dev are straightforward and clear.


382-387: Step 4: Redirect URL Update

The instructions for updating the KINDE_POST_LOGIN_REDIRECT_URL in .env.local are clear and correctly formatted.


389-423: Step 5: Defining Database Policies

The SQL snippets provided for creating the function get_user_id() and the row-level security policy are well-documented and explain the purpose of each step clearly.


424-444: Step 6: Linking Kinde ID to To-do Items

The guide explains how to manually update the user_id within the Supabase todos table effectively, with clear instructions and helpful screenshots.

🧰 Tools
🪛 LanguageTool

[grammar] ~435-~435: It appears that a hyphen is missing in the plural noun “to-dos”?
Context: ...n your Supabase project, and open the todos table. 5. Locate the rows correspondi...

(TO_DO_HYPHEN)


445-452: Conclusion and Next Steps

The concluding section offers motivation for further enhancements and effectively rounds off the guide. The call to extend the application with additional features is a nice touch.

Copy link

Deploying kinde-docs-previews with  Cloudflare Pages  Cloudflare Pages

Latest commit: fdf5349
Status: ✅  Deploy successful!
Preview URL: https://18c4333d.kinde-docs-previews.pages.dev
Branch Preview URL: https://feat-supabase.kinde-docs-previews.pages.dev

View logs

Copy link
Member

@oliwolff1 oliwolff1 left a comment

Choose a reason for hiding this comment

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

Glanced over titles, images and structure of page on CloudFlare - looks good to me!

@clairekinde11 clairekinde11 merged commit 99a9dc7 into main Mar 4, 2025
5 checks passed
@clairekinde11 clairekinde11 deleted the feat/Supabase branch March 4, 2025 06:18
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