- DB client: configure connection pool (max=20, idle_timeout=30s, connect_timeout=5s) - DB schema: add missing indexes for auth sessions, accounts, conversations, agent_logs - DB schema: promote preferences(user_id,key) to UNIQUE index for ON CONFLICT upsert - Drizzle migration: 0003_p8003_perf_indexes.sql - preferences.service: replace 2-query SELECT+INSERT/UPDATE with single-round-trip upsert - conversations repo: add ORDER BY + LIMIT to findAll (200) and findMessages (500) - session-gc.service: make onModuleInit fire-and-forget (removes cold-start TTFB block) - next.config.ts: enable compress, productionBrowserSourceMaps:false, image avif/webp - docs/PERFORMANCE.md: full profiling report and change impact notes
33 lines
859 B
TypeScript
33 lines
859 B
TypeScript
import type { NextConfig } from 'next';
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: 'standalone',
|
|
transpilePackages: ['@mosaic/design-tokens'],
|
|
|
|
// Enable gzip/brotli compression for all responses.
|
|
compress: true,
|
|
|
|
// Reduce bundle size: disable source maps in production builds.
|
|
productionBrowserSourceMaps: false,
|
|
|
|
// Image optimisation: allow the gateway origin as an external image source.
|
|
images: {
|
|
formats: ['image/avif', 'image/webp'],
|
|
remotePatterns: [
|
|
{
|
|
protocol: 'https',
|
|
hostname: '**',
|
|
},
|
|
],
|
|
},
|
|
|
|
// Experimental: enable React compiler for automatic memoisation (Next 15+).
|
|
// Falls back gracefully if the compiler plugin is not installed.
|
|
experimental: {
|
|
// Turbopack is the default in dev for Next 15; keep it opt-in for now.
|
|
// turbo: {},
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|