Created
June 26, 2025 15:52
-
-
Save deletosh/58293a90e4eb8f72d7926fd3922598d2 to your computer and use it in GitHub Desktop.
wip-
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineNuxtConfig } from "nuxt/config"; | |
// https://nuxt.com/docs/api/configuration/nuxt-config | |
export default defineNuxtConfig({ | |
// Enable server-side rendering for SEO (can be disabled via env var) | |
ssr: process.env.NUXT_SSR === "false" ? false : true, | |
telemetry: false, | |
compatibilityDate: "2024-11-01", | |
devtools: { enabled: process.env.NUXT_DEVTOOLS === "false" ? false : true }, | |
modules: [ | |
"@pinia/nuxt", | |
"@nuxtjs/tailwindcss", | |
"@nuxtjs/supabase" | |
], | |
app: { | |
head: { | |
title: "Salzy - Sales Intelligence Platform", | |
meta: [ | |
{ charset: "utf-8" }, | |
{ name: "viewport", content: "width=device-width, initial-scale=1" }, | |
{ | |
name: "description", | |
content: | |
"Salzy transforms raw customer data into strategic sales insights that help close deals faster.", | |
}, | |
// Add robots meta tag to prevent indexing based on environment variable or staging environment | |
...(process.env.NUXT_ROBOTS_NOINDEX === "true" || process.env.NODE_ENV === "staging" | |
? [{ name: "robots", content: "noindex, nofollow" }] | |
: []), | |
], | |
link: [ | |
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }, | |
{ | |
rel: "stylesheet", | |
href: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap", | |
}, | |
], | |
}, | |
// Serve the application at the path specified in environment variable or default to root | |
baseURL: process.env.NUXT_APP_BASE_URL || "/", | |
buildAssetsDir: "/_nuxt/", | |
}, | |
css: ["~/assets/css/main.css"], | |
runtimeConfig: { | |
// Private keys (server-side only) | |
stripeSecretKey: process.env.NUXT_STRIPE_SECRET_KEY || "", | |
stripeWebhookSecret: process.env.NUXT_STRIPE_WEBHOOK_SECRET || "", | |
supabaseServiceRoleKey: process.env.NUXT_SUPABASE_SERVICE_ROLE_KEY || "", | |
jwtSecret: process.env.JWT_SECRET || "fallback‑secret‑here", | |
// Public keys (available on both server and client) | |
public: { | |
apiBase: process.env.NUXT_PUBLIC_API_BASE || (process.env.NODE_ENV?.includes("staging") | |
? "https://dev.salzy.io/" | |
: "https://salzy.io"), | |
supabaseUrl: process.env.NUXT_PUBLIC_SUPABASE_URL || "", | |
supabaseKey: process.env.NUXT_PUBLIC_SUPABASE_KEY || "", | |
stripePublishableKey: process.env.NUXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || "", | |
stripeBasicPriceId: process.env.NUXT_PUBLIC_STRIPE_BASIC_PRICE_ID || "", | |
stripeProPriceId: process.env.NUXT_PUBLIC_STRIPE_PRO_PRICE_ID || "", | |
stripeEnterprisePriceId: process.env.NUXT_PUBLIC_STRIPE_ENTERPRISE_PRICE_ID || "", | |
useSecureCookies: process.env.NUXT_USE_SECURE_COOKIES ? | |
process.env.NUXT_USE_SECURE_COOKIES === "true" : | |
process.env.NODE_ENV === "production", | |
}, | |
}, | |
// Supabase module configuration | |
supabase: { | |
url: process.env.NUXT_PUBLIC_SUPABASE_URL, | |
key: process.env.NUXT_PUBLIC_SUPABASE_KEY, | |
serviceKey: process.env.NUXT_SUPABASE_SERVICE_ROLE_KEY, | |
redirectOptions: { | |
login: "/login", | |
callback: "/auth/supabase-callback", | |
exclude: ["/register", "/", "/pricing", "/features", "/contact"], | |
}, | |
cookieOptions: { | |
maxAge: 60 * 60 * 8, // 8 hours | |
sameSite: "lax", | |
secure: process.env.NUXT_USE_SECURE_COOKIES ? | |
process.env.NUXT_USE_SECURE_COOKIES === "true" : | |
process.env.NODE_ENV === "production", | |
}, | |
clientOptions: { | |
auth: { | |
flowType: "pkce", | |
detectSessionInUrl: true, | |
persistSession: true, | |
autoRefreshToken: true, | |
}, | |
}, | |
}, | |
// Configure server using environment variables or defaults | |
server: { | |
host: process.env.HOST || "0.0.0.0", | |
port: parseInt(process.env.PORT || "3000"), | |
}, | |
nitro: { | |
preset: "node-server", | |
externals: { | |
inline: ["stripe"], | |
}, | |
// Configure Nitro server using environment variables | |
server: { | |
host: process.env.NITRO_HOST || process.env.HOST || "0.0.0.0", | |
port: parseInt(process.env.NITRO_PORT || process.env.PORT || "3000"), | |
}, | |
}, | |
vite: { | |
optimizeDeps: { | |
exclude: ["fsevents"], | |
}, | |
build: { | |
sourcemap: process.env.NUXT_SOURCEMAP === "true", | |
}, | |
}, | |
routeRules: { | |
// API routes require authentication | |
"/api/**": { | |
cors: process.env.NUXT_API_CORS === "false" ? false : true, | |
headers: { | |
"Access-Control-Allow-Credentials": process.env.NUXT_API_ALLOW_CREDENTIALS === "false" ? "false" : "true" | |
}, | |
}, | |
}, | |
imports: { | |
dirs: process.env.NUXT_IMPORT_DIRS ? process.env.NUXT_IMPORT_DIRS.split(',') : ["composables", "utilities"], | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment