mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
Upgrade to nextjs16 (#557)
Signed-off-by: Karan <karanlokchandani@protonmail.com>
This commit is contained in:
parent
7321f7feaa
commit
371a848ddf
5 changed files with 199 additions and 758 deletions
|
|
@ -36,9 +36,9 @@ Before you begin, ensure you have the following installed:
|
|||
# You'll need to add your API keys and database URLs
|
||||
```
|
||||
|
||||
4. **Change middleware for local development**
|
||||
4. **Change proxy for local development**
|
||||
|
||||
Add this in your `middleware.ts`(apps/web) before retrieving the cookie (`getSessionCookie(request)`):
|
||||
Add this in your `proxy.ts`(apps/web) before retrieving the cookie (`getSessionCookie(request)`):
|
||||
|
||||
```ts
|
||||
if (url.hostname === "localhost") {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ import type { NextConfig } from "next"
|
|||
const nextConfig: NextConfig = {
|
||||
experimental: {
|
||||
viewTransition: true,
|
||||
},
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true,
|
||||
turbopackFileSystemCacheForDev: true,
|
||||
},
|
||||
poweredByHeader: false,
|
||||
async rewrites() {
|
||||
|
|
@ -43,7 +41,7 @@ export default withSentryConfig(nextConfig, {
|
|||
|
||||
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
|
||||
// This can increase your server load as well as your hosting bill.
|
||||
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
|
||||
// Note: Check that the configured route will not match with your Next.js middleware(proxy), otherwise reporting of client-
|
||||
// side errors will fail.
|
||||
tunnelRoute: "/monitoring",
|
||||
|
||||
|
|
|
|||
|
|
@ -1,98 +1,102 @@
|
|||
{
|
||||
"name": "@repo/web",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbo",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview",
|
||||
"deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy",
|
||||
"upload": "opennextjs-cloudflare build && opennextjs-cloudflare upload",
|
||||
"cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
|
||||
"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",
|
||||
"postdeploy": "bun run sentry:sourcemaps"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/google": "^2.0.0-beta.13",
|
||||
"@ai-sdk/react": "2.0.0-beta.24",
|
||||
"@better-fetch/fetch": "^1.1.18",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@opennextjs/cloudflare": "^1.6.1",
|
||||
"@radix-ui/react-accordion": "^1.2.11",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.14",
|
||||
"@radix-ui/react-avatar": "^1.1.10",
|
||||
"@radix-ui/react-checkbox": "^1.3.2",
|
||||
"@radix-ui/react-dialog": "^1.1.14",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
||||
"@radix-ui/react-label": "^2.1.7",
|
||||
"@radix-ui/react-progress": "^1.1.7",
|
||||
"@radix-ui/react-select": "^2.2.5",
|
||||
"@radix-ui/react-separator": "^1.1.7",
|
||||
"@radix-ui/react-slot": "^1.2.3",
|
||||
"@radix-ui/react-tabs": "^1.1.12",
|
||||
"@radix-ui/react-toggle": "^1.1.9",
|
||||
"@radix-ui/react-toggle-group": "^1.1.10",
|
||||
"@radix-ui/react-tooltip": "^1.2.7",
|
||||
"@react-router/fs-routes": "^7.6.2",
|
||||
"@react-router/node": "^7.6.2",
|
||||
"@react-router/serve": "^7.6.2",
|
||||
"@sentry/nextjs": "^10",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@tanstack/react-form": "^1.12.4",
|
||||
"@tanstack/react-query": "^5.81.2",
|
||||
"@tanstack/react-query-devtools": "^5.84.2",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"@tanstack/react-virtual": "^3.13.12",
|
||||
"@types/dompurify": "^3.2.0",
|
||||
"ai": "5.0.0-beta.24",
|
||||
"autumn-js": "0.0.116",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"date-fns": "^4.1.0",
|
||||
"dompurify": "^3.2.7",
|
||||
"dotenv": "^16.6.0",
|
||||
"embla-carousel-autoplay": "^8.6.0",
|
||||
"embla-carousel-react": "^8.6.0",
|
||||
"framer-motion": "^12.23.12",
|
||||
"is-hotkey": "^0.2.0",
|
||||
"lucide-react": "^0.525.0",
|
||||
"masonic": "^4.1.0",
|
||||
"motion": "^12.19.2",
|
||||
"next": "15.3.0",
|
||||
"next-themes": "^0.4.6",
|
||||
"nuqs": "^2.5.2",
|
||||
"posthog-js": "^1.257.0",
|
||||
"random-word-slugs": "^0.1.7",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-dropzone": "^14.3.8",
|
||||
"react-tweet": "^3.2.2",
|
||||
"recharts": "2",
|
||||
"shadcn-dropzone": "^0.2.1",
|
||||
"slate": "^0.118.0",
|
||||
"slate-react": "^0.117.4",
|
||||
"sonner": "^2.0.5",
|
||||
"streamdown": "^1.1.6",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tw-animate-css": "^1.3.4",
|
||||
"vaul": "^1.1.2",
|
||||
"zustand": "^5.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sentry/cli": "^2.52.0",
|
||||
"@tailwindcss/postcss": "^4.1.11",
|
||||
"@total-typescript/tsconfig": "^1.0.4",
|
||||
"@types/is-hotkey": "^0.1.10",
|
||||
"@types/node": "^24.0.4",
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.6",
|
||||
"tailwindcss": "^4.1.11",
|
||||
"typescript": "^5.8.3",
|
||||
"wrangler": "^4.26.0"
|
||||
}
|
||||
"name": "@repo/web",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "biome check --write",
|
||||
"preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview",
|
||||
"deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy",
|
||||
"upload": "opennextjs-cloudflare build && opennextjs-cloudflare upload",
|
||||
"cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
|
||||
"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",
|
||||
"postdeploy": "bun run sentry:sourcemaps"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/google": "^2.0.0-beta.13",
|
||||
"@ai-sdk/react": "2.0.0-beta.24",
|
||||
"@better-fetch/fetch": "^1.1.18",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@opennextjs/cloudflare": "^1.6.1",
|
||||
"@radix-ui/react-accordion": "^1.2.11",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.14",
|
||||
"@radix-ui/react-avatar": "^1.1.10",
|
||||
"@radix-ui/react-checkbox": "^1.3.2",
|
||||
"@radix-ui/react-dialog": "^1.1.14",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
||||
"@radix-ui/react-label": "^2.1.7",
|
||||
"@radix-ui/react-progress": "^1.1.7",
|
||||
"@radix-ui/react-select": "^2.2.5",
|
||||
"@radix-ui/react-separator": "^1.1.7",
|
||||
"@radix-ui/react-slot": "^1.2.3",
|
||||
"@radix-ui/react-tabs": "^1.1.12",
|
||||
"@radix-ui/react-toggle": "^1.1.9",
|
||||
"@radix-ui/react-toggle-group": "^1.1.10",
|
||||
"@radix-ui/react-tooltip": "^1.2.7",
|
||||
"@react-router/fs-routes": "^7.6.2",
|
||||
"@react-router/node": "^7.6.2",
|
||||
"@react-router/serve": "^7.6.2",
|
||||
"@sentry/nextjs": "^10.22.0",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@tanstack/react-form": "^1.12.4",
|
||||
"@tanstack/react-query": "^5.81.2",
|
||||
"@tanstack/react-query-devtools": "^5.84.2",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"@tanstack/react-virtual": "^3.13.12",
|
||||
"@types/dompurify": "^3.2.0",
|
||||
"ai": "5.0.0-beta.24",
|
||||
"autumn-js": "0.0.116",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"date-fns": "^4.1.0",
|
||||
"dompurify": "^3.2.7",
|
||||
"dotenv": "^16.6.0",
|
||||
"embla-carousel-autoplay": "^8.6.0",
|
||||
"embla-carousel-react": "^8.6.0",
|
||||
"framer-motion": "^12.23.12",
|
||||
"is-hotkey": "^0.2.0",
|
||||
"lucide-react": "^0.525.0",
|
||||
"masonic": "^4.1.0",
|
||||
"motion": "^12.19.2",
|
||||
"next": "16.0.1",
|
||||
"next-themes": "^0.4.6",
|
||||
"nuqs": "^2.5.2",
|
||||
"posthog-js": "^1.257.0",
|
||||
"random-word-slugs": "^0.1.7",
|
||||
"react": "19.2.0",
|
||||
"react-dom": "19.2.0",
|
||||
"react-dropzone": "^14.3.8",
|
||||
"react-tweet": "^3.2.2",
|
||||
"recharts": "2",
|
||||
"slate": "^0.118.0",
|
||||
"slate-react": "^0.117.4",
|
||||
"sonner": "^2.0.5",
|
||||
"streamdown": "^1.1.6",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tw-animate-css": "^1.3.4",
|
||||
"vaul": "^1.1.2",
|
||||
"zustand": "^5.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.2.2",
|
||||
"@sentry/cli": "^2.52.0",
|
||||
"@tailwindcss/postcss": "^4.1.11",
|
||||
"@total-typescript/tsconfig": "^1.0.4",
|
||||
"@types/is-hotkey": "^0.1.10",
|
||||
"@types/node": "^24.0.4",
|
||||
"@types/react": "19.2.2",
|
||||
"@types/react-dom": "19.2.2",
|
||||
"tailwindcss": "^4.1.11",
|
||||
"typescript": "^5.8.3",
|
||||
"wrangler": "^4.26.0"
|
||||
},
|
||||
"overrides": {
|
||||
"@types/react": "19.2.2",
|
||||
"@types/react-dom": "19.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
import { getSessionCookie } from "better-auth/cookies"
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
export default async function middleware(request: Request) {
|
||||
console.debug("[MIDDLEWARE] === MIDDLEWARE START ===")
|
||||
export default async function proxy(request: Request) {
|
||||
console.debug("[PROXY] === PROXY START ===")
|
||||
const url = new URL(request.url)
|
||||
console.debug("[MIDDLEWARE] Path:", url.pathname)
|
||||
console.debug("[MIDDLEWARE] Method:", request.method)
|
||||
console.debug("[PROXY] Path:", url.pathname)
|
||||
console.debug("[PROXY] Method:", request.method)
|
||||
|
||||
const sessionCookie = getSessionCookie(request)
|
||||
console.debug("[MIDDLEWARE] Session cookie exists:", !!sessionCookie)
|
||||
console.debug("[PROXY] Session cookie exists:", !!sessionCookie)
|
||||
|
||||
// Always allow access to login and waitlist pages
|
||||
const publicPaths = ["/login"]
|
||||
if (publicPaths.includes(url.pathname)) {
|
||||
console.debug("[MIDDLEWARE] Public path, allowing access")
|
||||
console.debug("[PROXY] Public path, allowing access")
|
||||
return NextResponse.next()
|
||||
}
|
||||
|
||||
// If no session cookie and not on a public path, redirect to login
|
||||
if (!sessionCookie) {
|
||||
console.debug(
|
||||
"[MIDDLEWARE] No session cookie and not on public path, redirecting to /login",
|
||||
"[PROXY] No session cookie and not on public path, redirecting to /login",
|
||||
)
|
||||
const url = new URL("/login", request.url)
|
||||
url.searchParams.set("redirect", request.url)
|
||||
|
|
@ -34,14 +34,14 @@ export default async function middleware(request: Request) {
|
|||
// Authorization: `Bearer ${sessionCookie}`,
|
||||
// },
|
||||
// });
|
||||
// console.debug("[MIDDLEWARE] Waitlist status:", response.data);
|
||||
// console.debug("[PROXY] Waitlist status:", response.data);
|
||||
// if (response.data && !response.data.accessGranted) {
|
||||
// return NextResponse.redirect(new URL("/waitlist", request.url));
|
||||
// }
|
||||
// }
|
||||
|
||||
console.debug("[MIDDLEWARE] Passing through to next handler")
|
||||
console.debug("[MIDDLEWARE] === MIDDLEWARE END ===")
|
||||
console.debug("[PROXY] Passing through to next handler")
|
||||
console.debug("[PROXY] === PROXY END ===")
|
||||
const response = NextResponse.next()
|
||||
response.cookies.set({
|
||||
name: "last-site-visited",
|
||||
Loading…
Add table
Reference in a new issue