Skip to content

Jaykolate/E-commerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧡 Threadly β€” Pre-loved Fashion Marketplace

"Wear it again, wear it well."

Threadly is a full-stack sustainable fashion marketplace where users can buy, sell, and swap pre-loved clothing. Built with React + Node.js, it features real-time chat, AI-assisted listing creation, Stripe payments, and a unique item-swap system.

🌐 Live Demo: threadly-liart.vercel.app
πŸ”§ Backend API: threadly-eigu.onrender.com


✨ Features

Feature Description
πŸ›οΈ Buy & Sell List pre-loved clothes with AI-generated descriptions
πŸ”„ Swap System Propose item-for-item swaps β€” no money needed
πŸ’¬ Real-time Chat Socket.IO powered messaging between buyers and sellers
πŸ” Auth JWT access tokens + httpOnly refresh token cookies
πŸ“§ Forgot Password Secure email reset flow via Gmail SMTP (Nodemailer)
❀️ Wishlist Save favourite listings
⭐ Reviews Seller trust scores built from verified buyer reviews
πŸ’³ Stripe Payments Secure checkout with Stripe
πŸ”” Notifications Real-time in-app notifications
πŸ€– AI Listings Gemini AI assists with listing title & description
πŸ‘‘ Admin Panel Manage users and listings

πŸ› οΈ Tech Stack

Frontend

  • React 18 + Vite
  • Redux Toolkit β€” auth state management
  • React Router v6 β€” client-side routing
  • Axios β€” API client with auto token refresh
  • Socket.IO Client β€” real-time chat
  • Stripe.js β€” payment UI
  • Tailwind CSS β€” utility-first styling
  • React Hot Toast β€” notifications

Backend

  • Node.js + Express 5
  • MongoDB + Mongoose
  • Socket.IO β€” real-time events
  • JWT β€” access & refresh token auth
  • Nodemailer β€” transactional email
  • Cloudinary β€” image storage
  • Stripe β€” payment processing
  • Google Gemini AI β€” listing assistant
  • Helmet + CORS β€” security

πŸ“ Project Structure

project1/
β”œβ”€β”€ server/                  # Node.js Express backend
β”‚   β”œβ”€β”€ controllers/         # Route handlers (auth, listings, swaps...)
β”‚   β”œβ”€β”€ models/              # Mongoose schemas
β”‚   β”œβ”€β”€ routes/              # Express routers
β”‚   β”œβ”€β”€ middleware/          # Auth, error handling
β”‚   β”œβ”€β”€ services/            # Notification, email services
β”‚   β”œβ”€β”€ socket/              # Socket.IO chat handler
β”‚   β”œβ”€β”€ utils/               # Token generation, helpers
β”‚   └── server.js            # Entry point
β”‚
└── threadly/                # React frontend
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ pages/           # Route-level components
    β”‚   β”‚   β”œβ”€β”€ Auth/        # Login, Register, ForgotPassword, ResetPassword
    β”‚   β”‚   β”œβ”€β”€ Home.jsx
    β”‚   β”‚   β”œβ”€β”€ Explore.jsx
    β”‚   β”‚   β”œβ”€β”€ ListingDetail.jsx
    β”‚   β”‚   β”œβ”€β”€ SwapPropose.jsx
    β”‚   β”‚   β”œβ”€β”€ BuyerDashboard.jsx
    β”‚   β”‚   β”œβ”€β”€ SellerDashboard.jsx
    β”‚   β”‚   └── ...
    β”‚   β”œβ”€β”€ components/      # Shared UI components
    β”‚   β”œβ”€β”€ services/        # API service functions
    β”‚   β”œβ”€β”€ store/           # Redux store & slices
    β”‚   └── hooks/           # Custom hooks (useSocket)
    └── public/
        └── threadly.svg     # Custom brand favicon

πŸš€ Getting Started Locally

Prerequisites

  • Node.js 18+
  • MongoDB Atlas account
  • Cloudinary account
  • Stripe account
  • Gmail + App Password (for email)

1. Clone the repo

git clone https://github.com/your-username/threadly.git
cd threadly

2. Setup Backend

cd server
npm install

Create server/.env:

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
JWT_REFRESH_SECRET=your_refresh_secret
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
GEMINI_API_KEY=your_gemini_key
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
CLIENT_URL=http://localhost:5173
NODE_ENV=development
EMAIL_USER=your_gmail@gmail.com
EMAIL_PASS=your_gmail_app_password
npm run dev

3. Setup Frontend

cd ../threadly
npm install

Create threadly/.env:

VITE_API_URL=http://localhost:5000
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_...
npm run dev

App runs at http://localhost:5173


🌐 Deployment

Backend β†’ Render

Setting Value
Root Directory server
Build Command npm install
Start Command npm start

Add all env vars from server/.env in the Render dashboard. Set CLIENT_URL to your Vercel frontend URL (no trailing slash).

Frontend β†’ Vercel

Setting Value
Root Directory threadly
Framework Vite
Build Command npm run build
Output Directory dist

Add in Vercel Environment Variables:

VITE_API_URL=https://your-render-api.onrender.com
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_...

Note: vercel.json with URL rewrites is included for React Router support.


πŸ” Auth Flow

Register / Login
    β†’ Access Token (localStorage, 15 min)
    β†’ Refresh Token (httpOnly cookie, 7 days)

Every API request β†’ Authorization: Bearer <accessToken>
On 401 β†’ Auto-refresh via /api/auth/refresh-token

Forgot Password Flow:

Enter email β†’ Hashed token saved to DB (15 min TTL)
           β†’ Raw token sent via email link
User clicks link β†’ Submits new password
               β†’ Token validated + cleared from DB

πŸ”„ Swap System

Threadly's swap system allows item-for-item exchanges:

  • Sellers β†’ Select one of their active listings to offer
  • Buyers (no listings) β†’ Describe their item via freeform form
  • Receiver can accept, reject, or counter with a different item
  • Proposer can accept the counter or cancel

πŸ“Έ Screenshots

| Home | Explore | Swap Propose | Screenshot 2026-03-02 202856 Screenshot 2026-03-02 202954 Screenshot 2026-03-02 203408

πŸ“ License

MIT Β© 2025 Threadly β€” Give clothes a second life. 🧡

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages