Coder Social home page Coder Social logo

irenaeus-xvi / e-commerce Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 281 KB

E-Commerce Project is a scalable and customizable platform for online businesses. It's built using Node.js, Express, and MongoDB.

Home Page: https://e-commerce-lezg.onrender.com

JavaScript 100.00%
authentication authorization bycrypt cloudinary dotenv expressjs global-error-handling joi-validation jsonwebtoken mongodb mongoose morgan multer nanoid nodejs nodemailer slugify qrcode-generator stripe-payments

e-commerce's Introduction

E-Commerce-App

E-Commerce Project is a scalable and customizable platform for online businesses. It's built using Node.js, Express, and MongoDB.

Getting Started

To get started with the E-Commerce backend, follow these steps:

  1. Clone the repository:

    git clone https://github.com/Irenaeus-XVI/E-Commerce.git
  2. Install dependencies:

    cd E-Commerce
    npm install
  3. Set up environment variables:

    Create a .env file in the root directory and add the necessary environment variables. You can use the provided .env.example as a template.

  4. Start the server:

    npm start

The server will start and listen on a specified port (default: 3000). You can access the API using tools like Postman or integrate it with your frontend application.

Configuration

MongoDB connection URLs

  • CONNECTIONURL: MongoDB connection URL for local development.
  • CONNECTIONURLONLINE: MongoDB connection URL for online deployment.

Application Mode

  • MODE: Application mode (dev, prod, etc.).

Security

  • SALT_ROUNDS: Number of salt rounds for bcrypt hashing.
  • SECRET_KEY_TOKEN: Secret key for generating JWT tokens.

Server Configuration

  • PORT: Port on which the server will run.

Stripe Integration

  • STRIPE_SECRET_KEY: Secret key for Stripe payment integration.

Web Hook Security

  • WEB_HOOK_SECRET_KEY: Secret key for securing web hooks.

Endpoints

User Authentication

  • Register a new user:

    • POST /api/v1/user/signup
  • Log in a user:

    • POST /api/v1/user/signin
  • Verify user email:

    • GET /api/v1/user/verify/:token

Product Management

  • Add a new product:

    • POST /api/v1/products/add
  • Update a product:

    • PUT /api/v1/products/:productId
  • Delete a product:

    • DELETE /api/v1/products/:productId
  • Get all products:

    • GET /api/v1/products

Shopping Cart

  • Add an item to the cart:

    • POST /api/v1/cart/add
  • Remove an item from the cart:

    • DELETE /api/v1/cart/remove/:itemId
  • Update item quantity in the cart:

    • PUT /api/v1/cart/update/:itemId
  • View shopping cart:

    • GET /api/v1/cart

Order Processing

  • Place an order:

    • POST /api/v1/orders/place
  • View order history:

    • GET /api/v1/orders/history

User Reviews and Ratings

  • Leave a review for a product:

    • POST /api/v1/products/:productId/reviews
  • View reviews for a product:

    • GET /api/v1/products/:productId/reviews

Search Functionality

  • Search for products:
    • GET /api/v1/products/search

User Account Dashboard

  • View user account information:
    • GET /api/v1/user/account

Admin Dashboard

  • View sales and analytics:
    • GET /api/v1/admin/dashboard

Global Error Handling and Status Codes

The application employs global error handling to ensure consistent error responses. HTTP status codes are utilized to indicate the nature of errors:

  • 404: Resource not found.
  • 400: Bad request - when the request is malformed or invalid.
  • 409: Conflict - when there is a conflict with the current state of the server (e.g., attempting to create a resource that already exists).
  • 500: Server error.

This approach helps maintain a standardized response format and enhances the user experience by providing meaningful error messages and appropriate HTTP status codes.

Technologies

Contributing

Contributions are welcome! If you find a bug or have a suggestion, feel free to open an issue or create a pull request.

License

This project is licensed under the MIT License.

e-commerce's People

Contributors

irenaeus-xvi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.