@misiki/x-cart-connector
v0.5.1
Published
API Connector for X-Cart with Svelte Commerce
Readme
@misiki/x-cart-connector
The Official TypeScript API Connector for connecting svelte-commerce to X-Cart E-Commerce Backend.
@misiki/x-cart-connector provides a production-ready, fully-typed API client and integration layer that seamlessly bridges svelte-commerce storefronts with X-Cart headless e-commerce backends — part of the Litekart connector suite, mirroring the full 43-service surface of @misiki/litekart-connector.
Coverage: 26 of 43 services are wired to the live X-Cart API. The remaining 17 have no X-Cart equivalent and return empty placeholder data. Each placeholder says why in a comment at the top of its service file.
🚀 Step-by-Step Integration Guide
Follow these steps to connect svelte-commerce with x-cart-connector and your X-Cart backend.
1. Install the Connector
Inside your svelte-commerce project directory, run:
bun i @misiki/x-cart-connector(Or using npm / pnpm / yarn):
npm install @misiki/x-cart-connector
# or
pnpm add @misiki/x-cart-connector2. Configure kitcommerce.config.ts
In svelte-commerce, open kitcommerce.config.ts and change the export * line to import from @misiki/x-cart-connector:
// kitcommerce.config.ts
export * from '@misiki/x-cart-connector';3. Configure Credentials
Pass apiUrl (store URL), accessToken (REST API key as bearer token).
API docs: https://devs.x-cart.com/en/rest_api/
import { XCartConnector } from '@misiki/x-cart-connector'
// Credentials are set once, statically — the constructor only takes an optional fetch.
XCartConnector.setCredentials({
apiUrl: 'https://store.example.com',
accessToken: 'api_key'
})
const client = new XCartConnector()
const products = await client.product.list({ page: 1, sort: '-createdAt' })4. Build and Run the Project
Run the development server in svelte-commerce:
bun devTo build and run the production application:
# Build the project
bun run build
# Preview the built application
bun run previewService coverage
| Service | Status |
| --- | --- |
| client.product | ✅ live |
| client.category | ✅ live |
| client.collection | ✅ live |
| client.order | ✅ live |
| client.coupon | ✅ live |
| client.address | ✅ live |
| client.review | ✅ live |
| client.cart | ✅ live |
| client.country | ✅ live |
| client.state | ✅ live |
| client.currency | ✅ live |
| client.region | ✅ live |
| client.page | ✅ live |
| client.blog | ⚠️ placeholder (no X-Cart equivalent) |
| client.settings | ✅ live |
| client.store | ⚠️ placeholder (no X-Cart equivalent) |
| client.paymentMethod | ✅ live |
| client.search | ✅ live |
| client.autocomplete | ✅ live |
| client.user | ✅ live |
| client.auth | ✅ live |
| client.profile | ✅ live |
| client.wishlist | ✅ live |
| client.vendor | ⚠️ placeholder (no X-Cart equivalent) |
| client.checkout | ✅ live |
| client.upload | ⚠️ placeholder (no X-Cart equivalent) |
| client.banner | ⚠️ placeholder (no X-Cart equivalent) |
| client.chat | ⚠️ placeholder (no X-Cart equivalent) |
| client.contact | ⚠️ placeholder (no X-Cart equivalent) |
| client.deal | ⚠️ placeholder (no X-Cart equivalent) |
| client.demoRequest | ⚠️ placeholder (no X-Cart equivalent) |
| client.enquiry | ⚠️ placeholder (no X-Cart equivalent) |
| client.faq | ⚠️ placeholder (no X-Cart equivalent) |
| client.feedback | ⚠️ placeholder (no X-Cart equivalent) |
| client.gallery | ⚠️ placeholder (no X-Cart equivalent) |
| client.home | ✅ live |
| client.init | ✅ live |
| client.meilisearch | ✅ live |
| client.menu | ✅ live |
| client.plugins | ⚠️ placeholder (no X-Cart equivalent) |
| client.popularSearch | ⚠️ placeholder (no X-Cart equivalent) |
| client.popularity | ⚠️ placeholder (no X-Cart equivalent) |
| client.reels | ⚠️ placeholder (no X-Cart equivalent) |
Development
bun install && bun run typecheck && bun run buildLicense
MIT © misiki-in
