Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL E-commerce API

A full-featured GraphQL e-commerce API with product catalog, inventory management, orders, and reviews system.

image

Features

  • Product Management: Complete CRUD for products and categories
  • Advanced Filtering: Filter products by category, price range, and availability
  • Order System: Complete order lifecycle management
  • Review System: Product reviews and ratings
  • Inventory Tracking: Real-time inventory management

Quick Start

git clone
npm install
npm run dev

API Examples

Product Queries

# Search and filter products
query GetProducts($filter: ProductFilter) {
  products(filter: $filter) {
    id
    name
    price
    inventory
    category {
      name
    }
    reviews {
      rating
      comment
    }
  }
}

# Variables:
{
  "filter": {
    "categoryId": "1",
    "minPrice": 100,
    "maxPrice": 1000,
    "inStock": true
  }
}

Order Management

# Place new order
mutation PlaceOrder($input: PlaceOrderInput!) {
  placeOrder(input: $input) {
    id
    total
    status
    items {
      product {
        name
      }
      quantity
      price
    }
  }
}

# Update order status
mutation UpdateOrder($id: ID!, $status: OrderStatus!) {
  updateOrderStatus(id: $id, status: $status) {
    id
    status
  }
}

Product Management

# Add new product
mutation CreateProduct($input: CreateProductInput!) {
  createProduct(input: $input) {
    id
    name
    price
    inventory
  }
}

Business Logic Features

  • Inventory Validation: Prevents overselling
  • Price Calculation: Automatic total calculation
  • Order Status Flow: Enforces valid status transitions
  • Search Functionality: Full-text product search

Project Structure

graphql-ecommerce-api/
├── schema.graphql          # E-commerce type definitions
├── resolvers.js           # Business logic resolvers
├── server.js              # Server configuration
├── data/                  # Mock data (in production use DB)
│   ├── products.js
│   ├── categories.js
│   └── orders.js
├── package.json
└── README.md

Supported Operations

  • ✅ Product catalog browsing
  • ✅ Advanced product filtering
  • ✅ Order creation and management
  • ✅ Inventory management
  • ✅ Product reviews and ratings
  • ✅ Category management
  • ✅ Search functionality


✨ Author

Saad Abdur Razzaq
Machine Learning Engineer | Effixly AI

LinkedIn Email Website GitHub



About

A full-featured GraphQL e-commerce API with product catalog, inventory management, orders, and reviews system.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages