ecom-user-sdk
v1.1.2
Published
This library provides **all the core functionality needed to build a user-centric e-commerce website**, designed so anyone can create a fully functional platform in a day. It is **component-based, context-aware, and includes caching** for optimal perfor
Readme
🛍️ User-Focused E-Commerce Library
This library provides all the core functionality needed to build a user-centric e-commerce website, designed so anyone can create a fully functional platform in a day.
It is component-based, context-aware, and includes caching for optimal performance and seamless integration.
✨ Key Features
User Profiles
Store user details including name, email, phone, and avatar. Fully integrated with authentication providers like Supabase or Firebase.Addresses
Manage multiple addresses per user, including shipping and billing, with default selection support.Cart Management
Add, remove, and update items in the cart. Automatically calculate subtotals, discounts, taxes (GST/VAT), and grand totals.
Supports caching and context-based state for fast, reactive UI updates.Orders
Capture complete order details with snapshots of the cart and selected addresses to ensure consistent order history.Component-Based Architecture
Prebuilt React/Next.js components for cart, checkout, and variation selection.
Makes integration into any frontend straightforward and consistent.Extensibility & Compatibility
Works with any authentication system (Supabase, Firebase, JWT, etc.).
Can be easily integrated into Node.js or Next.js projects.
Fully extendable for features like preferences, wishlists, saved payments, and multilingual support.Caching & Context
Optimized for performance with built-in caching.
Context-based state management ensures seamless updates across components.
📂 Suggested Database Schema
- users → Stores user profiles and links to your authentication provider.
- user_addresses → Multiple addresses per user (shipping, billing, other).
- orders → References users and snapshots of addresses/cart items.
- order_items → Contains products associated with a specific order.
🌍 Why Use This Library?
- Build a ready-to-go e-commerce website in a single day.
- Focus on front-end, branding, and UX while the library handles user, cart, and order logic.
- Component-based design ensures modular, maintainable, and scalable architecture.
- Caching and context make your app fast, responsive, and reactive.
🛠️ Tech Notes
- Designed for Postgres/Supabase, but database-agnostic.
- Component-based with React/Next.js integration in mind.
- Prioritizes user-centered workflows: profile → address → cart → order.
- Extendable with additional features like loyalty programs, saved payments, and more.
📜 License
MIT © 2025 Your Name
// { // "name": "ecom-user-sdk", // "version": "1.1.1", // "main": "dist/index.js", // "scripts": { // "test": "echo "Error: no test specified" && exit 1", // "build": "tsup src --format esm,cjs --out-dir dist" // }, // "keywords": [], // "author": "", // "license": "ISC", // "description": "", // "exports": { // ".": "./dist/index.js", // "./product": "./dist/hooks/products/index.js", // "./server": "./dist/hooks/server/index.js", // "./cart": "./dist/hooks/cart/index.js", // "./user": "./dist/hooks/user/index.js", // "./order": "./dist/hooks/orders/index.js", // "./payment/razorpay": "./dist/hooks/payments/razorpay/index.js", // "./payment/cod": "./dist/hooks/payments/cashOnDelivery/index.js", // "./context": "./dist/context/index.js", // "./auth/supabase": "./dist/auth/supabase/index.js", // "./shiprocket": "./dist/hooks/shiprocket/index.js", // "./email": "./dist/hooks/email/index.js" // }, // "peerDependencies": { // "react": "^18.0.0 || ^19.0.0", // "react-dom": "^18.0.0 || ^19.0.0", // "react-hook-form": "^7.59.0", // "@supabase/supabase-js": "^2.44.2" // }, // "devDependencies": { // "tsup": "^8.5.0", // "typescript": "^5.9.2" // }, // "dependencies": { // "razorpay": "^2.9.6" // } // }
