A sustainable fashion platform that enables users to exchange unused clothing through direct swaps or a point-based redemption system.
- User Authentication: Email/password signup and login
- Landing Page: Platform introduction with featured items carousel
- User Dashboard: Profile management, points balance, and swap history
- Item Browsing: Advanced filtering and search functionality
- Item Management: Upload and manage clothing listings
- Swap System: Request swaps or redeem items with points
- Admin Panel: Content moderation and platform oversight
- Responsive Design: Mobile-first approach with modern UI
- RESTful API: Comprehensive API with proper error handling
- Authentication: JWT-based authentication with bcrypt password hashing
- Database: MySQL with connection pooling and transactions
- File Upload: Multer integration for image uploads
- Validation: Express-validator for input validation
- Admin Features: User management and content moderation
- Point System: Automated point transactions and rewards
- React 18 with TypeScript
- Tailwind CSS for styling
- Lucide React for icons
- Vite for development and building
- Node.js with Express.js
- MySQL 2 for database operations
- JWT for authentication
- Bcrypt for password hashing
- Multer for file uploads
- Express-validator for validation
- CORS for cross-origin requests
- Node.js (v16 or higher)
- MySQL (v8 or higher)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd rewear
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env
Edit
.envwith your configuration:# Database Configuration DB_HOST=localhost DB_PORT=3306 DB_NAME=rewear_db DB_USER=root DB_PASSWORD=your_password # JWT Configuration JWT_SECRET=your_super_secure_jwt_secret_key_here JWT_EXPIRES_IN=7d # Server Configuration PORT=3001 NODE_ENV=development
-
Set up MySQL database
- Create a MySQL database named
rewear_db - The application will automatically create tables on first run
- Create a MySQL database named
-
Start the development servers
Backend (Terminal 1):
npm run server:dev
Frontend (Terminal 2):
npm run dev
-
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:3001
- Health check: http://localhost:3001/api/health
POST /api/auth/register- Register new userPOST /api/auth/login- User loginGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update user profilePUT /api/auth/change-password- Change password
GET /api/items- Get items with filtersGET /api/items/:id- Get single itemPOST /api/items- Create new item (with image upload)PUT /api/items/:id- Update itemDELETE /api/items/:id- Delete itemGET /api/items/categories- Get categories
GET /api/swaps- Get swap requestsPOST /api/swaps- Create swap requestPUT /api/swaps/:id/respond- Respond to swap requestPOST /api/swaps/redeem- Redeem item with points
GET /api/admin/stats- Dashboard statisticsGET /api/admin/items- Items for moderationPUT /api/admin/items/:id/moderate- Approve/reject itemsGET /api/admin/users- User managementPUT /api/admin/users/:id/status- Toggle user statusGET /api/admin/analytics- Platform analytics
- User profiles with points system
- Admin role management
- Account status tracking
- Detailed item information
- Category and condition tracking
- Approval workflow
- Image and tag associations
- Swap request management
- Status tracking (pending, accepted, declined, completed)
- Point-based redemption support
- Complete transaction history
- Multiple transaction types (earned, spent, bonus, penalty)
- Audit trail for all point movements
- Email:
admin@rewear.com - Password:
password
- Email:
sarah@example.com - Password:
password
Images are stored in the uploads/items/ directory. In production, consider using cloud storage services like AWS S3 or Cloudinary.
- Password hashing with bcrypt (12 rounds)
- JWT token authentication
- Input validation and sanitization
- SQL injection prevention
- File upload restrictions
- CORS configuration
- Rate limiting ready (can be added with express-rate-limit)
# Add your test commands here
npm test# Build frontend
npm run build
# Start production server
NODE_ENV=production npm run server- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support, email support@rewear.com or create an issue in the repository.