A simple full-stack application for managing pre-owned item exchange (buy/sell/donate).
- Frontend: React.js with React Router, Vite
- Backend: Node.js + Express
- Database: MySQL with Prisma ORM
- Authentication: JWT
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
- Node.js (v16 or higher)
- MySQL database
- npm or yarn
- Navigate to the backend directory:
cd backend- Install dependencies:
npm install- Create a
.envfile in the backend directory:
PORT=5000
DATABASE_URL="mysql://user:password@localhost:3306/rethread"
JWT_SECRET="your-secret-key-change-this-in-production"-
Update the
DATABASE_URLwith your MySQL credentials:- Replace
userwith your MySQL username - Replace
passwordwith your MySQL password - Replace
localhost:3306if your MySQL is on a different host/port - Replace
rethreadwith your database name (or create a new database)
- Replace
-
Generate Prisma Client:
npm run prisma:generate- Run database migrations:
npm run prisma:migrate- Start the server:
npm run devThe backend server will run on http://localhost:5000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Start the development server:
npm run devThe frontend will run on http://localhost:3000
-
POST /api/auth/signup- Register a new user- Body:
{ email, password, name, role? } - Role is optional (defaults to "buyer")
- Body:
-
POST /api/auth/login- Login user- Body:
{ email, password }
- Body:
- ✅ 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
- Dashboard page
- Item listings
- User profile
- Item CRUD operations
- Wishlist functionality
- Search and filtering