Ship Novya PWA with backend for deployable production use.

Fix production TypeScript builds and add DEPLOY.md so the app can be hosted from this repo.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ar.badiei
2026-09-03 21:01:52 +03:30
co-authored by Cursor
parent aa9236fb92
commit 370ac15471
193 changed files with 25997 additions and 1991 deletions
+40 -19
View File
@@ -1,27 +1,48 @@
import { atom } from 'jotai';
import type { User, Session } from '@supabase/supabase-js';
export const sessionAtom = atom<Session | null>(null);
export const userAtom = atom<User | null>((get) => {
const session = get(sessionAtom);
return session?.user ?? null;
});
export type BackendUser = {
id: string;
email: string | null;
isGuest: boolean;
profileComplete: boolean;
};
export type GuestSession = {
id: string;
isGuest: true;
createdAt: string;
};
export const GUEST_SESSION_STORAGE_KEY = 'guest-session';
const readGuestSession = (): GuestSession | null => {
if (typeof window === 'undefined') return null;
const raw = localStorage.getItem(GUEST_SESSION_STORAGE_KEY);
if (!raw) return null;
try {
const parsed = JSON.parse(raw) as GuestSession;
if (!parsed?.id || parsed?.isGuest !== true) return null;
return parsed;
} catch {
return null;
}
};
export const backendUserAtom = atom<BackendUser | null>(null);
export const isAuthenticatedAtom = atom<boolean>((get) => {
const session = get(sessionAtom);
return !!session?.user;
return !!get(backendUserAtom);
});
export const guestSessionAtom = atom<GuestSession | null>(readGuestSession());
export const guestSessionHydratedAtom = atom(false);
export const isGuestAtom = atom<boolean>((get) => !!get(guestSessionAtom));
export const effectiveUserIdAtom = atom<string | null>((get) => {
const user = get(backendUserAtom);
if (user?.id) return user.id;
const guest = get(guestSessionAtom);
return guest?.id ?? null;
});
export const authInitialCheckDoneAtom = atom(false);