Skip to content

feat(routing): color-coded RouteAnatomy component + routing docs sync#531

Merged
ReneWerner87 merged 4 commits into
masterfrom
docs/routing-guide-restructure
May 22, 2026
Merged

feat(routing): color-coded RouteAnatomy component + routing docs sync#531
ReneWerner87 merged 4 commits into
masterfrom
docs/routing-guide-restructure

Conversation

@ReneWerner87
Copy link
Copy Markdown
Member

@ReneWerner87 ReneWerner87 commented May 22, 2026

Summary

Adds a RouteAnatomy component used at the top of the routing guide, and syncs the routing docs from the companion PR gofiber/fiber#4311.

New component: src/components/route-anatomy

Renders a multi-line Fiber route declaration where each part of the example is color-coded and links to the section that explains it:

  • app.Get -> Route Handlers (method)
  • "/users/:id" -> Paths (path), with :id -> Parameters
  • func(c fiber.Ctx) error -> Route Handlers (handler / middleware)

Details:

  • Part colors mirror the configured Prism themes (GitHub in light mode, Dracula in dark mode), so the anatomy reads like a real Go code block in both color modes.
  • Parts are clickable (jump to the section) and show their role on hover.
  • Larger, bordered block so it stands out as the guide's orientation map.

Synced docs/core (from gofiber/fiber#4311)

Brings docs/core in line with the upstream routing-docs restructure so the site builds with the new component:

  • guide/routing.md reorganized (Anatomy -> Route Handlers -> Get vs Use vs All -> Paths -> Parameters -> Middleware -> Grouping -> Automatic HEAD -> Handler types), examples flattened into tabs.
  • guide/grouping.md gains Route and RouteChain.
  • api/app.md: State / SharedState sorted, RebuildTree + RemoveRoute* grouped under Route Management, Helpers moved to the bottom, toc_max_heading_level: 4.
  • New routing partials (use.md, handler-types.md) and updated handler.md.

Validation

  • npm run typecheck passes.
  • npm run build:docs succeeds; the component renders in light and dark mode.

Note: docs/core is normally auto-synced from gofiber/fiber. The synced markdown is included here so the site builds with the new component now; it can be dropped if you prefer to rely on the auto-sync once gofiber/fiber#4311 merges.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Reorganized routing guides: added route anatomy, expanded handler-types, clarified Use/middleware semantics, routing order, parameters, constraints, and Test/Handler cautions
    • Added Route Management section for dynamic route registration/removal and refreshed grouping guide with Route and RouteChain patterns
  • New Features

    • Added an interactive route-anatomy visualization component with styling and examples

Review Change Stack

Add a RouteAnatomy component that renders a Fiber route declaration with each
part (method, path, parameter, handler) color-coded and linked to its guide
section, so readers can hover or click parts directly in the example.

Sync the routing guide, grouping guide, app reference, and routing partials
from gofiber/fiber so docs/core uses the component and matches the upstream
restructure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 22, 2026 22:00
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly reorganizes and enhances the Fiber documentation, particularly regarding routing, middleware, and handler types. Key additions include a new RouteAnatomy component for visual guidance and a comprehensive breakdown of supported handler signatures. Feedback was provided regarding the RouteAnatomy component, where the current JSX structure within a

 tag may inadvertently introduce unwanted whitespace, potentially disrupting the intended code block formatting.

Comment thread src/components/route-anatomy/index.tsx
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces a new RouteAnatomy MDX component to visually explain Fiber route declarations, and updates/syncs routing-related documentation content/structure to match upstream changes so the docs site builds and the routing guide reads cohesently.

Changes:

  • Added src/components/route-anatomy to render a color-coded, linkable route “anatomy” block.
  • Reorganized and expanded routing documentation (new partials, new guide structure/sections, updated examples).
  • Restructured docs/core/api/app.md routing-related sections (including Route Management + moved Helpers) and aligned internal links/TOC depth.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/components/route-anatomy/styles.module.css Adds styling for the new route anatomy block, including light/dark token colors.
src/components/route-anatomy/index.tsx Implements the new RouteAnatomy component with clickable, color-coded route parts.
docs/core/partials/routing/use.md New “Use” partial extracted for reuse in guide/API docs.
docs/core/partials/routing/handler.md Updates/condenses route handler documentation content.
docs/core/partials/routing/handler-types.md New partial documenting supported handler shapes and examples.
docs/core/guide/routing.md Major routing guide restructure; embeds RouteAnatomy and new partials.
docs/core/guide/grouping.md Adds documentation for Route and RouteChain.
docs/core/api/app.md Reorganizes App API docs sections and links; adds Route Management section and TOC depth.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/route-anatomy/index.tsx
Comment thread src/components/route-anatomy/index.tsx
Comment thread src/components/route-anatomy/styles.module.css
Comment thread docs/core/api/app.md Outdated
Point the `func(c fiber.Ctx) error` part at the Handler types section, since
it is a handler shape. Sync routing.md to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Warning

Review limit reached

@ReneWerner87, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 2 reviews/hour. Refill in 12 minutes and 56 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, 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 trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a0c1632-ab24-4fef-a00a-f010e28dbfb3

📥 Commits

Reviewing files that changed from the base of the PR and between c5739b2 and 47bc91d.

📒 Files selected for processing (6)
  • versioned_docs/version-v3.x/api/app.md
  • versioned_docs/version-v3.x/guide/grouping.md
  • versioned_docs/version-v3.x/guide/routing.md
  • versioned_docs/version-v3.x/partials/routing/handler-types.md
  • versioned_docs/version-v3.x/partials/routing/handler.md
  • versioned_docs/version-v3.x/partials/routing/use.md
📝 Walkthrough

Walkthrough

Restructures Fiber routing docs: adds a Route Anatomy component, new handler-types and Use partials, expands routing guide (parameters, constraints, middleware), extends grouping with Route/RouteChain, and reorganizes the API App reference with a Route Management section.

Changes

Fiber Routing Documentation Restructuring

Layer / File(s) Summary
Route Anatomy UI Component
src/components/route-anatomy/index.tsx, src/components/route-anatomy/styles.module.css
New React component renders an interactive, syntax-highlighted Fiber route "anatomy" with anchor links and dark-mode token styling.
Routing handler and Use partials
docs/core/partials/routing/handler-types.md, docs/core/partials/routing/use.md, docs/core/partials/routing/handler.md
Adds handler-types enumerating supported handler adapters (Fiber-native, Express-style, net/http, fasthttp) with examples; Use documents prefix-matching/mount semantics and examples; handler.md clarifies Add/All semantics and adds examples.
Comprehensive Routing Guide Rework
docs/core/guide/routing.md
Introduces "Anatomy of a route", rewrites parameters (:, +, *, optionality), clarifies constraints/regex/datetime behavior, reworks middleware with Use reference and runtime route modification caution, and relocates grouping/HEAD/handler-types sections.
Grouping guide: Route & RouteChain
docs/core/guide/grouping.md
Adds Route for grouped route registration under a prefix and RouteChain for shared-path method chaining; documents All semantics within a chain and example usage.
API App Documentation Reorganization
docs/core/api/app.md
Adds Use subsection, mount-prefix caution, updates RouteChain/Stack/Handler examples, moves State/SharedState, clarifies app.Test defaults vs empty fiber.TestConfig{}, and groups dynamic route management with RemoveRoute, RemoveRouteByName, RemoveRouteFunc and moved Helpers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • gofiber/fiber#4304: Related to RouteChain example/middleware chaining semantics and Go-syntax fixes referenced by the docs updates.
  • gofiber/fiber#3230: Implementation PR adding RemoveRoute, RemoveRouteByName, RemoveRouteFunc APIs documented under the new Route Management section.
  • gofiber/fiber#3285: Related to Test API semantics; docs clarifications for app.Test(req) vs empty fiber.TestConfig{} correspond to this change.

"🐰
I hopped through routes with glee,
Anatomy lit for all to see,
Handlers lined in tidy rows,
RouteChain links where middleware flows,
Docs bloom bright — hooray for me!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explicitly violates the repository's policy against documentation changes, which states 'We are no longer accepting doc files changes in the gofiber/docs repo.' Submit documentation changes to https://github.com/gofiber/fiber instead. This PR contains extensive docs/core changes that conflict with the stated policy.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: introducing a color-coded RouteAnatomy component and syncing routing documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 docs/routing-guide-restructure

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: 1

🧹 Nitpick comments (3)
docs/core/guide/grouping.md (3)

98-102: 💤 Low value

Consider clarifying the scope of "route-local" middleware terminology.

The description uses "route-specific middleware" (line 98) and the comment says "route-local middleware" (line 102), which might suggest the middleware only applies to the exact path /events. However, the note correctly clarifies that All has prefix-matched behavior and "also runs for sub-paths of the chain path."

While the note provides accurate technical details, readers might initially misunderstand the scope from the "route-local" terminology. Consider rephrasing to make the prefix-matched nature more prominent upfront, such as: "An All in the chain runs as prefix-matched middleware before the verb handlers" or updating the comment to "prefix-matched middleware for this path and sub-paths."

Also applies to: 107-109

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/core/guide/grouping.md` around lines 98 - 102, Update the phrasing
around RouteChain/All so it clearly states that All is prefix-matched middleware
rather than implying it only applies to the exact path: change the sentence "An
`All` in the chain runs before the verb handlers on that path, acting as
route-specific middleware." and the inline comment "route-local middleware" to
explicitly say something like "An `All` in the chain runs as prefix-matched
middleware before the verb handlers for the chain path and its sub-paths" (apply
same change to the repeated instance around lines 107-109); reference the
RouteChain and All examples so readers know this behavior applies to the chain
path and its sub-paths.

87-87: Fix cross-reference: ../api/app.md#route correctly targets the ### Route section

  • docs/core/api/app.md contains ### Route (line 215), providing the #route fragment target.
  • Consider rewording “route-local middleware” to avoid implying exact-path semantics (the prefix-matched behavior is clarified in the note).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/core/guide/grouping.md` at line 87, The cross-reference should point to
the `#route` fragment (keep or correct the link text `Route` to
../api/app.md#route) and the wording "route-local middleware" should be
rephrased to avoid implying exact-path semantics—replace it with something like
"middleware scoped to the group/prefix (applies to all routes under that
prefix)" so readers understand the prefix-matched behavior; update the sentence
around the `Route` link and the phrase "route-local middleware" accordingly.

98-98: Fix cross-reference: #routechain anchor is valid

docs/core/api/app.md contains the ### RouteChain heading, so the generated fragment #routechain resolves (matching how ### Use is linked as #use); no anchor update needed. Optionally tighten the wording (“route-specific”) to better align with the clarified prefix-matched behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/core/guide/grouping.md` at line 98, The cross-reference to RouteChain is
correct — leave the `#routechain` link unchanged — and instead update the
wording in docs/core/guide/grouping.md (the sentence mentioning RouteChain and
All) to clarify that an `All` runs before verb handlers as prefix-matched,
route-specific middleware; keep references to the `RouteChain` and `All` symbols
intact while tightening the phrase “route-specific middleware” to reflect the
prefix-matching behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/route-anatomy/styles.module.css`:
- Line 26: Update the border-bottom value to use lowercase CSS keywords: locate
the border-bottom declaration in styles.module.css (the line with
"border-bottom: 2px dashed currentColor;") and change the value so the keyword
casing is all lowercase (e.g., use "currentcolor") to satisfy the
value-keyword-case rule while keeping the same style and dash type.

---

Nitpick comments:
In `@docs/core/guide/grouping.md`:
- Around line 98-102: Update the phrasing around RouteChain/All so it clearly
states that All is prefix-matched middleware rather than implying it only
applies to the exact path: change the sentence "An `All` in the chain runs
before the verb handlers on that path, acting as route-specific middleware." and
the inline comment "route-local middleware" to explicitly say something like "An
`All` in the chain runs as prefix-matched middleware before the verb handlers
for the chain path and its sub-paths" (apply same change to the repeated
instance around lines 107-109); reference the RouteChain and All examples so
readers know this behavior applies to the chain path and its sub-paths.
- Line 87: The cross-reference should point to the `#route` fragment (keep or
correct the link text `Route` to ../api/app.md#route) and the wording
"route-local middleware" should be rephrased to avoid implying exact-path
semantics—replace it with something like "middleware scoped to the group/prefix
(applies to all routes under that prefix)" so readers understand the
prefix-matched behavior; update the sentence around the `Route` link and the
phrase "route-local middleware" accordingly.
- Line 98: The cross-reference to RouteChain is correct — leave the
`#routechain` link unchanged — and instead update the wording in
docs/core/guide/grouping.md (the sentence mentioning RouteChain and All) to
clarify that an `All` runs before verb handlers as prefix-matched,
route-specific middleware; keep references to the `RouteChain` and `All` symbols
intact while tightening the phrase “route-specific middleware” to reflect the
prefix-matching behavior.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a9bef5e7-cbe8-499c-be3b-25cb1eadce8a

📥 Commits

Reviewing files that changed from the base of the PR and between 8508738 and a5869e9.

📒 Files selected for processing (8)
  • docs/core/api/app.md
  • docs/core/guide/grouping.md
  • docs/core/guide/routing.md
  • docs/core/partials/routing/handler-types.md
  • docs/core/partials/routing/handler.md
  • docs/core/partials/routing/use.md
  • src/components/route-anatomy/index.tsx
  • src/components/route-anatomy/styles.module.css
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: copilot-pull-request-reviewer
  • GitHub Check: deploy (docs, gofiber/docs, docs.gofiber.io)
🧰 Additional context used
🪛 LanguageTool
docs/core/partials/routing/handler-types.md

[style] ~6-~6: Consider using a more concise synonym.
Context: ...ler types --- Fiber's adapter converts a variety of handler shapes into native `func(fiber....

(A_VARIETY_OF)

docs/core/guide/routing.md

[style] ~297-~297: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...")andc.Params("*2")for wildcards,c.Params("+1")andc.Params("+2")` for plus se...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~297-~297: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...")for wildcards,c.Params("+1")andc.Params("+2")` for plus segments. A single wild...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~463-~463: Consider shortening or rephrasing this to strengthen your wording.
Context: ...dleware Functions that are designed to make changes to the request or response are called **mi...

(MAKE_CHANGES)

🪛 markdownlint-cli2 (0.22.1)
docs/core/partials/routing/handler-types.md

[warning] 8-8: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🪛 Stylelint (17.11.1)
src/components/route-anatomy/styles.module.css

[error] 26-26: Expected "currentColor" to be "currentcolor" (value-keyword-case)

(value-keyword-case)

🔇 Additional comments (25)
src/components/route-anatomy/index.tsx (1)

1-48: LGTM!

src/components/route-anatomy/styles.module.css (1)

1-25: LGTM!

Also applies to: 27-71

docs/core/partials/routing/handler-types.md (1)

1-81: LGTM!

docs/core/partials/routing/handler.md (1)

1-40: LGTM!

docs/core/partials/routing/use.md (1)

1-47: LGTM!

docs/core/guide/routing.md (9)

1-25: LGTM!


26-51: LGTM!


52-169: LGTM!


170-196: LGTM!


197-300: LGTM!


301-460: LGTM!


461-489: LGTM!


490-542: LGTM!


543-583: LGTM!

docs/core/api/app.md (10)

6-6: LGTM!


14-24: LGTM!


28-28: LGTM!

Also applies to: 54-56


189-189: LGTM!


342-342: LGTM!


628-628: LGTM!


766-777: LGTM!


836-836: LGTM!


857-968: LGTM!


969-1004: LGTM!

docs/core/guide/grouping.md (1)

108-108: Validate the app.md#use cross-reference anchor

docs/core/api/app.md contains a ### Use section, and the file already links to it via [app.Use](#use), so ../api/app.md#use resolves correctly.

Comment thread src/components/route-anatomy/styles.module.css Outdated
ReneWerner87 and others added 2 commits May 23, 2026 00:33
- Build the example separators as explicit string expressions so `white-space:
  pre` does not pick up stray JSX whitespace.
- Add aria-label to each part for screen-reader/keyboard accessibility.
- Lint the CSS (lowercase `currentcolor`) and run prettier for consistent
  formatting.
- Sync the app.Test wording from gofiber/fiber.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirror the routing changes into versioned_docs/version-v3.x so the released v3
docs match docs/core: restructured routing guide (Anatomy, tabs, Get vs Use vs
All, Route/RouteChain), grouping additions, app.md reorg (State, Route
Management, Helpers, Test), and the new use.md / handler-types.md partials.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ReneWerner87 ReneWerner87 merged commit 7bd0eea into master May 22, 2026
8 of 9 checks passed
@ReneWerner87 ReneWerner87 deleted the docs/routing-guide-restructure branch May 22, 2026 22:52
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