fix: make Supabase optional and add assetPrefix support

- lib/supabase.ts: Return null when credentials missing instead of crash
- next.config.js: Add assetPrefix and basePath for VibeCoder proxy
- package.json: Use generic template name (v0.2.0)
This commit is contained in:
Asan Stefanski
2025-12-25 20:20:04 +01:00
parent 2085ff22c5
commit 204ead0357
3 changed files with 21 additions and 8 deletions

View File

@@ -1,6 +1,14 @@
import { createClient } from '@supabase/supabase-js'; import { createClient, SupabaseClient } from '@supabase/supabase-js';
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!; const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!; const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
export const supabase = createClient(supabaseUrl, supabaseAnonKey); // Create client only if credentials are available
// This allows the app to run without Supabase for basic previews
export const supabase: SupabaseClient | null =
supabaseUrl && supabaseAnonKey
? createClient(supabaseUrl, supabaseAnonKey)
: null;
// Helper to check if Supabase is configured
export const isSupabaseConfigured = (): boolean => supabase !== null;

View File

@@ -1,12 +1,17 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
// Note: 'output: standalone' is set during Docker build, not in dev mode
// Support VibeCoder proxy paths (e.g., /projekte/[id]/preview/)
assetPrefix: process.env.ASSET_PREFIX || undefined,
basePath: process.env.BASE_PATH || undefined,
experimental: { experimental: {
serverActions: { serverActions: {
bodySizeLimit: '2mb', bodySizeLimit: '2mb',
}, },
}, },
images: { images: {
remotePatterns: [ remotePatterns: [
{ {

View File

@@ -1,7 +1,7 @@
{ {
"name": "project-1766459980010-q6lr8s01b", "name": "lumina-nextjs-template",
"version": "0.1.0", "version": "0.2.0",
"description": "ads", "description": "Next.js 15 starter template for Lumina VibeCoder projects",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",