Skip to content

πŸ›’ Welcome to Fusion Electronics - a full-stack, lightweight, and modern online e-commerce application, built with the MERN (MongoDB, Express, React, Node.js) stack!

License

Notifications You must be signed in to change notification settings

xinhxinhh/Fullstack-Ecommerce-Website

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fusion Electronics: A MERN-Stack E-commerce Application

Welcome to Fusion Electronics, a MERN-Stack E-commerce Application! This project is a working demo of a full-stack web application that was built using the MERN stack (MongoDB, Express.js, React.js, Node.js). It aims to provide a comprehensive example of building a modern e-commerce platform, covering frontend user interface, backend server logic, database management, and integration with third-party libraries.

Table of Contents

  1. Introduction
  2. User Interface
  3. Features
  4. Technologies Used
  5. Getting Started
  6. Project Structure
  7. Running the Application
  8. Deployment
  9. Contributing
  10. License
  11. Creator

Introduction

This project is a demonstration of building an e-commerce application using the MERN stack, which consists of MongoDB (database), Express.js (server), React.js (frontend), and Node.js (runtime environment). The application allows users to browse products, add them to a shopping cart, proceed to checkout, and simulate the order processing. It includes basic validations for user inputs and simulates the checkout process on the backend.

User Interface

Home Page

The MovieVerse App Interface

Full Product List

The MovieVerse App Interface

Cart Page

The MovieVerse App Interface

Checkout Page

The MovieVerse App Interface

Order Confirmation

The MovieVerse App Interface

Features

  • Product Management:

    • View a list of products.
    • View detailed product information.
    • Add products to the shopping cart.
  • Shopping Cart:

    • View items in the shopping cart.
    • Remove items from the cart.
    • Calculate total amount of items in the cart.
  • Checkout Process:

    • Enter billing, shipping, and payment information.
    • Simulate the order creation process on the backend.
    • Receive confirmation of order success.

Technologies Used

  • Frontend:

    • React.js
    • Material-UI for styling
    • Axios for API requests
    • react-credit-cards-2 for credit card visualization
  • Backend:

    • Node.js
    • Express.js
    • MongoDB (with Mongoose ODM)
    • Axios for external API requests
  • Development Tools:

    • Jetbrains WebStorm (IDE)
    • Postman (for API testing)
    • Git (version control)
    • npm (package manager)

Project Structure

The project is organized into two main "stacks": The backend is in the backend directory that hosts all product & order data and the frontend is in the root directory. Here is an overview of the project structure:

fullstack-ecommerce/
β”œβ”€β”€ backend/                    # Node.js server files
β”‚   β”œβ”€β”€ config/                 # Configuration files
β”‚   β”‚   β”œβ”€β”€ db.js               # Database connection
β”‚   β”œβ”€β”€ models/                 # Mongoose models
β”‚   β”‚   β”œβ”€β”€ product.js          # Product schema
β”‚   β”œβ”€β”€ routes/                 # Route handlers
β”‚   β”‚   β”œβ”€β”€ products.js         # Product routes
β”‚   β”‚   β”œβ”€β”€ search.js           # Search routes
β”‚   β”‚   β”œβ”€β”€ checkout.js         # Checkout routes
β”‚   β”œβ”€β”€ seed/                   # Database seed data
β”‚   β”‚   β”œβ”€β”€ products.js         # Product seed data
β”‚   β”œβ”€β”€ .env                    # Environment variables
β”‚   β”œβ”€β”€ index.js                # Server entry point
β”œβ”€β”€ public/                     # Public assets
β”‚   β”œβ”€β”€ index.html              # HTML template
β”‚   β”œβ”€β”€ manifest.json           # Web app manifest
β”‚   β”œβ”€β”€ favicon.ico             # Favicon
β”œβ”€β”€ src/                        # React.js frontend files
β”‚   β”œβ”€β”€ components/              # Reusable components
β”‚   β”œβ”€β”€ dev/                     # Development utilities
β”‚   β”œβ”€β”€ pages/                   # Page components
β”‚   β”œβ”€β”€ App.jsx                  # Main application component
β”‚   β”œβ”€β”€ App.css                  # Main application styles
β”‚   β”œβ”€β”€ index.js                 # React entry point
β”‚   .gitignore                   # Git ignore file
β”‚   package.json                 # NPM package file
β”‚   jsconfig.json                # JS config file
β”‚   setupProxy.js                # Proxy configuration

Getting Started

Prerequisites

Before running this project, ensure you have the following installed:

  • Node.js (with npm)
  • MongoDB (with either local or remote instance)
  • Git

Installation

  1. Clone the repository:

    git clone https://github.com/hoangsonww/fullstack-ecommerce.git
    cd fullstack-ecommerce
  2. Install project dependencies:

    # Install server dependencies
    cd backend
    npm install
    
    # Install client (frontend) dependencies
    cd ..
    npm install
  3. Set up the backend:

    • Create a .env file in the backend/ directory and add the following environment variables:

      MONGO_URI=mongodb://localhost:27017/Ecommerce-Products
      
    • Ensure that your MongoDB server is running. If you're using Mac, you can start the MongoDB server with the following command:

    brew services start mongodb-community
    • Seed the database with sample data:

      cd backend/seed
      node productSeeds.js
    • Run the backend server: (first cd into the backend directory)

      cd ..
      npm start
  4. Set up the frontend:

    • First, cd into the root directory if you are not already there:
      cd ..
      Or
      cd fullstack-ecommerce
    • Start the frontend development server:
      npm start

Running the Application

  • Open your browser and navigate to http://localhost:3000 to view the application.

Testing the APIs

  • Simply open your browser and navigate to http://localhost:5000/api/products to view the list of products.
  • You can also change the sample data by navigating to backend/seed/productSeeds.js and modifying the data there.

Deployment

To deploy the application:

  • Configure deployment settings for both frontend (React) and backend (Node.js) according to your chosen hosting provider (e.g., AWS, Heroku, Netlify).

Contributing

Contributions to this project are welcome! Here are some ways you can contribute:

  • Report bugs and request features by opening issues.
  • Implement new features or enhancements and submit pull requests.
  • Improve documentation and README files.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Creator


Thank you for exploring Fusion Electronics - a MERN Stack E-commerce Application! If you have any questions or feedback, feel free to reach out and contribute to making this project even better. Happy coding! πŸš€

About

πŸ›’ Welcome to Fusion Electronics - a full-stack, lightweight, and modern online e-commerce application, built with the MERN (MongoDB, Express, React, Node.js) stack!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.1%
  • CSS 2.1%
  • HTML 1.8%