Files
supabase-vercel-tedd[bot]andalexisintech 7c9b65e21d docs(auth): say where proxy.ts goes in a Next.js project with a src folder (#54556)
## Problem

The Next.js setup in the server-side client guide doesn't say where to
put the `proxy.ts` (or `middleware.ts`) file. The Next.js user
management tutorial tells readers to put it at the project root. In a
project that uses a `src` folder, a file at the project root never runs,
sessions don't refresh, and nothing reports an error.

Related to
[FDBKIN-6704](https://linear.app/supabase/issue/FDBKIN-6704/clarify-middlewarets-file-placement-for-nextjs-ssr-in-documentation)
Closes
[DOCS-1851](https://linear.app/supabase/issue/DOCS-1851/say-where-proxyts-goes-in-a-nextjs-project-that-uses-a-src-folder)

## Solution

The "Hook up proxy" section of the Next.js tab now opens by saying where
the file goes: at the same level as the `app` or `pages` folder, which
is the project root or the `src` folder. It covers `middleware.ts` on
Next.js 15 and earlier, and warns that Next.js silently skips the file
anywhere else. It follows the wording the page already uses for the
`lib/supabase` folder and doesn't repeat the existing rename note.

The Next.js tutorial gets the same placement note in its "Next.js proxy"
step. Its "Supabase utilities" step now also says the `lib/supabase`
folder goes inside `src` in a `src` project, because the `@/` import
alias points there and the proxy import doesn't resolve otherwise.

## How to verify

1. Open
https://docs-git-tedd-docs-1851-supabase.vercel.app/docs/guides/auth/server-side/creating-a-client?queryGroups=framework&framework=nextjs#hook-up-proxy
and
https://docs-git-tedd-docs-1851-supabase.vercel.app/docs/guides/getting-started/tutorials/with-nextjs#nextjs-proxy.
2. The guide's section says to put `proxy.ts` at the same level as `app`
or `pages`: the project root, or the `./src` folder when the project
uses one.
3. The guide's section says `middleware.ts` goes in the same place on
Next.js 15 and earlier.
4. The guide's section says Next.js doesn't run the file from any other
location and shows no error.
5. The tutorial's "Next.js proxy" step says to put `proxy.ts` at the
same level as `app` (the project root or `./src`), and that Next.js
doesn't run it from any other location and shows no error.
6. The tutorial's "Supabase utilities" step says to put the
`lib/supabase` folder at the project root, or inside `./src` when the
project uses one.

## Checks

Ran `pnpm turbo run lint --filter='[origin/master]'` and `pnpm exec
oxfmt --check` on the changed files. The change is MDX prose only, so no
typecheck or tests cover it. Facts checked against the Next.js
`proxy.js`, `middleware.js`, and `src` folder references and the Next.js
build source. They were confirmed with `next build` and `next start` on
test projects with the files in and out of `src`, including
`create-next-app` scaffolds with and without `--src-dir`.

## Checklist

- [x] I have read the [Contributing
Guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] I have checked that the change works in the preview deployment

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[DOCS-1851](https://linear.app/supabase/issue/DOCS-1851/say-where-proxyts-goes-in-a-nextjs-project-that-uses-a-src-folder).
Tedd doesn't read comments on this PR.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: alexisintech <98043211+alexisintech@users.noreply.github.com>
2026-12-03 16:08:41 -07:00
..