Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Full-stack e-commerce platform built using the MERN stack (MongoDB, Express, React, Node.js) with JWT authentication, Redux state management, RESTful API backend, and Vercel deployment for both frontend and backend.

Notifications You must be signed in to change notification settings

chaman2003/peakhive

Repository files navigation

PeakHive πŸ”οΈ

React Bootstrap Vite React Router MongoDB Express Node.js Vercel

A premium tech e-commerce platform built with the MERN stack (MongoDB, Express, React, Node.js), featuring a responsive design and comprehensive shopping experience.

🌐 Live Demo

PeakHive Screenshot

πŸ“‹ Table of Contents

✨ Features

  • Responsive Design: Works seamlessly on mobile, tablet, and desktop devices
  • Consistent UI: Built with Bootstrap components for a cohesive user experience
  • Interactive Elements: Dynamic hover effects and transitions
  • Comprehensive E-commerce Flow: From product browsing to checkout
  • User Authentication: Login and signup functionality with JWT
  • User Profiles: Account management and order history
  • Cart System: Add, remove, and update product quantities
  • Admin Dashboard: Manage products, orders, and users
  • Payment Processing: Secure checkout process
  • Order Management: Track order status and history
  • Product Reviews: Leave and view product reviews

πŸ“ Project Structure

PeakHive/
β”œβ”€β”€ public/                # Static assets
β”œβ”€β”€ src/                   # Frontend application code
β”‚   β”œβ”€β”€ api/               # API service layer
β”‚   β”œβ”€β”€ assets/            # Application-specific assets
β”‚   β”œβ”€β”€ components/        # Reusable UI components
β”‚   β”œβ”€β”€ pages/             # Route-specific page components
β”‚   β”‚   β”œβ”€β”€ admin/         # Admin dashboard pages
β”‚   β”œβ”€β”€ redux/             # State management
β”‚   β”‚   β”œβ”€β”€ slices/        # Redux slices
β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”œβ”€β”€ App.jsx            # Main application component and routing
β”‚   └── main.jsx           # Application entry point
β”œβ”€β”€ server/                # Backend application code
β”‚   β”œβ”€β”€ controllers/       # API route controllers
β”‚   β”œβ”€β”€ middleware/        # Express middleware
β”‚   β”œβ”€β”€ models/            # MongoDB models
β”‚   β”œβ”€β”€ routes/            # API route definitions
β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”œβ”€β”€ server.js          # Server entry point
β”‚   └── vercel.json        # Vercel deployment configuration
β”œβ”€β”€ .env                   # Frontend environment variables
β”œβ”€β”€ server/.env            # Backend environment variables
└── package.json           # Project dependencies and scripts

πŸ“± Pages

Page Description
Home Landing page with hero section, featured categories, and promotional content
Products Product listing with filtering and sorting options
Product Detail Comprehensive product information, images, specs, and reviews
Login/Register User authentication with form validation
Cart Shopping cart with product listings, quantity adjustment, and price calculations
Checkout Order completion with shipping and payment information
Profile User account management and order history
Order History List of past orders with status and details
Order Details Detailed view of a specific order
Admin Dashboard Overview of store performance metrics
Admin Products Manage product listings (add, edit, delete)
Admin Orders Process and manage customer orders
Admin Users Manage user accounts and permissions
Admin Reviews Moderate product reviews

πŸš€ Getting Started

Prerequisites

  • Node.js (v14.0.0 or later)
  • npm or yarn
  • MongoDB account or local installation

Installation

  1. Clone the repository

    git clone https://github.com/chaman2003/PeakHive.git
    cd PeakHive
  2. Install frontend dependencies

    npm install
    # or
    yarn install
  3. Install backend dependencies

    cd server
    npm install
    # or
    yarn install
  4. Set up environment variables (see Environment Variables section)

  5. Start the backend development server

    cd server
    npm run dev
    # or
    yarn dev
  6. Start the frontend development server (in a new terminal)

    # From the root directory
    npm run dev
    # or
    yarn dev
  7. Open your browser and navigate to http://localhost:5173

πŸ” Environment Variables

Frontend (.env)

VITE_API_URL=http://localhost:5000/api  # Development
# VITE_API_URL=https://peakhive-backend.vercel.app/api  # Production
VITE_NODE_ENV=development  # or production

Backend (server/.env)

MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
NODE_ENV=development  # or production
PORT=5000

πŸš€ Deployment

The application is deployed on Vercel with separate projects for frontend and backend.

Frontend Deployment

  1. Push your code to GitHub
  2. Create a new project in Vercel
  3. Connect your GitHub repository
  4. Set the following settings:
    • Framework Preset: Vite
    • Build Command: npm run build
    • Output Directory: dist
    • Install Command: npm install
  5. Add environment variables:
    • VITE_API_URL=https://peakhive-backend.vercel.app/api
    • VITE_NODE_ENV=production
  6. Deploy

Backend Deployment

  1. Create a new project in Vercel
  2. Connect your GitHub repository
  3. Set the following settings:
    • Root Directory: server
    • Build Command: npm install
    • Output Directory: .
  4. Add environment variables:
    • MONGO_URI=your_mongodb_connection_string
    • JWT_SECRET=your_jwt_secret
    • NODE_ENV=production
  5. Deploy

Connecting Frontend and Backend

The frontend and backend are connected through API calls. The frontend's .env file or Vercel environment variables should have the VITE_API_URL pointing to the deployed backend API URL.

πŸ’» Technology Stack

Frontend

  • Framework: React 18
  • State Management: Redux Toolkit
  • UI Framework: Bootstrap 5
  • Routing: React Router v6
  • HTTP Client: Axios
  • Build Tool: Vite

Backend

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB with Mongoose ODM
  • Authentication: JWT (JSON Web Tokens)
  • File Upload: Multer
  • Validation: Express Validator

Deployment

  • Platform: Vercel
  • Database Hosting: MongoDB Atlas
  • Environment: Node.js (Serverless)

πŸ”Œ API Endpoints

Authentication

  • POST /api/users/login - User login
  • POST /api/users/register - User registration
  • GET /api/users/profile - Get user profile
  • PUT /api/users/profile - Update user profile

Products

  • GET /api/products - Get all products
  • GET /api/products/:id - Get single product
  • POST /api/products - Create a product (admin)
  • PUT /api/products/:id - Update a product (admin)
  • DELETE /api/products/:id - Delete a product (admin)

Orders

  • GET /api/orders - Get user orders
  • GET /api/orders/:id - Get order by ID
  • POST /api/orders - Create new order
  • PUT /api/orders/:id/pay - Update order to paid
  • PUT /api/orders/:id/deliver - Update order to delivered
  • GET /api/orders/admin - Get all orders (admin)
  • PUT /api/orders/:id/refund - Refund an order (admin)

Reviews

  • GET /api/reviews - Get all reviews
  • POST /api/products/:id/reviews - Create product review
  • DELETE /api/reviews/:id - Delete review (admin)

Users

  • GET /api/users - Get all users (admin)
  • GET /api/users/:id - Get user by ID (admin)
  • PUT /api/users/:id - Update user (admin)
  • DELETE /api/users/:id - Delete user (admin)

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

Built with ❀️ by Chammy :p

About

Full-stack e-commerce platform built using the MERN stack (MongoDB, Express, React, Node.js) with JWT authentication, Redux state management, RESTful API backend, and Vercel deployment for both frontend and backend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages