How ytw418/breeder_web works
Project type and purpose
• This is a full-stack Next.js 14 application in TypeScript that implements a peer-to-peer second-hand marketplace and community (“Breeder”).
• Core domains: product listings, user profiles, real-time chat, reviews, and authentication.
File structure
• app/ (Next.js “App Router” pages & client components): all public UI routes, nested folders for pages (main, chat, posts, products, profiles, auth).
• pages/api/: REST API endpoints organized by domain (auth, chat, posts, products, users).
• components/: reusable UI atoms, auth widgets, feature compositions, theme provider.
• libs/: shared utilities split into client (fetcher, SWR, providers) and server (Prisma client wrapper, session & handler middlewares).
• prisma/: database schema and migrations.
• public/: static assets (images, robots.txt).
• config & infra: next.config.js, tailwind.config.js, middleware.ts.
Key insights from the README
• Tech stack: Next.js, React, TypeScript, TailwindCSS, Prisma (ORM), iron-session (auth), SWR (data fetching).
• Coding rules enforced by .cursor/rules (API, page, style conventions).
• API responses always { success: boolean, ... }.
• DB access exclusively via libs/server/client.ts (Prisma wrapper).
Elements
• Labels for each component (Browser, Next.js SSR, API handlers, DB, CDN, Auth service)
• Green for API/middleware
• Orange for database
• Gray for external services/CDN
• Frontend (app/ + SWR + components/)
• Backend (pages/api/ + libs/server/)
• Persistence (Prisma + PostgreSQL)
• Third-party (OAuth, Vercel env)