nanochat/services/frontend/app/layout.tsx
Manmohan Sharma aa7a907063
feat(frontend): wire frontend to real backend auth + chat-api services
Remove NextAuth and replace with token-based auth against the backend
auth service (OAuth + JWT). The frontend now redirects login to
/api/auth/google and /api/auth/github (proxied by nginx to the auth
service), captures the JWT from the redirect query param, and uses it
for all API calls.

Key changes:
- Remove next-auth dependency and all NextAuth config/routes
- Add lib/auth-client.ts (JWT token storage + auth headers)
- Add hooks/useAuth.ts (client-side auth state + token capture)
- Rewrite middleware.ts to pass-through (client-side auth only)
- Login page uses plain <a> links to /api/auth/{provider}
- Chat page captures access_token from OAuth redirect
- Zustand store fetches conversations from real chat-api via JWT
- API routes proxy /api/conversations/* to chat-api with auth
- chat/stream route supports conversationId + auth header forwarding
- useSSE hook accepts auth headers for authenticated streaming
- Sidebar loads conversations from API, supports delete
- Landing page (Hero, LandingNav) uses useAuth instead of useSession
- Add .env.production.example and scripts/generate-jwt-keys.sh

Mock echo fallback preserved when CHAT_API_URL is not set.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 13:21:38 -07:00

54 lines
1.3 KiB
TypeScript

import type { Metadata, Viewport } from 'next';
import { Baloo_2, Great_Vibes, Caveat, Inter } from 'next/font/google';
import './globals.css';
const baloo = Baloo_2({
subsets: ['latin', 'devanagari'],
weight: ['400', '600', '700', '800'],
variable: '--font-baloo',
display: 'swap',
});
const vibes = Great_Vibes({
subsets: ['latin'],
weight: ['400'],
variable: '--font-vibes',
display: 'swap',
});
const caveat = Caveat({
subsets: ['latin'],
weight: ['400', '600', '700'],
variable: '--font-caveat',
display: 'swap',
});
const inter = Inter({
subsets: ['latin'],
variable: '--font-inter',
display: 'swap',
});
export const metadata: Metadata = {
title: 'समोसाचाट — samosaChaat',
description: 'Crafted with care. For India, from India. A warm, desi-flavored chat experience powered by nanochat.',
icons: { icon: '/logo.svg' },
};
export const viewport: Viewport = {
themeColor: '#fff8e7',
width: 'device-width',
initialScale: 1,
viewportFit: 'cover',
};
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" className={`${baloo.variable} ${vibes.variable} ${caveat.variable} ${inter.variable}`}>
<body className="min-h-dvh bg-white text-gray-900">
{children}
</body>
</html>
);
}