Skip to content

docs(examples): add Next.js v16 example#1198

Merged
chimurai merged 1 commit intomasterfrom
example-nextjs-16
Apr 6, 2026
Merged

docs(examples): add Next.js v16 example#1198
chimurai merged 1 commit intomasterfrom
example-nextjs-16

Conversation

@chimurai
Copy link
Copy Markdown
Owner

@chimurai chimurai commented Apr 6, 2026

Summary by CodeRabbit

  • New Features

    • Added a Next.js example application demonstrating HTTP proxy middleware functionality with a sample API route that forwards requests to an external service.
  • Documentation

    • Added setup and usage guides for the new example application, including proxy configuration details.
  • Chores

    • Updated spell-check word list and ESLint linting configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 6, 2026

📝 Walkthrough

Walkthrough

This pull request introduces a complete Next.js example application demonstrating HTTP proxy middleware configuration, along with updates to root-level configuration files to exclude the new example from linting and spell-checking.

Changes

Cohort / File(s) Summary
Root Configuration
cspell.json, eslint.config.mjs
Updated spell-check word list with httpxy and logomark; excluded examples/next-app from ESLint's global ignore list.
Example App Configuration & Documentation
examples/next-app/.gitignore, examples/next-app/package.json, examples/next-app/tsconfig.json, examples/next-app/next.config.ts, examples/next-app/README.md, examples/next-app/PROXY.md
Added project metadata, TypeScript/Next.js configuration, dependency declarations, and documentation for the example application and proxy middleware setup.
Example App Styling
examples/next-app/app/globals.css, examples/next-app/app/page.module.css
Defined global CSS custom properties with dark mode support and component-specific styling for layout, typography, and call-to-action elements.
Example App React Components
examples/next-app/app/layout.tsx, examples/next-app/app/page.tsx
Implemented Next.js root layout with metadata and typography configuration, and a home page component with branding and navigation elements.
Example App API Routes
examples/next-app/pages/api/_proxy.ts, examples/next-app/pages/api/users.ts
Created HTTP proxy middleware module and API route handler forwarding requests to JSONPlaceholder with proper Next.js API configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A cozy next-app burrow, hopping into place,
With proxy paths and CSS grace, fonts setting the pace,
Configuration complete, from config to routes so fine,
An example for all to explore—hop along this design! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a Next.js v16 example to the examples directory, which aligns with all the file additions in the changeset.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch example-nextjs-16

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 6, 2026

npm i https://pkg.pr.new/http-proxy-middleware@1198

commit: a1564c3

@chimurai chimurai force-pushed the example-nextjs-16 branch from aa8aed6 to a1564c3 Compare April 6, 2026 22:08
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 6, 2026

Coverage Status

coverage: 93.103%. remained the same — example-nextjs-16 into master

@chimurai chimurai added this to the v4 milestone Apr 6, 2026
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

🧹 Nitpick comments (2)
examples/next-app/app/globals.css (1)

40-43: Keep a stronger default link affordance.

