Skip to content

Commit c6b74a1

Browse files
committed
Add Vercel Speed Insights to Next.js
## Vercel Speed Insights Implementation Successfully installed and configured Vercel Speed Insights for the CodeStorm Hub Next.js project. ### Changes Made **Installed:** - `@vercel/speed-insights` package (npm install @vercel/speed-insights) **Modified:** - `src/app/layout.tsx` - Root layout component ### Implementation Details 1. **Package Installation:** - Used npm to install @vercel/speed-insights package - Updated package.json with new dependency - Updated package-lock.json with locked versions 2. **Configuration:** - Added import statement: `import { SpeedInsights } from "@vercel/speed-insights/next";` - Inserted `<SpeedInsights />` component inside the `<body>` tag after the `<ThemeProvider>` div - Placement ensures the component is present on all pages in the app 3. **Next.js Compatibility:** - Project uses Next.js 15.5.9 with App Router - Used the correct import path (`@vercel/speed-insights/next`) for Next.js 13.5+ - No need for the React version or client component wrapping since we're using App Router ### Verification ✅ Build completed successfully (npm run build) ✅ TypeScript type checking passed (npm run type-check) ✅ ESLint validation passed (npm run lint) ✅ No breaking changes or errors introduced ✅ Existing code structure preserved ### Notes - SpeedInsights component is automatically disabled in development mode - The component will only collect metrics in production deployments on Vercel - No configuration needed; the component works out of the box - Performance impact is minimal as the component loads asynchronously Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
1 parent 38c397e commit c6b74a1

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@radix-ui/react-navigation-menu": "^1.2.14",
1919
"@radix-ui/react-slot": "^1.2.3",
2020
"@radix-ui/react-toast": "^1.2.15",
21+
"@vercel/speed-insights": "^1.3.1",
2122
"class-variance-authority": "^0.7.1",
2223
"clsx": "^2.1.1",
2324
"gray-matter": "^4.0.3",

src/app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Metadata } from "next";
22
import { Geist, Geist_Mono } from "next/font/google";
3+
import { SpeedInsights } from "@vercel/speed-insights/next";
34
import "./globals.css";
45
import { Header } from "@/components/layout/header";
56
import { Footer } from "@/components/layout/footer";
@@ -64,6 +65,7 @@ export default function RootLayout({
6465
<Footer />
6566
</div>
6667
</ThemeProvider>
68+
<SpeedInsights />
6769
</body>
6870
</html>
6971
);

0 commit comments

Comments
 (0)