Building Type-Safe APIs with Nuxt 3 and Prisma
Learn how to build end-to-end type-safe APIs using Nuxt 3 server routes and Prisma ORM for a seamless developer experience.
Practical techniques to improve LCP, FID, and CLS scores — the metrics that actually impact your search rankings and user experience.
Mbeah Essilfie
June 21, 2026 at 06:03 AM
Google uses Core Web Vitals as a ranking signal. But more importantly — they correlate directly with user experience and conversion rates.
The time until the largest visible element renders.
Common culprits:
Fixes:
<!-- Preload the LCP image -->
<link rel="preload" as="image" href="/hero.webp" />
<!-- Use modern formats with fallbacks -->
<picture>
<source srcset="/hero.avif" type="image/avif" />
<source srcset="/hero.webp" type="image/webp" />
<img src="/hero.jpg" alt="Hero" width="1200" height="600" />
</picture>
// nuxt.config.ts — inline critical CSS
export default defineNuxtConfig({
experimental: {
inlineSSRStyles: true,
},
})
Measures responsiveness to user interactions.
// ❌ Heavy computation blocks the main thread
function handleClick() {
const result = expensiveCalculation(data) // 300ms
updateUI(result)
}
// ✅ Break work into chunks
async function handleClick() {
showLoadingState()
// Yield to let the browser paint
await scheduler.yield()
const result = expensiveCalculation(data)
updateUI(result)
}
scheduler.yield() API (or setTimeout(0) as fallback) lets the browser paint between heavy JS operations, dramatically improving INP.Measures unexpected layout movements.
<!-- ✅ Always set dimensions on images -->
<img src="photo.jpg" width="800" height="600" alt="..." />
<!-- ✅ Reserve space for dynamic content -->
<div class="min-h-[300px]">
<LazyLoadedChart />
</div>
/* ✅ Prevent font swap layout shift */
@font-face {
font-family: 'Inter';
font-display: swap;
size-adjust: 107%; /* Match fallback metrics */
}
font-display: swap with size-adjust// Track real user metrics
import { onCLS, onINP, onLCP } from 'web-vitals'
onCLS(console.log)
onINP(console.log)
onLCP(console.log)
Performance isn't a one-time task — monitor continuously and optimize iteratively.
Fullstack Software Developer
Learn how to build end-to-end type-safe APIs using Nuxt 3 server routes and Prisma ORM for a seamless developer experience.
Go beyond basic utility classes and learn how to build cohesive, maintainable design systems with Tailwind CSS.
Understand the power of Vue 3's Composition API through practical, real-world composable patterns that you can use today.
