File size: 2,012 Bytes
1b44660
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import tailwindcss from '@tailwindcss/vite';

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  app: {
    head: {
      htmlAttrs: { lang: 'en' },
      link: [{ rel: 'icon', type: 'image/png', href: '/favicon.ico' }],
    },
  },

  colorMode: { classSuffix: '', preference: 'system', fallback: 'system' },
  compatibilityDate: '2025-03-01',
  css: ['~/assets/css/main.css'],

  devtools: { enabled: true },
  devServer: { host: '0.0.0.0' },

  modules: ['@nuxtjs/color-mode', 'nuxt-auth-utils', '@nuxt/eslint'],

  nitro: { prerender: { autoSubfolderIndex: false }, cloudflare: { nodeCompat: true, deployConfig: true } },

  routeRules: {
    // Cache the list of briefs for 1 hour on CDN, 15 mins in browser
    // Allow serving stale data for up to a day while revalidating
    '/api/briefs': {
      cache: {
        maxAge: 60 * 15, // 15 minutes browser cache
        staleMaxAge: 60 * 60 * 24, // 1 day stale-while-revalidate on CDN
      },
    },
    // Cache individual briefs for longer (assuming they don't change once published)
    // Cache for 1 day on CDN, 1 hour in browser
    '/api/briefs/**': {
      // Matches /api/briefs/some-slug, /api/briefs/another-slug etc.
      cache: {
        maxAge: 60 * 60, // 1 hour browser cache
        staleMaxAge: 60 * 60 * 24 * 7, // 1 week stale-while-revalidate on CDN
      },
    },
  },

  // In production, these are set via the environment variables
  // NUXT_+{key}
  runtimeConfig: {
    database: { url: '' }, // NUXT_DATABASE_URL
    mailerlite: { api_key: '', group_id: '' }, // NUXT_MAILERLITE_API_KEY, NUXT_MAILERLITE_GROUP_ID
    admin: { username: 'admin', password: 'hunter2' }, // NUXT_ADMIN_USERNAME, NUXT_ADMIN_PASSWORD
    worker: { api_token: 'hunter2' }, // NUXT_WORKER_API_TOKEN

    // IMPORTANT: all "public" config is exposed to the client
    public: { WORKER_API: 'http://localhost:8787' }, // NUXT_PUBLIC_WORKER_API
  },

  srcDir: 'src',

  vite: { plugins: [tailwindcss()] },
});