Giter Site home page Giter Site logo

inventory-management-system's Introduction

Inventory Management System

Deployed API URL

API

Published Documentation

Documentation

Postman Collection URL

Postman_Collection

Overview

This is an Inventory and Cart Management System built using Node.js and Express. It provides functionalities to manage customers, inventory items, discounts, and customer carts. The project utilizes JSON files to persist data and ensures consistent state management across different operations.

Features

  • Customer management (sign up, login, authentication)
  • Inventory management (add, remove items)
  • Cart management (add items to cart, view cart, get total value of cart)
  • Discount management (create and apply discounts)
  • JSON-based data storage
  • Authentication using bearer tokens

Project Structure

├── controllers # Controller logic for different entities
│ ├── customerController.js # Handles customer authentication
│ ├── cartController.js # Manages cart operations
│ ├── discountController.js # Manages discount operations
│ └── inventoryController.js # Manages inventory operations

├── data # JSON files for data storage
│ ├── cart.json # Stores cart information
│ ├── customers.json # Stores customer information
│ ├── discounts.json # Stores discount information
│ └── inventory.json # Stores inventory information

├── models # Data models
│ ├── Cart.js # Cart model
│ ├── Customer.js # Customer model
│ ├── Discount.js # Discount model
│ └── Inventory.js # Inventory model

├── routes # API routes
│ ├── customerRoutes.js # Routes for authentication
│ ├── cartRoutes.js # Routes for cart operations
│ ├── discountRoutes.js # Routes for discount operations
│ └── inventoryRoutes.js # Routes for inventory operations

├── utils # Utility functions
│ ├── appError.js # Custom error handling
│ ├── catchAsync.js # Async error handling
│ ├── jsonOp.js # JSON file operations

├── app.js # Application setup
└── server.js # Server setup and configuration

Getting Started

Prerequisites

  • Node.js installed on your machine

Installation

  1. Clone the repository:
    git clone <repository-url>
  2. Navigate to the project directory:
    cd inventory-cart-management
  3. Install the dependencies:
    npm install

Running the Application

  1. Start the server:
    npm start
  2. The server will start on http://localhost:3000

API Endpoints

Auth Routes

  • POST /customer: Sign up a new customer
  • POST /customer/login: Login an existing customer

Inventory Routes

  • POST /inventory: Add a new inventory item - Name, type and quantity is required
  • DELETE /inventory: Remove an inventory item - productId and quantity is required

Cart Routes

  • POST /cart: Add an item to the cart
  • GET /cart: Get the current cart of the logged-in customer

Discount Routes

  • POST /discount: Create a new discount
  • POST /discount/apply: Apply a discount to the cart

Authentication

This project uses bearer tokens for authentication. Include the token in the Authorization header as Bearer <token> for protected routes.

JSON Data Files

  • cart.json: Stores cart information
  • customers.json: Stores customer information
  • discounts.json: Stores discount information
  • inventory.json: Stores inventory information

Utility Functions

  • jsonOp.js: Provides functions to read and write JSON files
  • tokenUtils.js: Provides functions to generate and verify JWT tokens
  • appError.js: Custom error handling
  • catchAsync.js: Utility to catch errors in async functions

inventory-management-system's People

Contributors

varadut1 avatar

Stargazers

Om Tekade 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.