Skip to content

paultechh/ecommerce-store-backend

Repository files navigation

Grocery MERN Stack Project

Welcome to our Grocery project built on the MERN (MongoDB, Express.js, React.js, Node.js) stack! My goal is to develop an e-commerce platform catering to grocery enthusiasts, providing a seamless browsing and purchasing experience.

Features

  • User Authentication: Users can sign up, log in, and log out securely.
  • Product Catalog: Browse through a wide range of fashion items.
  • Product Details: View detailed information about each product.
  • Shopping Cart: Add and remove items from the shopping cart.
  • Checkout Process: Securely purchase items using various payment methods.
  • Admin Panel: Admins can manage products, users, and orders.
  • Responsive Design: The application is responsive and works seamlessly across devices.

Technologies Used

  • MongoDB: NoSQL database for storing product, user, and order data.
  • Express.js: Backend framework for building the RESTful API.
  • React.js: Frontend library for building user interfaces.
  • Node.js: JavaScript runtime environment for running server-side code.
  • Redux: State management library for managing application state.
  • Bootstrap: Frontend framework for responsive design and UI components.
  • JWT: JSON Web Tokens for user authentication.
  • Stripe: Payment processing platform for handling transactions.
  • Multer: Middleware for handling file uploads.
  • bcrypt: Library for hashing passwords.

Installation

Project Structure The project is divided into two main directories: frontend and backend.

frontend: Contains the React.js client-side code for the user interface. backend: Contains the Express.js server-side code and the MongoDB database integration.

Frontend Installation

Navigate to the frontend directory: cd frontend Install the dependencies: npm install

Development Server To start the development server, run:

npm start This will start the React development server and open the application in your default web browser. Any changes you make to the source files will automatically trigger a hot reload. Build for Production To create a production build, run:

npm run build This will create an optimized production build in the build folder. Backend Installation

Navigate to the backend directory: cd backend

Install the dependencies: npm install

Development Server To start the development server, run: Sure, here's a well-documented README file for a grocery app built with the MERN stack (MongoDB, Express.js, React.js, and Node.js). This README file includes instructions for setting up the project, running the development server, and deploying the application. markdownCopy code# Grocery App

This is a full-stack web application for managing a grocery store. It allows users to browse and purchase grocery items, view their cart, and complete orders. The application is built using the MERN stack (MongoDB, Express.js, React.js, and Node.js).

Table of Contents

Getting Started

To get a local copy of the project up and running, follow these steps:

  1. Clone the repository:

    git clone https://github.com/your-username/grocery-app.git
    

Navigate to the project directory: bashCopy codecd grocery-app

Project Structure The project is divided into two main directories: frontend and backend.

frontend: Contains the React.js client-side code for the user interface. backend: Contains the Express.js server-side code and the MongoDB database integration.

Frontend Installation

Navigate to the frontend directory: bashCopy codecd frontend

Install the dependencies: bashCopy codenpm install

Development Server To start the development server, run: bashCopy codenpm start This will start the React development server and open the application in your default web browser. Any changes you make to the source files will automatically trigger a hot reload. Build for Production To create a production build, run: bashCopy codenpm run build This will create an optimized production build in the build folder. Backend Installation

Navigate to the backend directory: bashCopy codecd backend

Install the dependencies: bashCopy codenpm install

Development Server To start the development server, run: bashCopy codenpm start This will start the Express.js server and connect to the MongoDB database. API Endpoints The following API endpoints are available:

GET /api/products: Retrieve a list of all products POST /api/orders: Create a new order GET /api/orders: Retrieve a list of all orders PUT /api/orders/:id: Update an existing order

Deployment To deploy the application, you need to build the React.js client and serve the static files along with the Express.js server.

Build the React.js client: cd frontend npm run build

Copy the build folder contents to the backend/public directory. Start the Express.js server: cd ../backend npm start The Express.js server will serve the static files from the public directory and handle API requests.

  1. Set up environment variables:

    • Create a .env file in the root directory.
    • Define the following variables:
      • MONGO_URI: MongoDB connection URI.
      • JWT_SECRET: Secret key for JWT authentication.
      • STRIPE_SECRET_KEY: Stripe secret key for payment processing.
  2. Start the development server: npm run dev or yarn

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published