Skip to content

Commit 371a848

Browse files
Upgrade to nextjs16 (supermemoryai#557)
Signed-off-by: Karan <karanlokchandani@protonmail.com>
1 parent 7321f7f commit 371a848

5 files changed

Lines changed: 192 additions & 751 deletions

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ Before you begin, ensure you have the following installed:
3636
# You'll need to add your API keys and database URLs
3737
```
3838

39-
4. **Change middleware for local development**
39+
4. **Change proxy for local development**
4040

41-
Add this in your `middleware.ts`(apps/web) before retrieving the cookie (`getSessionCookie(request)`):
41+
Add this in your `proxy.ts`(apps/web) before retrieving the cookie (`getSessionCookie(request)`):
4242

4343
```ts
4444
if (url.hostname === "localhost") {

apps/web/next.config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import type { NextConfig } from "next"
44
const nextConfig: NextConfig = {
55
experimental: {
66
viewTransition: true,
7-
},
8-
eslint: {
9-
ignoreDuringBuilds: true,
7+
turbopackFileSystemCacheForDev: true,
108
},
119
poweredByHeader: false,
1210
async rewrites() {
@@ -43,7 +41,7 @@ export default withSentryConfig(nextConfig, {
4341

4442
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
4543
// This can increase your server load as well as your hosting bill.
46-
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
44+
// Note: Check that the configured route will not match with your Next.js middleware(proxy), otherwise reporting of client-
4745
// side errors will fail.
4846
tunnelRoute: "/monitoring",
4947

apps/web/package.json

Lines changed: 100 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,102 @@
11
{
2-
"name": "@repo/web",
3-
"version": "0.1.0",
4-
"private": true,
5-
"scripts": {
6-
"dev": "next dev --turbo",
7-
"build": "next build",
8-
"start": "next start",
9-
"lint": "next lint",
10-
"preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview",
11-
"deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy",
12-
"upload": "opennextjs-cloudflare build && opennextjs-cloudflare upload",
13-
"cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
14-
"sentry:sourcemaps": "_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=supermemory --project=consumer-app && sentry-cli sourcemaps upload --org=supermemory --project=consumer-app --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist",
15-
"postdeploy": "bun run sentry:sourcemaps"
16-
},
17-
"dependencies": {
18-
"@ai-sdk/google": "^2.0.0-beta.13",
19-
"@ai-sdk/react": "2.0.0-beta.24",
20-
"@better-fetch/fetch": "^1.1.18",
21-
"@dnd-kit/core": "^6.3.1",
22-
"@dnd-kit/modifiers": "^9.0.0",
23-
"@dnd-kit/sortable": "^10.0.0",
24-
"@dnd-kit/utilities": "^3.2.2",
25-
"@opennextjs/cloudflare": "^1.6.1",
26-
"@radix-ui/react-accordion": "^1.2.11",
27-
"@radix-ui/react-alert-dialog": "^1.1.14",
28-
"@radix-ui/react-avatar": "^1.1.10",
29-
"@radix-ui/react-checkbox": "^1.3.2",
30-
"@radix-ui/react-dialog": "^1.1.14",
31-
"@radix-ui/react-dropdown-menu": "^2.1.15",
32-
"@radix-ui/react-label": "^2.1.7",
33-
"@radix-ui/react-progress": "^1.1.7",
34-
"@radix-ui/react-select": "^2.2.5",
35-
"@radix-ui/react-separator": "^1.1.7",
36-
"@radix-ui/react-slot": "^1.2.3",
37-
"@radix-ui/react-tabs": "^1.1.12",
38-
"@radix-ui/react-toggle": "^1.1.9",
39-
"@radix-ui/react-toggle-group": "^1.1.10",
40-
"@radix-ui/react-tooltip": "^1.2.7",
41-
"@react-router/fs-routes": "^7.6.2",
42-
"@react-router/node": "^7.6.2",
43-
"@react-router/serve": "^7.6.2",
44-
"@sentry/nextjs": "^10",
45-
"@tailwindcss/typography": "^0.5.16",
46-
"@tanstack/react-form": "^1.12.4",
47-
"@tanstack/react-query": "^5.81.2",
48-
"@tanstack/react-query-devtools": "^5.84.2",
49-
"@tanstack/react-table": "^8.21.3",
50-
"@tanstack/react-virtual": "^3.13.12",
51-
"@types/dompurify": "^3.2.0",
52-
"ai": "5.0.0-beta.24",
53-
"autumn-js": "0.0.116",
54-
"class-variance-authority": "^0.7.1",
55-
"clsx": "^2.1.1",
56-
"date-fns": "^4.1.0",
57-
"dompurify": "^3.2.7",
58-
"dotenv": "^16.6.0",
59-
"embla-carousel-autoplay": "^8.6.0",
60-
"embla-carousel-react": "^8.6.0",
61-
"framer-motion": "^12.23.12",
62-
"is-hotkey": "^0.2.0",
63-
"lucide-react": "^0.525.0",
64-
"masonic": "^4.1.0",
65-
"motion": "^12.19.2",
66-
"next": "15.3.0",
67-
"next-themes": "^0.4.6",
68-
"nuqs": "^2.5.2",
69-
"posthog-js": "^1.257.0",
70-
"random-word-slugs": "^0.1.7",
71-
"react": "^19.1.0",
72-
"react-dom": "^19.1.0",
73-
"react-dropzone": "^14.3.8",
74-
"react-tweet": "^3.2.2",
75-
"recharts": "2",
76-
"shadcn-dropzone": "^0.2.1",
77-
"slate": "^0.118.0",
78-
"slate-react": "^0.117.4",
79-
"sonner": "^2.0.5",
80-
"streamdown": "^1.1.6",
81-
"tailwind-merge": "^3.3.1",
82-
"tw-animate-css": "^1.3.4",
83-
"vaul": "^1.1.2",
84-
"zustand": "^5.0.7"
85-
},
86-
"devDependencies": {
87-
"@sentry/cli": "^2.52.0",
88-
"@tailwindcss/postcss": "^4.1.11",
89-
"@total-typescript/tsconfig": "^1.0.4",
90-
"@types/is-hotkey": "^0.1.10",
91-
"@types/node": "^24.0.4",
92-
"@types/react": "^19.1.8",
93-
"@types/react-dom": "^19.1.6",
94-
"tailwindcss": "^4.1.11",
95-
"typescript": "^5.8.3",
96-
"wrangler": "^4.26.0"
97-
}
2+
"name": "@repo/web",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "biome check --write",
10+
"preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview",
11+
"deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy",
12+
"upload": "opennextjs-cloudflare build && opennextjs-cloudflare upload",
13+
"cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
14+
"sentry:sourcemaps": "_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=supermemory --project=consumer-app && sentry-cli sourcemaps upload --org=supermemory --project=consumer-app --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist",
15+
"postdeploy": "bun run sentry:sourcemaps"
16+
},
17+
"dependencies": {
18+
"@ai-sdk/google": "^2.0.0-beta.13",
19+
"@ai-sdk/react": "2.0.0-beta.24",
20+
"@better-fetch/fetch": "^1.1.18",
21+
"@dnd-kit/core": "^6.3.1",
22+
"@dnd-kit/modifiers": "^9.0.0",
23+
"@dnd-kit/sortable": "^10.0.0",
24+
"@dnd-kit/utilities": "^3.2.2",
25+
"@opennextjs/cloudflare": "^1.6.1",
26+
"@radix-ui/react-accordion": "^1.2.11",
27+
"@radix-ui/react-alert-dialog": "^1.1.14",
28+
"@radix-ui/react-avatar": "^1.1.10",
29+
"@radix-ui/react-checkbox": "^1.3.2",
30+
"@radix-ui/react-dialog": "^1.1.14",
31+
"@radix-ui/react-dropdown-menu": "^2.1.15",
32+
"@radix-ui/react-label": "^2.1.7",
33+
"@radix-ui/react-progress": "^1.1.7",
34+
"@radix-ui/react-select": "^2.2.5",
35+
"@radix-ui/react-separator": "^1.1.7",
36+
"@radix-ui/react-slot": "^1.2.3",
37+
"@radix-ui/react-tabs": "^1.1.12",
38+
"@radix-ui/react-toggle": "^1.1.9",
39+
"@radix-ui/react-toggle-group": "^1.1.10",
40+
"@radix-ui/react-tooltip": "^1.2.7",
41+
"@react-router/fs-routes": "^7.6.2",
42+
"@react-router/node": "^7.6.2",
43+
"@react-router/serve": "^7.6.2",
44+
"@sentry/nextjs": "^10.22.0",
45+
"@tailwindcss/typography": "^0.5.16",
46+
"@tanstack/react-form": "^1.12.4",
47+
"@tanstack/react-query": "^5.81.2",
48+
"@tanstack/react-query-devtools": "^5.84.2",
49+
"@tanstack/react-table": "^8.21.3",
50+
"@tanstack/react-virtual": "^3.13.12",
51+
"@types/dompurify": "^3.2.0",
52+
"ai": "5.0.0-beta.24",
53+
"autumn-js": "0.0.116",
54+
"class-variance-authority": "^0.7.1",
55+
"clsx": "^2.1.1",
56+
"date-fns": "^4.1.0",
57+
"dompurify": "^3.2.7",
58+
"dotenv": "^16.6.0",
59+
"embla-carousel-autoplay": "^8.6.0",
60+
"embla-carousel-react": "^8.6.0",
61+
"framer-motion": "^12.23.12",
62+
"is-hotkey": "^0.2.0",
63+
"lucide-react": "^0.525.0",
64+
"masonic": "^4.1.0",
65+
"motion": "^12.19.2",
66+
"next": "16.0.1",
67+
"next-themes": "^0.4.6",
68+
"nuqs": "^2.5.2",
69+
"posthog-js": "^1.257.0",
70+
"random-word-slugs": "^0.1.7",
71+
"react": "19.2.0",
72+
"react-dom": "19.2.0",
73+
"react-dropzone": "^14.3.8",
74+
"react-tweet": "^3.2.2",
75+
"recharts": "2",
76+
"slate": "^0.118.0",
77+
"slate-react": "^0.117.4",
78+
"sonner": "^2.0.5",
79+
"streamdown": "^1.1.6",
80+
"tailwind-merge": "^3.3.1",
81+
"tw-animate-css": "^1.3.4",
82+
"vaul": "^1.1.2",
83+
"zustand": "^5.0.7"
84+
},
85+
"devDependencies": {
86+
"@biomejs/biome": "^2.2.2",
87+
"@sentry/cli": "^2.52.0",
88+
"@tailwindcss/postcss": "^4.1.11",
89+
"@total-typescript/tsconfig": "^1.0.4",
90+
"@types/is-hotkey": "^0.1.10",
91+
"@types/node": "^24.0.4",
92+
"@types/react": "19.2.2",
93+
"@types/react-dom": "19.2.2",
94+
"tailwindcss": "^4.1.11",
95+
"typescript": "^5.8.3",
96+
"wrangler": "^4.26.0"
97+
},
98+
"overrides": {
99+
"@types/react": "19.2.2",
100+
"@types/react-dom": "19.2.2"
101+
}
98102
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import { getSessionCookie } from "better-auth/cookies"
22
import { NextResponse } from "next/server"
33

4-
export default async function middleware(request: Request) {
5-
console.debug("[MIDDLEWARE] === MIDDLEWARE START ===")
4+
export default async function proxy(request: Request) {
5+
console.debug("[PROXY] === PROXY START ===")
66
const url = new URL(request.url)
7-
console.debug("[MIDDLEWARE] Path:", url.pathname)
8-
console.debug("[MIDDLEWARE] Method:", request.method)
7+
console.debug("[PROXY] Path:", url.pathname)
8+
console.debug("[PROXY] Method:", request.method)
99

1010
const sessionCookie = getSessionCookie(request)
11-
console.debug("[MIDDLEWARE] Session cookie exists:", !!sessionCookie)
11+
console.debug("[PROXY] Session cookie exists:", !!sessionCookie)
1212

1313
// Always allow access to login and waitlist pages
1414
const publicPaths = ["/login"]
1515
if (publicPaths.includes(url.pathname)) {
16-
console.debug("[MIDDLEWARE] Public path, allowing access")
16+
console.debug("[PROXY] Public path, allowing access")
1717
return NextResponse.next()
1818
}
1919

2020
// If no session cookie and not on a public path, redirect to login
2121
if (!sessionCookie) {
2222
console.debug(
23-
"[MIDDLEWARE] No session cookie and not on public path, redirecting to /login",
23+
"[PROXY] No session cookie and not on public path, redirecting to /login",
2424
)
2525
const url = new URL("/login", request.url)
2626
url.searchParams.set("redirect", request.url)
@@ -34,14 +34,14 @@ export default async function middleware(request: Request) {
3434
// Authorization: `Bearer ${sessionCookie}`,
3535
// },
3636
// });
37-
// console.debug("[MIDDLEWARE] Waitlist status:", response.data);
37+
// console.debug("[PROXY] Waitlist status:", response.data);
3838
// if (response.data && !response.data.accessGranted) {
3939
// return NextResponse.redirect(new URL("/waitlist", request.url));
4040
// }
4141
// }
4242

43-
console.debug("[MIDDLEWARE] Passing through to next handler")
44-
console.debug("[MIDDLEWARE] === MIDDLEWARE END ===")
43+
console.debug("[PROXY] Passing through to next handler")
44+
console.debug("[PROXY] === PROXY END ===")
4545
const response = NextResponse.next()
4646
response.cookies.set({
4747
name: "last-site-visited",

0 commit comments

Comments
 (0)