{"id":49611429,"url":"https://github.com/permaficus/lef4cart","last_synced_at":"2026-05-04T17:35:45.632Z","repository":{"id":230417107,"uuid":"746993070","full_name":"permaficus/lef4cart","owner":"permaficus","description":"Shopping cart with RESTFul API and Message Broker","archived":false,"fork":false,"pushed_at":"2024-05-20T14:47:49.000Z","size":143,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-22T04:27:09.774Z","etag":null,"topics":["api","e-commerce","event-driven-architecture","express-js","microservices","nodejs","rabbitmq","rest-api","shopping-cart","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/permaficus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-01-23T03:29:34.000Z","updated_at":"2024-05-20T14:47:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"7240b722-e16c-47b0-81db-1de621471566","html_url":"https://github.com/permaficus/lef4cart","commit_stats":null,"previous_names":["permaficus/lef4cart"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/permaficus/lef4cart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permaficus%2Flef4cart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permaficus%2Flef4cart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permaficus%2Flef4cart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permaficus%2Flef4cart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/permaficus","download_url":"https://codeload.github.com/permaficus/lef4cart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permaficus%2Flef4cart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32618133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","e-commerce","event-driven-architecture","express-js","microservices","nodejs","rabbitmq","rest-api","shopping-cart","typescript"],"created_at":"2026-05-04T17:35:43.833Z","updated_at":"2026-05-04T17:35:45.624Z","avatar_url":"https://github.com/permaficus.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LEF4CART\n\n## Overview\n\nLef4Cart is a micro shopping cart app that is FREE and open source. One of its standout features is the use of RabbitMQ as a message broker. Additionally, Lef4Cart uses the standard HTTP protocol for data transmission\n\n\u003cdetails\u003e\n\u003csummary\u003eSee environment example\u003c/summary\u003e\n\n## ENVIRONMENT EXAMPLE\n\n```shell\n# USING AT DOCKER CONTAINER\nDATABASE_URL=\"mongodb://username:password@host.docker.internal:27017/shoppingCart?retryWrites=true\u0026authSource=admin\u0026directConnection=true\"\n# USING AT LOCALHOST\nDATABASE_URL=\"mongodb://username:password@localhost:27017/shoppingCart?retryWrites=true\u0026authSource=admin\u0026directConnection=true\"\n## APP ENV\nNODE_ENV=\"DEVELOPMENT\"\n\n## RABBITMQ ENV\nRBMQ_URL=\"amqp://username:password@localhost:5672\"\n# CONFIG FOR CONSUMER\nRBMQ_CART_EXCHANGE=\"lef4cart\"\nRBMQ_CART_QUEUE=\"sub.cartMessageQueue\"\nRBMQ_CART_ROUTING_KEY=\"cartMessageRoutingKey\"\n# CONFIG FOR PUBLISHER\nRBMQ_PUB_QUEUE=\"pub.cartMessageQueue\"\nRBMQ_PUB_ROUTING_KEY=\"pub.MessageRouting\"\n## LOCAL SERVICE ENV\nSERVICE_LOCAL_PORT=\"8081\"\n\n## DOCKER ENV\nCOMPOSE_PROJECT_NAME=\"shopping-cart\"\n\n```\n\u003c/details\u003e\n\n## API\n\nEndpoint :\n\n* `/v1/shopping-cart` : method would be `POST, PATCH, DELETE`\n* `/v1/shopping-cart/{userId}` : method `GET`\n\n\u003cbr\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003ePOST Body JSON attribute \u003c/summary\u003e\n\n```json\n  {\n    \"task\": \"create\",\n    \"payload\": {\n      \"apps_id\": \"6606cc8ed9c25c6c5f00b48b\",\n      \"merchant_id\": \"5798426b-8c7c-4064-b43b-d51e5ef6067b\",\n      \"merchant_name\": \"My Favorite Store\",\n      \"session_id\": \"a0a8ae1a-aa31-488c-9a6c-cfda44202446\",\n      \"user_id\": \"deanknowles@valpreal.com\",\n      \"product_id\": \"6606cc8e1b69fbabf8a3b534\",\n      \"product_image\": \"https://images.mediaservice.io/example.jpeg\",\n      \"product_name\": \"Apple Vision Pro\",\n      \"price\": 1000000,\n      \"quantity\": 1\n    }\n  }\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eREAD Body JSON attribute\u003c/summary\u003e\n\n```json\n  {\n    \"task\": \"read\",\n    \"payload\": {\n      \"user_id\": \"deanknowles@valpreal.com\"\n    }\n  }\n```\n\n\u003c/details\u003e\n\n\u003e [!NOTE]\n\u003e\n\u003e Payload on READ Request Body only works when you're using RabbitMQ\n\n\u003cdetails\u003e\n\u003csummary\u003ePATCH Body JSON attribute\u003c/summary\u003e\n\n```json\n  {\n    \"task\": \"update\",\n    \"payload\": {\n      \"user_id\": \"deanknowles@valpreal.com\",\n      \"product_id\": \"6606cc8e1b69fbabf8a3b534\",\n      \"quantity\": 2,\n      \"params\": \"params\"\n    }\n  }\n```\n\u003e `PARAMS:` value must be `increment` or `decrement`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eDELETE Body JSON attribute\u003c/summary\u003e\n\n```json\n  {\n    \"task\": \"delete\",\n    \"payload\": {\n        \"id\": [\"arrayOfIDs\"]\n    }\n  }\n```\n\u003e`arrayOfIDs`: ID must be in array format consist of cart ID / ID's. eg: [1, 2, 3, 4]\n\u003c/details\u003e\u003cbr\u003e\n\n\u003e[!NOTE]\n\u003e `task` consist of `create`, `read`, `update` and `delete`\n\n\n## 📍 Task Description \u0026 Method\n\n| Task | Method | Minimum Payload |\n| ---- | ------ | ------- |\n| `create` | POST | `user_id`, `product_id`, `product_image`, `product_name`, `price`, `quantity` |\n| `read` | GET | `user_id` |\n| `update` | PATCH | `user_id`, `product_id`, `quantity` |\n| `remove` | DELETE | `[id]` or `[cartId]` |\n\n## RabbitMQ\n\n\u003cdetails\u003e\n\u003csummary\u003eMessage Payload:\u003c/summary\u003e\n\n```json\n{\n    \"task\": \"create\",\n    \"payload\": {\n      \"apps_id\": \"6606cc8ed9c25c6c5f00b48b\",\n      \"merchant_id\": \"5798426b-8c7c-4064-b43b-d51e5ef6067b\",\n      \"merchat_name\": \"XYZ Company\",\n      \"merchant_name\": \"My Favorite Store\",\n      \"session_id\": \"a0a8ae1a-aa31-488c-9a6c-cfda44202446\",\n      \"user_id\": \"deanknowles@valpreal.com\",\n      \"product_id\": \"6606cc8e1b69fbabf8a3b534\",\n      \"product_image\": \"https://images.mediaservice.io/example.jpeg\",\n      \"product_name\": \"Apple Vision Pro\",\n      \"price\": 1000000,\n      \"quantity\": 1\n    },\n    \"origin\": {\n      \"queue\": \"customerOrder\",\n      \"routingKey\": \"customerOrderKey\"\n    }\n}\n```\n\n\u003c/details\u003e\n\n## Attribute descriptions\n\n| Element   |  Description| Required |\n| -------   |  ----------- | -------- |\n| `task`    |  `create`, `read`, `update`, `delete` | Required\n| `payload` | `Object`: Item details | Required\n| `apps_id` | `String`: (eg: server-key or service id) | Optional\n| `merchant_id` | `String` | Optional\n| `merchant_name` | `String` | Optional\n| `session_id` | `String` | Optional\n| `user_id` | `String`: (eg: email or random token) | Required\n| `product_id` | `String`: (eg: Product SKU) | Required\n| `product_image` | `String`: value must be valid URL format | Required\n| `product_name` | `String` | Required\n| `price` | `Number` | Required\n| `quantity` | `Number` | Required\n| `custom_fields` | `Object`: [see example](#custom-fields-on-payload)  | Optional\n| `product_links` | `Object`: [see example](#product-links-attribute-example) | Optional\n| `origin` | `Object`: consist of two key [`queue`, `routingKey`] only required when using MQTT protocols | Required\n| `params` | `String`: value must be `decrement` or `increment`. Required when updating items quantity | Required\n\n## Custom Fields on Payload\n\nCustom fields allow you to add any extra info on user items, such as brand name, item size, color, and more.\n\n\u003cdetails\u003e\n\u003csummary\u003eBody JSON Attribute\u003c/summary\u003e\n\n```json\n{\n  \"task\": \"create\",\n  \"payload\": {\n    \"custom_fields\": {\n      \"brand\": \"XYZ\",\n      \"color\": \"Green\",\n      \"size\": \"XL\"\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n## Product Links Attribute Example\n\nIn the `product_links` field, you can include attributes such as URL, shortened URL, catalog link, etc. To facilitate the Front-End team, you can add attributes like href, rel, and others.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n{\n  \"product_links\": {\n    \"url\": \"https://resource.e-commerce.app/product/apple-vision-pro-x\",\n    \"rel\": \"_blank\",\n    \"brochure\": {\n      \"url\": \"https://resource.e-commerce.app/product/apple-vision-pro-x/brochure.pdf\",\n      \"method\": \"GET\"\n    }\n  }\n}\n```\n\nOR\n\n```json\n{\n  \"product_links\": {\n    \"video_preview\": \"https://preview.media.app/dasno238as3/demo.video\",\n    \"video_link\": \"https://www.youtube.com/watch?v=abcdef\"\n  }\n}\n```\n\n\u003c/details\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermaficus%2Flef4cart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpermaficus%2Flef4cart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermaficus%2Flef4cart/lists"}