Skip to content

feat: scalar api documentation#31

Merged
weaponsforge merged 4 commits into
devfrom
feat/PHR-22
Apr 22, 2026
Merged

feat: scalar api documentation#31
weaponsforge merged 4 commits into
devfrom
feat/PHR-22

Conversation

@weaponsforge
Copy link
Copy Markdown
Owner

@weaponsforge weaponsforge commented Apr 22, 2026

Summary

  • Create an API documentation using Scalar under the root URL /, #22
  • Move the API documentation made with Redocly CLI in the /docs/redoc route
  • Update dependencies

Library Updates

Library Old New
@redocly/cli 2.28.1 2.29.1
mongoose 9.4.1 9.5.0
typescript-eslint 8.58.2 8.59.0

Related Issues

Type of Change

  • New feature
  • Documentation
  • Other (please describe): maintenance - dependency updates

Checklist

Summary by CodeRabbit

  • New Features

    • Added interactive Scalar-based API reference UI for exploring the API specification
  • Documentation

    • Updated API documentation links to include Scalar, Swagger UI, and Redoc format options
    • Refreshed documentation references across project files
  • Chores

    • Released version 1.2.0
    • Updated dependencies

- Loaded the scalar standalone api doc script from its cdn
- Used scalar api doc as the default api documentation in the root url
- Moved the redocly cli doc under /docs/redoc
- Update @redocly/cli 2.28.1 -> 2.29.1
- Update mongoose 9.4.1 -> 9.5.0
- Update typescript-eslint 8.58.2 -> 8.59.0
- Bump to version minor v1.2.0
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@weaponsforge has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 28 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83a9e346-7a89-4483-adb2-7eb9936128cd

📥 Commits

Reviewing files that changed from the base of the PR and between a3ded69 and cf3ebd2.

📒 Files selected for processing (2)
  • server/public/index.html
  • server/src/scripts/openapi/docs/api.info.ts
📝 Walkthrough

Walkthrough

This PR introduces a Scalar API reference UI alongside existing documentation options. Changes include updating README documentation links, adding a new Scalar UI page mounted at /public/index.html, updating OpenAPI metadata across multiple formats to reference all three documentation options (Scalar, Swagger UI, and Redoc), bumping the package version to 1.2.0, and adjusting the docs build output path.

Changes

Cohort / File(s) Summary
README Documentation Links
README.md
Updated "Online Demo" section API documentation links to include separate URLs for Interactive (Scalar), Interactive (Swagger UI), and Static (Redoc) documentation.
Scalar API Reference UI
server/public/index.html
New page that mounts Scalar API reference UI from CDN, loads OpenAPI spec from /openapi.json, and configures CORS proxy.
OpenAPI Metadata
server/public/openapi.json, server/public/openapi.yaml, server/src/scripts/openapi/docs/api.info.ts
Updated info.description to expand "Alternate Docs" into "Alternate API Documentation" with links for Scalar, Swagger UI, and Redoc. Changed info.x-logo.url path from ./assets/... to ../../assets/....
Package Configuration
server/package.json
Bumped version from 1.1.3 to 1.2.0, updated docs:build script output path to public/docs/redoc/index.html, and upgraded dependencies: mongoose, @redocly/cli, and typescript-eslint.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

  • PR #20: Updates README's Online Demo API documentation links with new documentation URL structure.
  • PR #16: Modifies OpenAPI info files and adjusts documentation build output paths for Redoc static generation.

Poem

🐰 A Scalar hops in, so shiny and bright,
Three docs now dance in the API's light,
From JSON to YAML, the links all align,
With Redoc and Swagger in perfect design!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: scalar api documentation' accurately summarizes the main change—adding Scalar API documentation as the new default at the root URL while moving Redocly to /docs/redoc.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/PHR-22

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.

Copy link
Copy Markdown

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
README.md (2)

328-330: ⚠️ Potential issue | 🟡 Minor

Fix the documented Redoc output path.

Line 330 still says docs:build writes to /server/public/index.html, but server/package.json now writes Redoc to /server/public/docs/redoc/index.html.

📝 Proposed README update
-Builds the API documentation using the [Redocly CLI](https://www.npmjs.com/package/@redocly/cli) into the `/server/public/index.html` file.
+Builds the API documentation using the [Redocly CLI](https://www.npmjs.com/package/@redocly/cli) into the `/server/public/docs/redoc/index.html` file.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 328 - 330, Update the README entry for the npm script
`docs:build` to reflect the current output path used by the
`server/package.json` script: change the documented Redoc output from
`/server/public/index.html` to `/server/public/docs/redoc/index.html` and ensure
the description references the Redocly CLI (`@redocly/cli`) building into that
new path.

72-83: ⚠️ Potential issue | 🟡 Minor

Update the dependency versions in the README table.

The manifest now uses Mongoose 9.5.0 and @redocly/cli 2.29.1, but Lines 75 and 82 still document the previous versions.

📝 Proposed README update
-| Mongoose | `9.4.1` | ODM for MongoDB that provides schema-based modeling and data interaction. |
+| Mongoose | `9.5.0` | ODM for MongoDB that provides schema-based modeling and data interaction. |
...
-| `@redocly/cli` | `2.28.1` | Generates an API documentation using an OpenAPI YAML input. |
+| `@redocly/cli` | `2.29.1` | Generates an API documentation using an OpenAPI YAML input. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 72 - 83, Update the README dependency table to
reflect the manifest changes: change the Mongoose version in the table entry for
"Mongoose" from `9.4.1` to `9.5.0` and change the `@redocly/cli` version in the
table entry for "@redocly/cli" from `2.28.1` to `2.29.1` so the documented
versions match the project's manifest.
🧹 Nitpick comments (1)
server/public/index.html (1)

18-20: Drop the Scalar proxy for the same-origin spec.

/openapi.json defines API endpoints at http://localhost:3001, which are same-origin relative to the Scalar page. For same-origin endpoints and localhost targets, the proxy is unused; Scalar's implementation automatically skips proxying for localhost.

♻️ Proposed simplification
     Scalar.createApiReference('#app', {
       // The URL of the OpenAPI/Swagger document
-      url: '/openapi.json',
-      // Avoid CORS issues
-      proxyUrl: 'https://proxy.scalar.com',
+      url: '/openapi.json'
     })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/public/index.html` around lines 18 - 20, The OpenAPI config sets url:
'/openapi.json' but also specifies proxyUrl: 'https://proxy.scalar.com'; remove
the proxyUrl entry (or leave it undefined) so the same-origin localhost spec
uses no Scalar proxy. Locate the block where url: '/openapi.json' and proxyUrl
are defined in server/public/index.html and delete the proxyUrl:
'https://proxy.scalar.com' line (or set proxyUrl to null/undefined) to simplify
the config.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/public/index.html`:
- Around line 11-12: Replace the unpinned CDN script tag that currently uses
"https://cdn.jsdelivr.net/npm/@scalar/api-reference" with a version-pinned URL
and include SRI and CORS attributes: update the script element (the <script
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"> tag) to point to the
tested release (e.g., append `@x.y.z`), add an integrity="sha384-..." attribute
with the computed SRI hash for that file and add crossorigin="anonymous";
alternatively, download and serve the asset from your own static files and
update the script tag to reference the local file instead.

In `@server/src/scripts/openapi/docs/api.info.ts`:
- Line 13: The description string in api.info.ts currently embeds Markdown-style
links inside an HTML <ul><li> block which some OpenAPI renderers may show as
literal text; update the description (the description constant/object where
BASE_API_URL is interpolated) to use either pure Markdown list syntax (e.g., "-
Interactive (Scalar): [BASE_API_URL](...)" ) or convert the HTML list items to
use HTML anchor tags (e.g., <li><a
href="${BASE_API_URL}">${BASE_API_URL}</a></li>) so links render correctly; keep
the BASE_API_URL interpolations intact and ensure the chosen format is
consistent across the three list items.

---

Outside diff comments:
In `@README.md`:
- Around line 328-330: Update the README entry for the npm script `docs:build`
to reflect the current output path used by the `server/package.json` script:
change the documented Redoc output from `/server/public/index.html` to
`/server/public/docs/redoc/index.html` and ensure the description references the
Redocly CLI (`@redocly/cli`) building into that new path.
- Around line 72-83: Update the README dependency table to reflect the manifest
changes: change the Mongoose version in the table entry for "Mongoose" from
`9.4.1` to `9.5.0` and change the `@redocly/cli` version in the table entry for
"@redocly/cli" from `2.28.1` to `2.29.1` so the documented versions match the
project's manifest.

---

Nitpick comments:
In `@server/public/index.html`:
- Around line 18-20: The OpenAPI config sets url: '/openapi.json' but also
specifies proxyUrl: 'https://proxy.scalar.com'; remove the proxyUrl entry (or
leave it undefined) so the same-origin localhost spec uses no Scalar proxy.
Locate the block where url: '/openapi.json' and proxyUrl are defined in
server/public/index.html and delete the proxyUrl: 'https://proxy.scalar.com'
line (or set proxyUrl to null/undefined) to simplify the config.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 57eed64f-e48f-49bd-8eeb-ce710455e550

📥 Commits

Reviewing files that changed from the base of the PR and between 8023b23 and a3ded69.

⛔ Files ignored due to path filters (1)
  • server/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • README.md
  • server/package.json
  • server/public/docs/redoc/index.html
  • server/public/index.html
  • server/public/openapi.json
  • server/public/openapi.yaml
  • server/src/scripts/openapi/docs/api.info.ts

Comment thread server/public/index.html Outdated
Comment thread server/src/scripts/openapi/docs/api.info.ts Outdated
@weaponsforge weaponsforge merged commit 9c72840 into dev Apr 22, 2026
2 checks passed
@weaponsforge weaponsforge deleted the feat/PHR-22 branch April 22, 2026 12:17
@weaponsforge weaponsforge mentioned this pull request Apr 22, 2026
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.

1 participant