Skip to content

Feat/nextjs doc - #642

Merged
Leo-rq-yu merged 18 commits into
mainfrom
feat/nextjs-doc
Dec 17, 2025
Merged

Leo-rq-yu merged 18 commits into
mainfrom
feat/nextjs-doc

Conversation

@Leo-rq-yu

@Leo-rq-yu Leo-rq-yu commented Dec 13, 2025 •

Copy link
Copy Markdown
Contributor

Summary

How did you test this change?

Summary by CodeRabbit

  • New Features

    • Added support for Next.js server-side rendering authentication components.
  • Documentation

    • Restored Next.js UI component authentication documentation.
    • Updated SDK authentication initialization to use token-based authentication.

✏️ Tip: You can customize this high-level summary in your review settings.

@Leo-rq-yu
Leo-rq-yu marked this pull request as draft December 13, 2025 21:50
@coderabbitai

coderabbitai Bot commented Dec 13, 2025 •

Copy link
Copy Markdown
Contributor

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR re-enables Next.js UI authentication component documentation by uncommenting the DOCS_MAP entry and adding the new docType to the schema. The SDK initialization is updated to use edgeFunctionToken instead of anonKey for authenticated user access.

Changes

Cohort / File(s) Change Summary
Documentation Type Registration & Mapping
backend/src/api/routes/docs/index.routes.ts, shared-schemas/src/docs.schema.ts, docs/insforge-instructions-sdk.md
Re-enables auth-components-nextjs docType in DOCS_MAP; adds auth-components-nextjs enum value to docTypeSchema; documents the new authentication component option in SDK instructions.
Next.js Authentication Component Documentation
docs/core-concepts/authentication/ui-components/nextjs.mdx
Updates SDK initialization to use edgeFunctionToken instead of anonKey for authenticated access.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify that the edgeFunctionToken authentication change aligns with intended security model
  • Confirm DOCS_MAP entry path correctly routes to the nextjs.mdx documentation file
  • Validate schema enum addition propagates correctly through the system
  • Cross-check consistency of the new docType across all four modified files

Possibly related PRs

  • PR #563: Modifies the same DOCS_MAP entry and nextjs.mdx file with overlapping documentation mapping re-enablement.
  • PR #531: Initial implementation adding auth-components-nextjs support and foundational nextjs.mdx documentation.
  • PR #572: Concurrent modifications to nextjs.mdx for Next.js quick-start flow updates.

Suggested reviewers

  • tonychang04
  • Fermionic-Lyu

Poem

🐰 Hop, hop, hurray! The docs spring to life,
With auth-components-nextjs shining bright.
edgeFunctionToken lights the way,
Schema, routes, and docs ballet,
NextJS authentication takes flight! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'Feat/nextjs doc' is vague and lacks specificity about what was actually changed or added regarding Next.js documentation. Provide a more descriptive title that clarifies the specific change, such as 'Add Next.js authentication component documentation and schema support' or 'Enable auth-components-nextjs documentation mapping'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/nextjs-doc

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 204f271 and 3e491f6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • backend/src/api/routes/docs/index.routes.ts (1 hunks)
  • docs/core-concepts/authentication/ui-components/nextjs.mdx (1 hunks)
  • docs/insforge-instructions-sdk.md (1 hunks)
  • shared-schemas/src/docs.schema.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx}: Use TypeScript for all code files
Prefer descriptive, unabbreviated variable and function names
Follow consistent file naming: kebab-case for files, PascalCase for components
Use ES modules (import/export syntax)
Implement proper error handling with try-catch blocks
Add appropriate logging for debugging
Use camelCase for variables, parameters, properties, and functions
Use UPPER_CASE for constants and Enum members
Avoid snake_case except in SQL queries and external APIs
Use single quotes for strings
Include semicolons at the end of statements
Use arrow functions for callbacks and inline functions
Prefer const over let, avoid var
Use template literals for string interpolation
Maintain consistent indentation (2 spaces)
Format code with Prettier configuration
Include JSDoc comments for complex functions

Files:

  • shared-schemas/src/docs.schema.ts
  • backend/src/api/routes/docs/index.routes.ts
{backend/src/**/*.{ts,js},shared-schemas/**/*.{ts,js}}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Zod schemas for request/response validation in backend

Files:

  • shared-schemas/src/docs.schema.ts
  • backend/src/api/routes/docs/index.routes.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use PascalCase for React components and TypeScript types/interfaces

Files:

  • shared-schemas/src/docs.schema.ts
  • backend/src/api/routes/docs/index.routes.ts
backend/src/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

