Looking at your output, there are two performance concerns:
- Slow startup —
ready in 13979 ms (~14 seconds)
- Slow first page render —
[200] / 6070ms on the first request (the second is fast at 168ms, likely cached)
Here are the debugging approaches supported by the available documentation:
1. Enable verbose logging
Run the dev server with the --verbose flag to get more detailed output about what Astro is doing during startup and rendering:
npx astro dev --verbose
This can help pinpoint where time is being spent. [--verbose flag]
2. Use console.log() to profile slow data fetching
If you have data fetching (e.g., fetch() calls or database queries) in your page frontmatter, add console.log() with timestamps around them. Output from Astro frontmatter appears in the terminal, not the browser:
---
const start = Date.now();
const data = await fetch('...');
console.log(`Fetch took ${Date.now() - start}ms`);
---
[Debugging with console.log()]
3. Use the Dev Toolbar's Audit app
While the dev server is running, the Audit app in the Astro dev toolbar automatically checks for common performance issues on the current page and highlights problematic elements directly in the browser. [Dev toolbar]
4. Analyze your bundle size
If the slowness is related to large JavaScript bundles, use rollup-plugin-visualizer to identify heavy modules:
import { visualizer } from "rollup-plugin-visualizer";
export default defineConfig({
vite: {
plugins: [visualizer({ emitFile: true, filename: "stats.html" })]
}
});