Skip to content

Latest commit

Β 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ Full-Stack Ecommerce Platform

A modern, full-stack ecommerce application built with React, Node.js, and MongoDB. This platform includes a customer-facing store, admin dashboard, and robust backend API with payment integration.

🌟 Features

πŸ›οΈ Customer Features

  • Product Browsing: Browse products with categories and search functionality
  • Shopping Cart: Add/remove items with real-time updates
  • User Authentication: Secure login/registration system
  • Order Management: Track order history and status
  • Payment Integration: Support for Razorpay and Stripe payments
  • Responsive Design: Mobile-friendly interface with Tailwind CSS

πŸ‘¨β€πŸ’Ό Admin Features

  • Product Management: Add, edit, and delete products
  • Order Management: View and manage customer orders
  • Image Upload: Cloudinary integration for product images
  • Dashboard: Comprehensive admin panel

πŸ”§ Technical Features

  • RESTful API: Well-structured backend with Express.js
  • Database: MongoDB with Mongoose ODM
  • Authentication: JWT-based authentication
  • File Upload: Multer for handling file uploads
  • Cloud Storage: Cloudinary for image management
  • Payment Gateway: Multiple payment options

πŸ—οΈ Project Structure

Full-stack-ecommerce/
β”œβ”€β”€ πŸ“ Backend/                 # Node.js API Server
β”‚   β”œβ”€β”€ πŸ“ config/             # Database and service configurations
β”‚   β”œβ”€β”€ πŸ“ controllers/        # Business logic controllers
β”‚   β”œβ”€β”€ πŸ“ middleware/         # Authentication and validation
β”‚   β”œβ”€β”€ πŸ“ models/            # MongoDB schemas
β”‚   β”œβ”€β”€ πŸ“ routes/            # API routes
β”‚   └── πŸ“„ server.js          # Main server file
β”œβ”€β”€ πŸ“ Frontend/               # Customer-facing React app
β”‚   β”œβ”€β”€ πŸ“ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“ components/    # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ πŸ“ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ πŸ“ context/       # React context for state management
β”‚   β”‚   └── πŸ“ assets/        # Images and static files
β”‚   └── πŸ“„ package.json
β”œβ”€β”€ πŸ“ admin/                  # Admin dashboard React app
β”‚   β”œβ”€β”€ πŸ“ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“ components/    # Admin-specific components
β”‚   β”‚   └── πŸ“ pages/         # Admin pages
β”‚   └── πŸ“„ package.json
└── πŸ“„ README.md

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB Atlas account or local MongoDB
  • Cloudinary account (for image storage)
  • Razorpay/Stripe account (for payments) - Optional: Code is ready but keys not configured

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/Full-stack-ecommerce.git
    cd Full-stack-ecommerce
  2. Backend Setup

    cd Backend
    npm install

    Create a .env file in the Backend directory:

    MONGODB_URI=your_mongodb_connection_string
    JWT_SECRET=your_jwt_secret_key
    CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
    CLOUDINARY_API_KEY=your_cloudinary_api_key
    CLOUDINARY_API_SECRET=your_cloudinary_api_secret
    RAZORPAY_KEY_ID=your_razorpay_key_id
    RAZORPAY_KEY_SECRET=your_razorpay_key_secret
    STRIPE_SECRET_KEY=your_stripe_secret_key
  3. Frontend Setup

    cd ../Frontend
    npm install

    Create a .env file in the Frontend directory:

    VITE_BACKEND_URL=http://localhost:4000
  4. Admin Setup

    cd ../admin
    npm install

    Create a .env file in the admin directory:

    VITE_BACKEND_URL=http://localhost:4000

Running the Application

  1. Start the Backend Server

    cd Backend
    npm run server

    Server will run on http://localhost:4000

  2. Start the Frontend (Customer App)

    cd Frontend
    npm run dev

    App will run on http://localhost:5173

  3. Start the Admin Dashboard

    cd admin
    npm run dev

    Admin panel will run on http://localhost:5174

πŸ› οΈ Tech Stack

Frontend

  • React 19 - UI library
  • Vite - Build tool and dev server
  • Tailwind CSS - Styling framework
  • React Router DOM - Client-side routing
  • Axios - HTTP client
  • React Toastify - Notifications

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - Database
  • Mongoose - ODM for MongoDB
  • JWT - Authentication
  • Bcrypt - Password hashing
  • Multer - File upload handling
  • Cloudinary - Image storage
  • Razorpay & Stripe - Payment gateways (Code implemented, keys not configured)

πŸ“± API Endpoints

Authentication

  • POST /api/user/register - User registration
  • POST /api/user/login - User login

Products

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

Cart

  • GET /api/cart/:userId - Get user's cart
  • POST /api/cart/add - Add item to cart
  • PUT /api/cart/update - Update cart item
  • DELETE /api/cart/remove - Remove item from cart

Orders

  • GET /api/order/:userId - Get user's orders
  • POST /api/order/place - Place new order
  • PUT /api/order/:id - Update order status (Admin)

🎨 Key Features Implementation

πŸ” Authentication System

  • JWT-based authentication
  • Password hashing with bcrypt
  • Protected routes for admin functions

πŸ’³ Payment Integration

  • Multiple payment gateways (Razorpay & Stripe)
  • Note: Payment gateway code is implemented but API keys are not configured
  • To enable payments, add your Razorpay/Stripe keys to the .env file
  • Secure payment processing
  • Order confirmation system

πŸ“Έ Image Management

  • Cloudinary integration for image storage
  • Multiple image upload support
  • Automatic image optimization

πŸ›’ Shopping Cart

  • Real-time cart updates
  • Persistent cart storage
  • Quantity management

πŸ§ͺ Testing

Manual Testing

The application includes comprehensive test scenarios for:

  • User authentication flows
  • Product management operations
  • Cart functionality
  • Order processing
  • Payment integration
  • Admin dashboard features

Test Data

Initial test data includes:

  • Sample products with various categories
  • Test user accounts
  • Sample orders for testing

πŸš€ Deployment

Backend Deployment

  1. Deploy to platforms like Heroku, Railway, or DigitalOcean
  2. Set up MongoDB Atlas for production database
  3. Configure environment variables
  4. Set up Cloudinary for image storage

Frontend Deployment

  1. Build the production version: npm run build
  2. Deploy to Vercel, Netlify, or similar platforms
  3. Configure environment variables for production

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

πŸ“ License

This project is licensed under the ISC License.

πŸ‘₯ Authors

πŸ™ Acknowledgments

  • React team for the amazing framework
  • MongoDB for the database solution
  • Cloudinary for image management
  • Payment gateway providers (Razorpay & Stripe)

πŸ“ž Support

If you have any questions or need help, please:


⭐ Star this repository if you found it helpful!

Releases

Packages

Contributors

Languages