-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.ts
More file actions
169 lines (160 loc) · 5.69 KB
/
Copy pathnext.config.ts
File metadata and controls
169 lines (160 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import type { NextConfig } from "next";
import bundleAnalyzer from "@next/bundle-analyzer";
import { withSentryConfig } from "@sentry/nextjs";
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
const nextConfig: NextConfig = {
async redirects() {
return [
{
source: '/bcz-yapz',
destination: 'https://bczyapz.com',
permanent: true,
},
{
source: '/bcz-yapz/:path*',
destination: 'https://bczyapz.com/:path*',
permanent: true,
},
// ZABAL hub re-homed to zabal.art (research Doc 708). Keep old
// shared links working - 301 to the canonical surface.
{
source: '/zabal',
destination: 'https://zabal.art',
permanent: true,
},
{
source: '/zabal/:path*',
destination: 'https://zabal.art/:path*',
permanent: true,
},
]
},
serverExternalPackages: [
'@xmtp/wasm-bindings',
'twitter-api-v2',
'jsonwebtoken',
'@gradio/client',
'livepeer',
'@ardrive/turbo-sdk',
'@hiveio/dhive',
'@discordjs/rest',
'web-push',
'@vectorize-io/hindsight-client',
],
experimental: {
// Cache client-side navigations — instant page transitions on repeat visits
staleTimes: {
dynamic: 30, // Cache dynamic pages for 30 seconds
static: 180, // Cache static pages for 3 minutes
},
// Tree-shake barrel exports from heavy libraries
optimizePackageImports: [
'@tanstack/react-query',
'@tanstack/react-virtual',
'@rainbow-me/rainbowkit',
'@farcaster/auth-kit',
'@farcaster/auth-client',
'@neynar/react',
'@hatsprotocol/sdk-v1-core',
'@atproto/api',
'wagmi',
'viem',
'viem/chains',
'viem/accounts',
'@supabase/supabase-js',
'@solana/wallet-adapter-react',
'@solana/wallet-adapter-wallets',
'@solana/web3.js',
'@xmtp/browser-sdk',
'@stream-io/video-react-sdk',
'@dnd-kit/core',
'@dnd-kit/sortable',
'@dnd-kit/utilities',
'cmdk',
'@tiptap/react',
'@tiptap/starter-kit',
],
},
images: {
// Serve AVIF first, WebP second; falls back to original for unsupported clients.
formats: ['image/avif', 'image/webp'],
// Farcaster PFPs + music artwork — allow known CDN hostnames only (SSRF mitigation).
// User-controlled PFP images use the `unoptimized` prop on <Image> to bypass the proxy.
remotePatterns: [
// Warpcast / Farcaster CDNs
{ protocol: 'https', hostname: 'imagedelivery.net' },
{ protocol: 'https', hostname: 'wrpcd.net' },
{ protocol: 'https', hostname: 'i.imgur.com' },
{ protocol: 'https', hostname: 'res.cloudinary.com' },
// Google / social profile pictures
{ protocol: 'https', hostname: 'lh3.googleusercontent.com' },
{ protocol: 'https', hostname: 'pbs.twimg.com' },
{ protocol: 'https', hostname: 'avatars.githubusercontent.com' },
// Decentralized storage
{ protocol: 'https', hostname: '*.ipfs.dweb.link' },
{ protocol: 'https', hostname: 'ipfs.io' },
{ protocol: 'https', hostname: 'ipfs.decentralized-content.com' },
{ protocol: 'https', hostname: 'arweave.net' },
{ protocol: 'https', hostname: 'nfts.imgix.net' },
// ENS / NFT avatars
{ protocol: 'https', hostname: 'cdn.stamp.fyi' },
{ protocol: 'https', hostname: 'openseauserdata.com' },
// Music service artwork
{ protocol: 'https', hostname: 'i.scdn.co' },
{ protocol: 'https', hostname: 'i1.sndcdn.com' },
{ protocol: 'https', hostname: 'is1-ssl.mzstatic.com' },
// Audius CDN nodes (artwork served from various content nodes)
{ protocol: 'https', hostname: '**.audius.co' },
{ protocol: 'https', hostname: '**.theblueprint.xyz' },
{ protocol: 'https', hostname: '**.figment.io' },
// YouTube thumbnails
{ protocol: 'https', hostname: 'img.youtube.com' },
{ protocol: 'https', hostname: 'i.ytimg.com' },
],
},
// Security headers (non-CSP) — CSP is set dynamically in middleware with per-request nonces
// XMTP COEP/COOP is also set in middleware for /messages routes
async headers() {
const securityHeaders = [
{ key: 'X-Content-Type-Options', value: 'nosniff' },
// X-Frame-Options intentionally omitted. The Farcaster miniapp is
// embedded in client iframes (Warpcast, Base App, third-party readers).
// Frame embedding policy is controlled via CSP `frame-ancestors *`
// set in src/middleware.ts.
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
{ key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },
{ key: 'Strict-Transport-Security', value: 'max-age=63072000; includeSubDomains; preload' },
];
return [
{
source: '/(.*)',
headers: securityHeaders,
},
// Long-lived static assets in /public — Lighthouse "efficient cache lifetimes".
// 30d fresh + 7d SWR. Bust by renaming the file (no fingerprinting on /public).
{
source: '/:path*\\.(png|jpg|jpeg|webp|avif|gif|svg|ico|woff2|woff|ttf|otf)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=2592000, stale-while-revalidate=604800',
},
],
},
];
},
// Turbopack config (Next.js 16 default bundler)
turbopack: {},
};
export default withSentryConfig(withBundleAnalyzer(nextConfig), {
// Upload source maps for readable stack traces in Sentry
sourcemaps: {
deleteSourcemapsAfterUpload: true,
},
// Suppress Sentry CLI logs during build
silent: !process.env.CI,
// Disable Sentry telemetry
telemetry: false,
});