Files
nlcc-itinerary/nuxt.config.ts
Joshua Ryder 287284c2fe perf: Comprehensive efficiency optimizations
Implemented all 5 critical efficiency improvements to optimize
performance, reduce resource usage, and improve scalability.

## 1. Database Indexes
- Added indexes on sermon_notes foreign keys (user_id, sermon_id)
- Added composite index on sermons (archived, date DESC)
- Added indexes on frequently queried columns across all tables
- Impact: Faster queries as data grows, better JOIN performance

## 2. Eliminated N+1 Query Pattern
- Reduced 2 API calls to 1 on home page load
- Changed from separate active/archived fetches to single call
- Filter archived sermons client-side using computed properties
- Impact: 50% reduction in HTTP requests per page load

## 3. Scheduled Database Cleanup
- Extended existing plugin to clean expired sessions hourly
- Added cleanup for expired rate limits every hour
- Added cleanup for expired password reset codes every hour
- Sermon cleanup continues to run daily based on retention policy
- Impact: Prevents database table growth, better performance

## 4. Multi-stage Docker Build
- Implemented 3-stage build: deps -> builder -> runtime
- Separated build-time and runtime dependencies
- Added non-root user (nuxt:nodejs) for security
- Integrated dumb-init for proper signal handling
- Added health check endpoint at /api/health
- Impact: Smaller image size, faster deployments, better security

## 5. HTTP Caching
- Static assets: 1 year cache (immutable)
- Logos/images: 1 year cache (immutable)
- API routes: No cache (always fresh)
- HTML pages: 10 minute cache with revalidation
- Impact: Reduced bandwidth, faster page loads, less server load

All optimizations follow best practices and maintain backward
compatibility with existing functionality.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 08:01:45 -05:00

65 lines
2.3 KiB
TypeScript

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
modules: [
'@nuxtjs/tailwindcss'
],
app: {
head: {
title: 'New Life Christian Church - Sermons',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ name: 'description', content: 'Weekly sermons from New Life Christian Church' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/logos/favicon.ico' },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap' }
]
}
},
css: ['~/assets/css/main.css'],
// Configure route caching rules
routeRules: {
// Static assets - cache for 1 year (immutable)
'/_nuxt/**': { headers: { 'cache-control': 'public, max-age=31536000, immutable' } },
'/logos/**': { headers: { 'cache-control': 'public, max-age=31536000, immutable' } },
// API routes - no cache
'/api/**': { headers: { 'cache-control': 'no-store, no-cache, must-revalidate' } },
// HTML pages - cache for 10 minutes with revalidation
'/**': { headers: { 'cache-control': 'public, max-age=600, must-revalidate' } }
},
runtimeConfig: {
// Private runtime config (server-side only)
// These are automatically overridden by NUXT_<KEY> environment variables
// Example: NUXT_EMAIL_HOST overrides emailHost
// AUTH_SECRET is now auto-generated and stored in database
authSecret: '',
// Admin credentials - auto-generated on first launch if not provided
adminUsername: 'admin',
adminPassword: '',
// Email configuration - will be overridden by NUXT_EMAIL_* env vars at runtime
emailHost: 'smtp.example.com',
emailPort: '587',
emailUser: 'noreply@example.com',
emailPassword: '',
emailFrom: 'New Life Christian Church <noreply@example.com>',
public: {
// Public config accessible to both client and server
// Overridden by NUXT_PUBLIC_SITE_URL
siteUrl: 'http://localhost:3000'
}
}
})