{"id":19247831,"url":"https://github.com/prappo/cart-js","last_synced_at":"2026-01-27T11:31:56.541Z","repository":{"id":261838146,"uuid":"885483032","full_name":"prappo/cart-js","owner":"prappo","description":"A lightweight, customizable shopping cart library for modern web applications. Built with TypeScript, featuring template system, discount management, tax calculation, and local storage persistence. Zero dependencies. 🛒","archived":false,"fork":false,"pushed_at":"2024-11-26T07:59:41.000Z","size":38,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-01T17:26:53.126Z","etag":null,"topics":["cart","ecommerce","javascript-library","shopping-cart","typescript","web-components"],"latest_commit_sha":null,"homepage":"https://prappo.github.io/cart-js/","language":"TypeScript","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/prappo.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-11-08T17:09:50.000Z","updated_at":"2025-09-30T22:08:48.000Z","dependencies_parsed_at":"2024-11-08T18:35:49.285Z","dependency_job_id":"67dfd083-ba3d-4c82-b14e-8f582d438266","html_url":"https://github.com/prappo/cart-js","commit_stats":null,"previous_names":["prappo/cart-js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/prappo/cart-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prappo%2Fcart-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prappo%2Fcart-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prappo%2Fcart-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prappo%2Fcart-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prappo","download_url":"https://codeload.github.com/prappo/cart-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prappo%2Fcart-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28812389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:41:26.337Z","status":"ssl_error","status_checked_at":"2026-01-27T07:41:08.776Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["cart","ecommerce","javascript-library","shopping-cart","typescript","web-components"],"created_at":"2024-11-09T18:05:23.117Z","updated_at":"2026-01-27T11:31:56.518Z","avatar_url":"https://github.com/prappo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cart.js\n\nA simple and flexible shopping cart library for your website. Cart.js provides a complete shopping cart solution with support for discounts, taxes, custom templates, and local storage persistence.\n\n## Installation\n\n```bash\nnpm install @prappo/cart-js\n```\n\n## Quick Start\n\n```javascript\nimport Cart from '@prappo/cart-js';\n\n// Initialize cart\nconst cart = new Cart();\n\n// Add items\ncart.addItem({\n  id: \"item1\",\n  amount: 10000, // Amount in cents\n  title: \"Product Name\",\n  quantity: 1\n});\n\n// Set template\ncart.setTemplate(`\n  \u003cdiv\u003e\n    \u003citems\u003e\n      \u003citem\u003e\n        \u003cdiv\u003e\n          \u003ch3\u003e{{item.title}}\u003c/h3\u003e\n          \u003cp\u003ePrice: {{item.amount}}\u003c/p\u003e\n          \u003cQtMinusBtn\u003e-\u003c/QtMinusBtn\u003e\n          {{item.quantity}}\n          \u003cQtPlusBtn\u003e+\u003c/QtPlusBtn\u003e\n          \u003cRemoveBtn\u003eRemove\u003c/RemoveBtn\u003e\n        \u003c/div\u003e\n      \u003c/item\u003e\n    \u003c/items\u003e\n    \u003cdiv\u003eTotal: {{total}}\u003c/div\u003e\n    \u003cCheckoutBtn\u003e\n      \u003cbutton\u003eCheckout\u003c/button\u003e\n    \u003c/CheckoutBtn\u003e\n  \u003c/div\u003e\n`);\n\n// Initialize the cart with a container\ncart.init('#cart-container');\n```\n\n## Features\n\n- 🛒 Easy to use shopping cart functionality\n- 💲 Support for multiple currencies\n- 🏷️ Discount management\n- 💰 Tax calculation\n- 📱 Responsive design\n- 🎨 Customizable template system\n- 💾 Local storage persistence\n\n## API Reference\n\n### Cart Methods\n\n#### Initialization\n```javascript\nconst cart = new Cart();\ncart.init('#container-selector');\n```\n\n#### Item Management\n```javascript\n// Add item\ncart.addItem({\n  id: string,\n  amount: number,\n  title: string,\n  quantity?: number,\n  image?: string,\n  currency?: string,\n  description?: string\n});\n\n// Remove item\ncart.removeItem(itemId);\n\n// Update quantity\ncart.updateQuantity(itemId, quantity);\n\n// Clear cart\ncart.clearCart();\n```\n\n#### Discounts \u0026 Taxes\n```javascript\n// Add discount\ncart.addDiscount({\n  value: number,\n  type: 'percentage' | 'fixed'\n});\n\n// Add tax\ncart.addTax({\n  rate: number,\n  name: string\n});\n```\n\n#### Getters\n```javascript\ncart.getItems();        // Get all items\ncart.getSubtotal();     // Get subtotal\ncart.getTotal();        // Get total with tax and discounts\ncart.getTaxes();        // Get applied taxes\ncart.getDiscounts();    // Get applied discounts\n```\n\n### Template System\n\nThe template system uses special tags for dynamic content:\n\n- `\u003citems\u003e` - Container for item list\n- `\u003citem\u003e` - Individual item template\n- `\u003cQtPlusBtn\u003e` - Quantity increase button\n- `\u003cQtMinusBtn\u003e` - Quantity decrease button\n- `\u003cRemoveBtn\u003e` - Remove item button\n- `\u003cCheckoutBtn\u003e` - Checkout button\n- `\u003cCartEmpty\u003e` - Empty cart content\n\nAvailable variables:\n- `{{item.property}}` - Item properties (id, title, amount, etc.)\n- `{{subtotal}}` - Cart subtotal\n- `{{total}}` - Cart total\n- `{{tax}}` - Total tax amount\n- `{{discount}}` - Total discount amount\n\n### Events\n\n```javascript\n// Listen for checkout events\ndocument.addEventListener('cart:checkout', (event) =\u003e {\n  const { items, total, subtotal, taxes, discounts } = event.detail;\n  // Handle checkout\n});\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Start development server\nnpm run dev\n\n# Build library\nnpm run build:lib\n\n# Build demo\nnpm run build:demo\n\n# Build both library and demo\nnpm run build\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprappo%2Fcart-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprappo%2Fcart-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprappo%2Fcart-js/lists"}