backend/src/**/*.{ts,js}: Use async/await for asynchronous operations in backend code
Implement proper database transaction handling
Sanitize data before database operations
Use prepared statements for SQL queries
Implement proper database indexing

Files:

  • backend/src/api/routes/docs/index.routes.ts
backend/src/api/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

backend/src/api/**/*.{ts,js}: Implement proper middleware for authentication and error handling
Follow RESTful conventions for API endpoints
Implement rate limiting for API endpoints

Files:

  • backend/src/api/routes/docs/index.routes.ts
backend/src/{controllers,api}/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Return consistent API responses using utility functions

Files:

  • backend/src/api/routes/docs/index.routes.ts
{backend,frontend}/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use environment variables for configuration

Files:

  • backend/src/api/routes/docs/index.routes.ts
backend/src/{api,core,controllers}/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Implement proper authentication and authorization

Files:

  • backend/src/api/routes/docs/index.routes.ts
{backend/src,frontend/src}/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

{backend/src,frontend/src}/**/*.{ts,tsx,js,jsx}: Implement proper caching strategies
Monitor and log performance metrics

Files:

  • backend/src/api/routes/docs/index.routes.ts
{backend/src/api,openapi}/**/*.{ts,yaml,yml,json}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Document all API endpoints with clear descriptions

Files:

  • backend/src/api/routes/docs/index.routes.ts
🧠 Learnings (4)
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to {backend/src/api,openapi}/**/*.{ts,yaml,yml,json} : Document all API endpoints with clear descriptions

Applied to files:

  • backend/src/api/routes/docs/index.routes.ts
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to backend/src/{api,core,controllers}/**/*.{ts,js} : Implement proper authentication and authorization

Applied to files:

  • backend/src/api/routes/docs/index.routes.ts
  • docs/insforge-instructions-sdk.md
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to backend/src/api/**/*.{ts,js} : Implement proper middleware for authentication and error handling

Applied to files:

  • docs/insforge-instructions-sdk.md
📚 Learning: 2025-11-04T05:18:26.126Z
Learnt from: Fermionic-Lyu
Repo: InsForge/InsForge PR: 553
File: docs/changelog.mdx:6-35
Timestamp: 2025-11-04T05:18:26.126Z
Learning: The InsForge JavaScript SDK repository is named "insforge-sdk-js" and is located at https://github.com/insforge/insforge-sdk-js

Applied to files:

  • docs/core-concepts/authentication/ui-components/nextjs.mdx
🔇 Additional comments (4)
backend/src/api/routes/docs/index.routes.ts (1)

22-22: LGTM! Documentation mapping correctly re-enabled.

The uncommented entry properly maps the new doc type to the Next.js authentication UI components documentation file, consistent with the schema update in shared-schemas/src/docs.schema.ts.

docs/insforge-instructions-sdk.md (1)

58-58: LGTM! Documentation type list updated consistently.

The addition of "auth-components-nextjs" with clear SSR context aligns with the schema changes and provides proper guidance for Next.js users.

shared-schemas/src/docs.schema.ts (1)

11-11: LGTM! Schema properly extended for Next.js documentation.

The enum and description additions correctly enable type-safe validation of the new doc type throughout the application.

Also applies to: 22-22

docs/core-concepts/authentication/ui-components/nextjs.mdx (1)

185-189: Verify the SDK parameter name for authenticated access.

The code uses edgeFunctionToken for SDK client initialization, but official InsForge SDK documentation only documents the baseUrl parameter. Verify that edgeFunctionToken is a valid parameter in the @insforge/sdk API, as it does not appear in the published documentation.


Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shared-schemas/package.json Resolved
@Leo-rq-yu
Leo-rq-yu changed the base branch from feat/refresh-token to main December 17, 2025 01:08
@Leo-rq-yu
Leo-rq-yu marked this pull request as ready for review December 17, 2025 01:58
@Leo-rq-yu
Leo-rq-yu merged commit 9c06634 into main Dec 17, 2025
Fermionic-Lyu pushed a commit that referenced this pull request Dec 17, 2025
* ✨Introduced apis to refresh tokens

* Test new method

* Renamed config

* Resolve comments

* Resolve comments #2

* Fixed a bug

* Remove unused code

* Refresh token mechanism ready to review

* Introduce csrf token

* Introduce csrf token #2

* Extract csrf token logic from cookies

* Switch to store csrf token into cookies

* Enabled nextjs docs

* Enabled in docs map

* Enabled in instructions

* Fixed wrong instruction in docs

* Reverted changes in auth & updated versions

* Reverted changes #2
@coderabbitai coderabbitai Bot mentioned this pull request Dec 21, 2025
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