Marketplace-style portal for listing, browsing, and purchasing used textbooks. Built with Next.js (pages router), Tailwind CSS, MongoDB via Mongoose, session-backed APIs, and Supabase Storage for user-uploaded images.
- Next.js 15 (pages directory) + React 18
- Tailwind CSS for styling
- MongoDB + Mongoose models for products, carts, users, orders
- iron-session for server-side session cookies on API routes and SSR
- Supabase Storage for image uploads (public bucket
product-images) - OpenAI (chat completions) to generate listing metadata and cover suggestions
- Authenticated dashboard and product catalog with server-side rendered pages
- Product generation API that enriches listings (headline, description, specs, ISBN, cover suggestions)
- Image uploads go through client-side compression then Supabase Storage; public URLs are saved with the product
- Cart/checkout flow that marks purchased listings as sold and removes them from other carts
MONGODB_URL(orMONGODB_URI) for MongoDB connectionSESSION_SECRETfor iron-session- OpenAI:
OPENAI_API_KEYorOPENAI_KEYorOPEN - Supabase Storage:
NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_ANON_KEY,NEXT_PUBLIC_SUPABASE_STORAGE_BUCKET(defaultproduct-images) - Firebase keys remain for front-end init (not currently used for storage)
- Install deps:
npm install - Run dev server:
npm run dev - Build:
npm run build - Seed sample data (MongoDB required):
npm run seed
- OpenAI model usage is limited to generating non-critical listing descriptions to speed up listing creation; core listing data stays user-provided.
- Image compression is client-side (max 900x900, quality tuned for ~400 KB bucket limit).