refactor(core): migrate middleware to proxy pattern#2912
Merged
matthewvolk merged 1 commit intocanaryfrom Mar 10, 2026
Merged
Conversation
|
| Name | Type |
|---|---|
| @bigcommerce/catalyst-core | Minor |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
5e839cc to
0bef87e
Compare
0bef87e to
59df1f6
Compare
59df1f6 to
7667234
Compare
jorgemoya
approved these changes
Mar 9, 2026
chanceaclark
approved these changes
Mar 9, 2026
Contributor
chanceaclark
left a comment
There was a problem hiding this comment.
LGTM. Let's check to see if we need to update any public documentation too.
Next.js 16 deprecates middleware.ts in favor of proxy.ts. This renames the entry point, export, composition utilities, and directory to align with the new convention. Also enforces Node 24 via engines field in package.json, since proxy runs on the Node.js runtime (not Edge).
7667234 to
887140c
Compare
Contributor
Bundle Size ReportComparing against baseline from No bundle size changes detected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
This PR is dependent on #2907. That PR must be merged first.DONE ✅What/Why?
Next.js 16 deprecates
middleware.tsin favor ofproxy.tsto clarify its network-boundary purpose. This PR migrates Catalyst to the new proxy pattern and enforces the Node 24 runtime requirement.middleware.ts→proxy.tsandexport const middleware→export const proxyenginesfield topackage.jsonenforcing Node.js ≥24 (proxy runs on Node.js runtime, not Edge)AGENTS.mdarchitecture docs to reflect proxy terminologyInternal middleware composition (
middlewares/directory,MiddlewareFactorytype,composeMiddlewares, allwith-*.tsfiles) is unchanged — these are implementation details, not Next.js conventions.Testing
pnpm run buildincore/and verify build completespnpm run devincore/and verify pages render/accountwhile logged out → redirects to/login)core/tests/ui/e2e/middleware/redirects.spec.tsMigration
middleware.tstoproxy.tsin the root of your Next.js appexport const middlewaretoexport const proxy