nanochat/.env.production.example
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

33 lines
791 B
Plaintext

# Database (docker-compose postgres)
DATABASE_URL=postgresql+asyncpg://samosachaat_admin:CHANGE_ME@postgres:5432/samosachaat
POSTGRES_PASSWORD=CHANGE_ME
# Auth service
AUTH_BASE_URL=https://samosachaat.art/api
FRONTEND_URL=https://samosachaat.art
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
JWT_PRIVATE_KEY=
JWT_PUBLIC_KEY=
INTERNAL_API_KEY=CHANGE_ME_RANDOM_STRING
SESSION_SECRET=CHANGE_ME_RANDOM_STRING
COOKIE_SECURE=true
COOKIE_DOMAIN=samosachaat.art
# Chat API
AUTH_SERVICE_URL=http://auth:8001
INFERENCE_SERVICE_URL=http://inference:8003
CHAT_API_URL=http://chat-api:8002
# Inference
MODEL_STORAGE_PATH=/models
DEFAULT_MODEL_TAG=samosachaat-d12
NANOCHAT_DTYPE=float32
HF_TOKEN=
NUM_WORKERS=1
# Frontend
NEXT_PUBLIC_APP_URL=https://samosachaat.art