{"id":25149279,"url":"https://github.com/jawherkl/graphql-nodejs-ecom","last_synced_at":"2025-04-28T14:48:49.306Z","repository":{"id":269815802,"uuid":"865457739","full_name":"JawherKl/graphql-nodejs-ecom","owner":"JawherKl","description":"A GraphQL-based e-commerce API built with Node.js for efficient product, order, and user management.","archived":false,"fork":false,"pushed_at":"2025-01-17T15:55:26.000Z","size":95,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T10:41:31.089Z","etag":null,"topics":["express","graphql","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JawherKl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-30T15:03:55.000Z","updated_at":"2025-03-29T13:45:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"785cda0e-1425-4642-8e50-902847a23664","html_url":"https://github.com/JawherKl/graphql-nodejs-ecom","commit_stats":null,"previous_names":["jawherkl/graphql-nodejs-ecom"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fgraphql-nodejs-ecom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fgraphql-nodejs-ecom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fgraphql-nodejs-ecom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fgraphql-nodejs-ecom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JawherKl","download_url":"https://codeload.github.com/JawherKl/graphql-nodejs-ecom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251334119,"owners_count":21572948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","graphql","nodejs"],"created_at":"2025-02-08T21:20:19.553Z","updated_at":"2025-04-28T14:48:49.281Z","avatar_url":"https://github.com/JawherKl.png","language":"JavaScript","readme":"### Project: **E-Commerce GraphQL API**\n\n#### Core Features:\n1. **Product Management**:\n   - Query: Fetch a list of products with filtering, sorting, and pagination options.\n   - Mutation: Add, update, or delete a product.\n   - Fields: `id`, `name`, `description`, `price`, `category`, `stock`, `images`.\n\n2. **User Authentication**:\n   - Mutation: Register a user, log in, and log out.\n   - Query: Fetch the current authenticated user's details.\n   - Fields: `id`, `username`, `email`, `token`.\n\n3. **Shopping Cart**:\n   - Query: Fetch items in the cart for the authenticated user.\n   - Mutation: Add an item to the cart, remove an item, update quantities.\n   - Fields: `id`, `productId`, `quantity`, `price`.\n\n4. **Orders**:\n   - Query: Fetch a user’s order history.\n   - Mutation: Create an order (checkout).\n   - Fields: `id`, `products`, `total`, `status`, `createdAt`.\n\n5. **Reviews**:\n   - Query: Fetch reviews for a product.\n   - Mutation: Add, edit, or delete a review.\n   - Fields: `id`, `userId`, `productId`, `rating`, `comment`, `createdAt`.\n\n#### Advanced Features:\n1. **Real-Time Updates**:\n   - Subscription: Notify users about product stock updates or order status changes.\n\n2. **Dynamic Pricing**:\n   - Query: Calculate discounts or special offers dynamically during checkout.\n\n3. **Recommendations**:\n   - Query: Fetch product recommendations based on user purchase history.\n\n#### Tech Stack:\n- **Node.js**: Backend runtime.\n- **Apollo Server**: GraphQL implementation for building the API.\n- **MongoDB**: Database for storing products, users, orders, and reviews.\n- **JWT**: Authentication and authorization.\n\n#### Folder Structure:\n```\ngraphql-nodejs-ecommerce/\n├── src/\n│   ├── schema/\n│   │   ├── typeDefs.js  # Define GraphQL schema\n│   │   └── resolvers.js # Implement resolvers\n│   ├── models/\n│   │   ├── Product.js\n│   │   ├── User.js\n│   │   ├── Order.js\n│   │   └── Review.js\n│   ├── services/\n│   │   ├── authService.js\n│   │   └── productService.js\n│   └── index.js         # Entry point\n├── package.json\n└── .env\n```\n\n### Testing the Application:\nRun the following mutations/queries in Apollo Studio or Postman to test:\n\n#### **Register a User**\n```graphql\nmutation {\n  register(name: \"Jhon Doe\", email: \"jhon@example.com\", password: \"securepassword\", role: \"admin\") {\n    user {\n      id\n      name\n      email\n      role\n    }\n    token\n  }\n}\n```\n\n#### **Login a User**\n```graphql\nmutation {\n  login(email: \"john@example.com\", password: \"securepassword\") {\n    user {\n      id\n      name\n    }\n    token\n  }\n}\n```\n\n#### **Create a Product**\nInclude the token in the header (`Authorization: Bearer \u003ctoken\u003e`):\n```graphql\nmutation {\n  createProduct(name: \"Product A\", description: \"Description A\", price: 19.99) {\n    id\n    name\n    price\n  }\n}\n```\n### Command Execution:\n`npm install`\n\n`npm run start` or\n`npm run dev` or\n`npm run test`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawherkl%2Fgraphql-nodejs-ecom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjawherkl%2Fgraphql-nodejs-ecom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawherkl%2Fgraphql-nodejs-ecom/lists"}