Journify interacts with its backend through the Supabase JavaScript Client SDK using PostgREST endpoints and WebSocket channels.
Handled by Supabase Auth with PKCE and JWT storage:
- SDK Method:
supabase.auth.signInWithPassword({ email, password }) - Output: Session object with user profile and access JWT token.
- SDK Method:
supabase.auth.signUp({ email, password, options: { data: { full_name } } }) - Behavior: Creates auth row and triggers profile creation.
- SDK Method:
supabase.auth.signInWithOAuth({ provider: 'google' | 'github' })
- SDK Method:
supabase.auth.resetPasswordForEmail(email, { redirectTo })
CRUD interactions implemented in src/services/syncEngine.ts and React views:
- Query:
supabase .from('journal_entries') .select('*') .eq('user_id', userId) .order('created_at', { ascending: false });
- Payload:
interface CreateEntryPayload { id: string; // UUID generated locally user_id: string; title: string; content: string; mood?: 'joyful' | 'peaceful' | 'sad' | 'angry' | 'anxious'; tags?: string[]; is_favorite?: boolean; is_private?: boolean; folder_id?: string | null; created_at?: string; updated_at: string; }
- Query:
supabase .from('journal_entries') .update({ title, content, mood, tags, updated_at }) .eq('id', entryId);
- Query:
supabase .from('journal_entries') .delete() .eq('id', entryId);
- Bucket:
journal-media - Upload Path:
{userId}/{entryId}/{timestamp}_{filename} - Permissions: Scoped strictly to authenticated user matching
{userId}prefix.