diff --git a/apps/editor/features/community/lib/database/server.ts b/apps/editor/features/community/lib/database/server.ts index 56e50201..6d853650 100644 --- a/apps/editor/features/community/lib/database/server.ts +++ b/apps/editor/features/community/lib/database/server.ts @@ -1,9 +1,8 @@ /** * Supabase server client for database access - * Re-exports from @pascal-app/db package */ -import { supabaseAdmin } from '@pascal-app/db/server' +import { supabaseAdmin } from '@/lib/supabase/server' /** * Create a Supabase client for server-side use with service role key diff --git a/packages/db/src/client.ts b/apps/editor/lib/supabase/client.ts similarity index 66% rename from packages/db/src/client.ts rename to apps/editor/lib/supabase/client.ts index 1052bea4..1a53b8fd 100644 --- a/packages/db/src/client.ts +++ b/apps/editor/lib/supabase/client.ts @@ -1,5 +1,5 @@ import { createClient } from '@supabase/supabase-js' -import type { Database } from './types' +import type { SupabaseDatabase } from '@pascal-app/db' const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL! const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! @@ -8,4 +8,4 @@ const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! * Supabase client for client-side use with anon key * Uses Row Level Security (RLS) policies */ -export const supabase = createClient(supabaseUrl, supabaseAnonKey) +export const supabase = createClient(supabaseUrl, supabaseAnonKey) diff --git a/packages/db/src/server.ts b/apps/editor/lib/supabase/server.ts similarity index 60% rename from packages/db/src/server.ts rename to apps/editor/lib/supabase/server.ts index f42ccbc0..a059c430 100644 --- a/packages/db/src/server.ts +++ b/apps/editor/lib/supabase/server.ts @@ -1,5 +1,5 @@ import { createClient } from '@supabase/supabase-js' -import type { Database } from './types' +import type { SupabaseDatabase } from '@pascal-app/db' const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL! const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY! @@ -9,9 +9,13 @@ const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY! * Bypasses Row Level Security (RLS) - use with caution * Always filter by user_id to enforce permissions */ -export const supabaseAdmin = createClient(supabaseUrl, supabaseServiceRoleKey, { - auth: { - persistSession: false, - autoRefreshToken: false, +export const supabaseAdmin = createClient( + supabaseUrl, + supabaseServiceRoleKey, + { + auth: { + persistSession: false, + autoRefreshToken: false, + }, }, -}) +) diff --git a/packages/db/package.json b/packages/db/package.json index b9a79c7f..5ccd5316 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -7,14 +7,6 @@ "types": "./src/index.ts", "default": "./src/index.ts" }, - "./client": { - "types": "./src/client.ts", - "default": "./src/client.ts" - }, - "./server": { - "types": "./src/server.ts", - "default": "./src/server.ts" - }, "./types": { "types": "./src/types.ts", "default": "./src/types.ts" diff --git a/packages/db/src/index.ts b/packages/db/src/index.ts index bef886e0..d3123e43 100644 --- a/packages/db/src/index.ts +++ b/packages/db/src/index.ts @@ -1,10 +1,9 @@ /** * Database package - * Exports Supabase clients, Drizzle ORM, and types + * Exports Drizzle ORM and types + * Note: Supabase clients are kept in the app's lib directory to avoid build-time initialization */ -export { supabase } from './client' -export { supabaseAdmin } from './server' export type { Database as SupabaseDatabase } from './types' // Drizzle exports