How krishn404/git-friend works
Project Type and Purpose
• Git-Friend is a full-stack web application built with Next.js (v13 app router), React, and TypeScript.
• It provides an AI-powered GitHub assistant featuring:
– AI Chat for GitHub questions
– Dynamic README generation
– Gitmoji (commit emoji) lookup
– Google Authentication and user sessions
High-Level Architectural Overview
A. Client-Side (Browser)
• Next.js page components under /app/… (ai-chat, generate-readme, git-mojis)
• Shared UI library in /components/ui (Radix-based controls, toasts, dialogs, etc.)
• Auth components in /components/auth (login modal, protected-route wrapper)
• Global context in /context/auth-context.tsx to hold user session state
• Hooks in /hooks (for detecting mobile, toasting messages)
B. Server-Side (Next.js Server + API Routes)
• Server components and layouts under /app/layout.tsx, app/page.tsx
• API endpoints under /app/api/… implemented as serverless functions:
– /api/chat/route.ts → forwards chat queries to AI service (Groq or OpenAI)
– /api/generate-readme/route.ts → calls AI to produce README content
– /api/fetch-repo-data/route.ts → optionally fetches metadata from GitHub
– /api/git-mojis and /gitmojis → returns list of emojis or single emoji
C. Libraries & Utilities (lib/)
• lib/firebase.ts → initialize Firebase App and Auth
• lib/redis.ts → connect to Upstash Redis for caching or rate-limiting
• lib/timeout-utils.ts, utils.ts → shared helper functions
D. External Services
• Google Identity Platform (OAuth2) for user sign-in
• Firebase Auth (session management, optional Firestore/Storage)
• Upstash Redis (REST API, caching intermediate AI results or emoji lists)
• GitHub REST API via Octokit (for fetch-repo-data endpoint)
• AI API (Groq or OpenAI) for chat and text generation