Line 42 removes underlines globally; this makes links harder to identify. Consider keeping underline by default (or adding an equivalent persistent non-color cue).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/next-app/app/globals.css` around lines 40 - 43, The global rule for
the anchor selector "a" removes underlines (text-decoration: none), reducing
link affordance; revert or adjust that rule so anchors retain a persistent
non-color cue—either remove the text-decoration override from the "a" selector
or change it to a persistent underline (or add a focused/visited underline
variant), or scope the no-underline rule to a utility class (e.g.,
".no-underline") so only explicitly marked links lose underlines; update the "a"
selector in globals.css accordingly and ensure any components relying on
no-underline use the utility class instead.
examples/next-app/README.md (1)

1-36: Consider adding one repo-specific pointer for the proxy example.

This reads like a stock template; a short note linking to the proxy setup doc/file would make the example easier to use in this repo context.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/next-app/README.md` around lines 1 - 36, Update the
examples/next-app README.md to include a single repo-specific pointer to the
proxy example: add a short sentence/link (e.g., "See the proxy setup for this
repo") near the "Getting Started" or just after the dev server snippet so users
know where to find the proxy configuration, and link it to the repository's
proxy setup documentation/file (the proxy setup doc referenced by this repo).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@eslint.config.mjs`:
- Line 10: The globalIgnores call currently excludes the entire
examples/next-app tree; change it to ignore only build/artifact directories
(e.g., '.next') instead of source files so linting still runs on app/layout.tsx,
app/page.tsx, next.config.ts; update the globalIgnores(['dist',
'examples/next-app']) invocation to replace 'examples/next-app' with the
appropriate artifact paths (such as 'examples/next-app/.next') so only generated
artifacts are ignored while source files remain linted.

In `@examples/next-app/pages/api/_proxy.ts`:
- Line 8: The proxy configuration is using an insecure upstream URL (the target
property) with "http://jsonplaceholder.typicode.com"; update the proxy target to
use HTTPS (e.g., "https://jsonplaceholder.typicode.com") in the proxy setup so
the proxy in pages/api/_proxy.ts forwards over TLS, and verify any related
settings that depend on protocol (such as changeOrigin or secure flags) in the
same proxy configuration.

---

Nitpick comments:
In `@examples/next-app/app/globals.css`:
- Around line 40-43: The global rule for the anchor selector "a" removes
underlines (text-decoration: none), reducing link affordance; revert or adjust
that rule so anchors retain a persistent non-color cue—either remove the
text-decoration override from the "a" selector or change it to a persistent
underline (or add a focused/visited underline variant), or scope the
no-underline rule to a utility class (e.g., ".no-underline") so only explicitly
marked links lose underlines; update the "a" selector in globals.css accordingly
and ensure any components relying on no-underline use the utility class instead.

In `@examples/next-app/README.md`:
- Around line 1-36: Update the examples/next-app README.md to include a single
repo-specific pointer to the proxy example: add a short sentence/link (e.g.,
"See the proxy setup for this repo") near the "Getting Started" or just after
the dev server snippet so users know where to find the proxy configuration, and
link it to the repository's proxy setup documentation/file (the proxy setup doc
referenced by this repo).
🪄 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: 4f19f482-db7e-483a-9b43-bbc35e951a31

📥 Commits

Reviewing files that changed from the base of the PR and between 7cf80ea and a1564c3.

⛔ Files ignored due to path filters (7)
  • examples/next-app/app/favicon.ico is excluded by !**/*.ico
  • examples/next-app/package-lock.json is excluded by !**/package-lock.json
  • examples/next-app/public/file.svg is excluded by !**/*.svg
  • examples/next-app/public/globe.svg is excluded by !**/*.svg
  • examples/next-app/public/next.svg is excluded by !**/*.svg
  • examples/next-app/public/vercel.svg is excluded by !**/*.svg
  • examples/next-app/public/window.svg is excluded by !**/*.svg
📒 Files selected for processing (14)
  • cspell.json
  • eslint.config.mjs
  • examples/next-app/.gitignore
  • examples/next-app/PROXY.md
  • examples/next-app/README.md
  • examples/next-app/app/globals.css
  • examples/next-app/app/layout.tsx
  • examples/next-app/app/page.module.css
  • examples/next-app/app/page.tsx
  • examples/next-app/next.config.ts
  • examples/next-app/package.json
  • examples/next-app/pages/api/_proxy.ts
  • examples/next-app/pages/api/users.ts
  • examples/next-app/tsconfig.json

Comment thread eslint.config.mjs
eslint.configs.recommended,
tseslint.configs.recommended,
globalIgnores(['dist']),
globalIgnores(['dist', 'examples/next-app']),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

In ESLint flat config, does globalIgnores(['examples/next-app']) recursively ignore all files under that directory (including .ts/.tsx source files)?

💡 Result:

Yes—if the pattern matches a directory, ESLint will skip traversing into it, so all files under it (including .ts/.tsx) are ignored. ESLint’s docs show directory ignores using a trailing slash (e.g. .config/) and note this means “file search will not traverse into it at all.” [1]

So prefer:

globalIgnores(["examples/next-app/"])

Note: patterns are resolved relative to eslint.config.*, and (unlike .gitignore) a pattern like examples/next-app (no **/) won’t match directories with that name elsewhere; to match anywhere, use:

globalIgnores(["**/examples/next-app/"])
``` [1]

**Sources:** [1]

---

🏁 Script executed:

```shell
# Check if examples/next-app exists and what's in it
fd --type d 'examples' -x ls -la {}

Repository: chimurai/http-proxy-middleware

Length of output: 983


🏁 Script executed:

# Examine the eslint.config.mjs file
cat -n eslint.config.mjs | head -30

Repository: chimurai/http-proxy-middleware

Length of output: 1048


🏁 Script executed:

# Look for any .gitignore or similar to understand what artifacts are typically ignored
fd -e gitignore -e eslintignore | xargs cat -n

Repository: chimurai/http-proxy-middleware

Length of output: 56


🏁 Script executed:

# Explore the next-app directory structure
find examples/next-app -maxdepth 2 -type f -o -type d | head -50

Repository: chimurai/http-proxy-middleware

Length of output: 751


🏁 Script executed:

# Check what directories typically exist in a Next.js app
ls -la examples/next-app/

Repository: chimurai/http-proxy-middleware

Length of output: 806


🏁 Script executed:

# Check what's in the next-app's .gitignore to understand what artifacts are generated
cat examples/next-app/.gitignore

Repository: chimurai/http-proxy-middleware

Length of output: 553


Ignore only generated artifacts, not the entire example source tree.

Line 10 disables linting for all examples/next-app source files. This prevents detecting regressions in actual source code like app/layout.tsx, app/page.tsx, and next.config.ts. The Next.js build directory .next/ is the primary artifact that should be excluded from linting.

Proposed adjustment
-  globalIgnores(['dist', 'examples/next-app']),
+  globalIgnores(['dist', 'examples/next-app/.next']),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
globalIgnores(['dist', 'examples/next-app']),
globalIgnores(['dist', 'examples/next-app/.next']),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@eslint.config.mjs` at line 10, The globalIgnores call currently excludes the
entire examples/next-app tree; change it to ignore only build/artifact
directories (e.g., '.next') instead of source files so linting still runs on
app/layout.tsx, app/page.tsx, next.config.ts; update the globalIgnores(['dist',
'examples/next-app']) invocation to replace 'examples/next-app' with the
appropriate artifact paths (such as 'examples/next-app/.next') so only generated
artifacts are ignored while source files remain linted.

// Singleton
// prevent a new proxy being created for every request
export const proxyMiddleware = createProxyMiddleware<NextApiRequest, NextApiResponse>({
target: 'http://jsonplaceholder.typicode.com',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Use HTTPS for the upstream target.

Line 8 currently proxies over plaintext HTTP, which weakens transport security and makes the sample unsafe to copy into real usage.

Proposed fix
-  target: 'http://jsonplaceholder.typicode.com',
+  target: 'https://jsonplaceholder.typicode.com',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
target: 'http://jsonplaceholder.typicode.com',
target: 'https://jsonplaceholder.typicode.com',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/next-app/pages/api/_proxy.ts` at line 8, The proxy configuration is
using an insecure upstream URL (the target property) with
"http://jsonplaceholder.typicode.com"; update the proxy target to use HTTPS
(e.g., "https://jsonplaceholder.typicode.com") in the proxy setup so the proxy
in pages/api/_proxy.ts forwards over TLS, and verify any related settings that
depend on protocol (such as changeOrigin or secure flags) in the same proxy
configuration.

@chimurai chimurai merged commit 42f61fb into master Apr 6, 2026
21 checks passed
@chimurai chimurai deleted the example-nextjs-16 branch April 6, 2026 22:23
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