Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

NhanPhamThanh-IT/Trendy-Shop

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

275 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ Trendy Shop

A modern full-stack e-commerce application built with React.js and Node.js, featuring a comprehensive shopping experience for customers, retailers, and administrators.

🌟 Features

For Customers

  • πŸ›’ Browse and search products
  • πŸ›οΈ Shopping cart management
  • πŸ’³ Secure checkout process
  • πŸ“¦ Order tracking
  • ⭐ Product reviews and ratings
  • πŸ‘€ User profile management

For Retailers

  • πŸ“Š Dashboard with sales analytics
  • πŸ“¦ Product management (CRUD operations)
  • 🎫 Voucher/discount management
  • πŸ“‹ Order management
  • πŸ“ˆ Sales reporting

For Administrators

  • πŸ‘₯ User management
  • πŸͺ Retailer management
  • πŸ“Š System analytics
  • πŸ› οΈ Platform administration

πŸš€ Tech Stack

Frontend

  • βš›οΈ React 18 - Modern React with hooks
  • 🎨 Tailwind CSS - Utility-first CSS framework
  • 🎭 Material-UI - React component library
  • 🐜 Ant Design - Enterprise UI components
  • πŸ“Š Chart.js - Data visualization
  • 🚦 React Router - Client-side routing
  • πŸ“‘ Axios - HTTP client
  • ⚑ Vite - Fast build tool

Backend

  • 🟒 Node.js - JavaScript runtime
  • πŸš€ Express.js - Web framework
  • πŸƒ MongoDB - NoSQL database
  • 🦭 Mongoose - MongoDB object modeling
  • πŸ” JWT - Authentication
  • πŸ”’ bcrypt - Password hashing
  • 🌐 CORS - Cross-origin resource sharing

πŸ“ Project Structure

Trendy-Shop/
β”œβ”€β”€ backend/                 # Node.js Express API
β”‚   β”œβ”€β”€ config/             # Database configuration
β”‚   β”œβ”€β”€ controllers/        # Route controllers
β”‚   β”œβ”€β”€ models/             # Database models
β”‚   β”œβ”€β”€ routes/             # API routes
β”‚   β”œβ”€β”€ middleware.js       # Custom middleware
β”‚   └── server.js           # Entry point
β”œβ”€β”€ frontend/               # React application
β”‚   β”œβ”€β”€ public/             # Static assets
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ auth/           # Authentication components
β”‚   β”‚   β”œβ”€β”€ components/     # Reusable components
β”‚   β”‚   β”œβ”€β”€ context/        # React context providers
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ routes/         # Route configuration
β”‚   β”‚   └── services/       # API service layer
β”‚   └── package.json
└── README.md

πŸ› οΈ Installation & Setup

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (local or cloud instance)
  • npm or yarn package manager

Backend Setup

  1. Navigate to the backend directory:

    cd backend
  2. Install dependencies:

    npm install
  3. Create a .env file in the backend directory:

    DB_URL=mongodb://localhost:27017/trendy-shop
    JWT_SECRET=your_jwt_secret_key
    PORT=5000
  4. Start the backend server:

    npm start

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

Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Create a .env file in the frontend directory:

    VITE_API_URL=http://localhost:5000/api
  4. Start the development server:

    npm run dev

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

πŸ”Œ API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • POST /api/auth/logout - User logout

Products

  • GET /api/products - Get all products
  • GET /api/products/:id - Get product by ID
  • POST /api/products - Create new product (Retailer)
  • PUT /api/products/:id - Update product (Retailer)
  • DELETE /api/products/:id - Delete product (Retailer)

Orders

  • GET /api/orders - Get user orders
  • POST /api/orders - Create new order
  • PUT /api/orders/:id - Update order status

Categories

  • GET /api/categories - Get all categories
  • POST /api/categories - Create category (Admin)

Users

  • GET /api/users/profile - Get user profile
  • PUT /api/users/profile - Update user profile

🎯 User Roles

Customer

  • Browse products and categories
  • Manage shopping cart
  • Place and track orders
  • Leave product reviews

Retailer

  • Manage product inventory
  • View sales analytics
  • Process orders
  • Create discount vouchers

Admin

  • Manage all users and retailers
  • System-wide analytics
  • Platform configuration

πŸ” Authentication

The application uses JWT (JSON Web Tokens) for authentication. Tokens are stored in localStorage and included in API requests via Authorization headers.

πŸ“± Responsive Design

The application is fully responsive and works seamlessly across:

  • πŸ’» Desktop computers
  • πŸ“± Mobile devices
  • πŸ“Š Tablets

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the ISC License.

πŸ‘¨β€πŸ’» Author

NhanPhamThanh-IT

πŸ™ Acknowledgments

  • React.js community for excellent documentation
  • Tailwind CSS for the utility-first approach
  • MongoDB for the flexible database solution
  • All contributors and users of this project

⭐ Star this repository if you find it helpful!

About

A modern e-commerce application built with React.js frontend and Node.js/Express backend. Features multi-role authentication (Admin/Retailer/Customer), product management, order processing, voucher system, and analytics dashboards. Uses MongoDB, JWT auth, and Tailwind CSS.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages

  • JavaScript 99.2%
  • Other 0.8%