Skip to content

s8sankalp/Ecommerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-commerce Platform

A full-stack e-commerce application built with the MERN stack (MongoDB, Express.js, React, Node.js).

Features

  • User Authentication: Register, login, and user profile management
  • Product Management: Browse products, view details, search and filter
  • Shopping Cart: Add/remove items, update quantities
  • Order Management: Place orders, track order status
  • Admin Dashboard: Manage products, orders, and users
  • Responsive Design: Works on desktop and mobile devices

Tech Stack

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - Database
  • Mongoose - ODM for MongoDB
  • JWT - Authentication
  • bcryptjs - Password hashing
  • multer - File uploads

Frontend

  • React - UI library
  • TypeScript - Type safety
  • React Router - Client-side routing
  • Axios - HTTP client
  • React Icons - Icon library
  • CSS3 - Styling

Project Structure

E-commerce/
├── backend/                 # Backend API
│   ├── models/             # Database models
│   ├── routes/             # API routes
│   ├── middleware/         # Custom middleware
│   ├── server.js           # Main server file
│   └── package.json
├── frontend/               # React frontend
│   ├── src/
│   │   ├── components/     # Reusable components
│   │   ├── pages/          # Page components
│   │   ├── context/        # React context providers
│   │   ├── services/       # API services
│   │   ├── types/          # TypeScript type definitions
│   │   └── App.tsx         # Main app component
│   └── package.json
└── README.md

Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local installation or MongoDB Atlas)
  • npm or yarn

Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd E-commerce
  2. Install backend dependencies

    cd backend
    npm install
  3. Install frontend dependencies

    cd ../frontend
    npm install
  4. Set up environment variables

    Create a .env file in the backend directory:

    MONGODB_URI=mongodb://localhost:27017/ecommerce
    JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
    PORT=5001
  5. Start the servers

    Backend (Terminal 1):

    cd backend
    npm start

    Frontend (Terminal 2):

    cd frontend
    npm start
  6. Access the application

API Endpoints

Authentication

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login user
  • GET /api/auth/me - Get current user

Products

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

Orders

  • POST /api/orders - Create new order
  • GET /api/orders/myorders - Get user's orders
  • GET /api/orders/:id - Get order by ID
  • PUT /api/orders/:id/pay - Update order payment status
  • PUT /api/orders/:id/deliver - Update order delivery status

Users

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

Features in Detail

User Features

  • Registration & Login: Secure authentication with JWT tokens
  • Product Browsing: View products with search and filter options
  • Shopping Cart: Add items, update quantities, remove items
  • Checkout Process: Complete purchase with shipping and payment info
  • Order History: View past orders and track current orders
  • Profile Management: Update personal information

Admin Features

  • Product Management: Add, edit, and delete products
  • Order Management: View and update order statuses
  • User Management: View all users and manage accounts
  • Dashboard: Overview of sales, orders, and products

Contributing

  1. Fork the repository
  2. Create a 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

License

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

Acknowledgments

  • React team for the amazing framework
  • Express.js team for the web framework
  • MongoDB team for the database
  • All contributors and maintainers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors