How krish120003/gitfaster works
Project type and purpose
• Gitfaster is a full‑stack Next.js application (“Built With Next.js”) that provides a modern GitHub client UI with prefetching and caching.
• It uses React components under src/app and src/components, an API layer under src/app/api and src/server/api, and interacts with GitHub and a local database/cache.
File structure
• Frontend:
– src/app directory (Next.js App Router pages & layouts)
– src/components (reusable UI elements)
– src/trpc/react.tsx & src/trpc/query-client.ts (tRPC client setup)
– src/styles/globals.css
• Backend/API:
– Next.js API routes in src/app/api/* (NextAuth and tRPC routes)
– tRPC server code in src/server/api/routers/* (GitHub, issues, PRs, user)
– src/server/auth (NextAuth config)
– src/server/db (Drizzle/DB schema & client)
– src/server/redis (cache client)
– src/server/github/auth.ts (GitHub OAuth & token management)
• Config & infra:
– next.config.js, drizzle.config.ts, .env.example, start-database.sh
– package.json/pnpm-lock.yaml for dependencies
README for additional insights
• Minimal, performance‑oriented client with prefetching and caching layers.
Main components and their interactions
a. Frontend (Browser)
– Next.js React UI (pages + components)
– tRPC client & NextAuth session provider
– Data fetching via tRPC hooks and REST for NextAuth
b. Next.js Server (SSR/API layer)
– NextAuth route (/api/auth/[...nextauth]) for login/session
– tRPC HTTP route (/api/trpc/[trpc]) forwarding client RPC calls
– SSR handlers for page rendering
c. Application Services
– tRPC routers:
• github.ts (wraps GitHub REST API calls)
• issues.ts, pull-requests.ts, user.ts, post.ts
– Auth service: exchanges OAuth code, issues JWT/session
– Database (Drizzle ORM)
– Redis cache for prefetching/caching responses
d. External Dependencies
– GitHub REST API
– Postgres (or other SQL) started via start-database.sh
– Redis instance
Architectural patterns & design principles
• Componentized UI (React + Next.js App Router)
• RPC pattern with tRPC (type safety between client/server)
• Separation of concerns: UI ↔ tRPC ↔ Service layer ↔ Data layer
• Caching layer (Redis) sits between service layer and external API/DB
• Auth isolation: NextAuth + GitHub OAuth in a distinct module
• Infrastructure as code: shell script to spin up DB