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.
- Introduction
- User Interface
- Features
- Technologies Used
- Getting Started
- Project Structure
- Running the Application
- Deployment
- Contributing
- License
- Creator
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.
-
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.
-
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)
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
Before running this project, ensure you have the following installed:
- Node.js (with npm)
- MongoDB (with either local or remote instance)
- Git
-
Clone the repository:
git clone https://github.com/hoangsonww/fullstack-ecommerce.git cd fullstack-ecommerce
-
Install project dependencies:
# Install server dependencies cd backend npm install # Install client (frontend) dependencies cd .. npm install
-
Set up the backend:
-
Create a
.env
file in thebackend/
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
-
-
Set up the frontend:
- First,
cd
into theroot
directory if you are not already there:Orcd ..
cd fullstack-ecommerce
- Start the frontend development server:
npm start
- First,
- Open your browser and navigate to
http://localhost:3000
to view the application.
- 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.
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).
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.
This project is licensed under the MIT License - see the LICENSE file for details.
- Son Nguyen - hoangsonww
- Email: [email protected]
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! π