Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReThread - Online Thrift Store

A simple full-stack application for managing pre-owned item exchange (buy/sell/donate).

Tech Stack

  • Frontend: React.js with React Router, Vite
  • Backend: Node.js + Express
  • Database: MySQL with Prisma ORM
  • Authentication: JWT

Project Structure

ReThread/
├── backend/
│   ├── routes/
│   │   └── auth.js
│   ├── prisma/
│   │   └── schema.prisma
│   ├── server.js
│   ├── package.json
│   └── .env
└── frontend/
    ├── src/
    │   ├── pages/
    │   │   ├── Login.jsx
    │   │   ├── Login.css
    │   │   ├── Signup.jsx
    │   │   └── Signup.css
    │   ├── utils/
    │   │   └── api.js
    │   ├── App.jsx
    │   ├── main.jsx
    │   └── index.css
    ├── package.json
    └── vite.config.js

Setup Instructions

Prerequisites

  • Node.js (v16 or higher)
  • MySQL database
  • npm or yarn

Backend Setup

  1. Navigate to the backend directory:
cd backend
  1. Install dependencies:
npm install
  1. Create a .env file in the backend directory:
PORT=5000
DATABASE_URL="mysql://user:password@localhost:3306/rethread"
JWT_SECRET="your-secret-key-change-this-in-production"
  1. Update the DATABASE_URL with your MySQL credentials:

    • Replace user with your MySQL username
    • Replace password with your MySQL password
    • Replace localhost:3306 if your MySQL is on a different host/port
    • Replace rethread with your database name (or create a new database)
  2. Generate Prisma Client:

npm run prisma:generate
  1. Run database migrations:
npm run prisma:migrate
  1. Start the server:
npm run dev

The backend server will run on http://localhost:5000

Frontend Setup

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev

The frontend will run on http://localhost:3000

API Endpoints

Authentication

  • POST /api/auth/signup - Register a new user

    • Body: { email, password, name, role? }
    • Role is optional (defaults to "buyer")
  • POST /api/auth/login - Login user

    • Body: { email, password }

Features Implemented

  • ✅ User registration with email, password, name, and role
  • ✅ User login with email and password
  • ✅ JWT-based authentication
  • ✅ Password hashing with bcrypt
  • ✅ Form validation
  • ✅ Error handling
  • ✅ Responsive UI with CSS

Next Steps

  • Dashboard page
  • Item listings
  • User profile
  • Item CRUD operations
  • Wishlist functionality
  • Search and filtering

ReThread-Project

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages