TypeScript SDK
A powerful, 100% type-safe TypeScript SDK for the CommerceEngine Storefront API. Built with modern JavaScript patterns, automatic token management, and comprehensive error handling.✨ Key Features
100% Type Safe
Every API endpoint is fully typed with TypeScript for complete IntelliSense support
Automatic Token Management
Built-in refresh token logic for seamless authentication across all environments
Universal Compatibility
Works in browser, Node.js, and hybrid rendering environments (Next.js, Nuxt, etc.)
Production Ready
Implements all API best practices with zero configuration required
Installation
Quick Start
Basic Setup
1
Import and initialize the SDK
2
Get anonymous authentication
3
Make your first API call
Complete E-commerce Example
Here’s a complete example showing authentication, product browsing, and cart management:Core Concepts
Client Architecture
The SDK uses a client-per-domain architecture for optimal organization:Type Safety
Every method is fully typed with complete IntelliSense support:Error Handling
All API calls return a consistentApiResult<T>
structure:
Next Steps
Token Management
Learn about automatic token management and authentication patterns
Configuration
Explore all configuration options and environment setup
Related
React Integration
Patterns for React applications
Next.js Integration
Patterns for Next.js applications
The SDK automatically handles API best practices like token refresh, automatic retries on authentication failure, and proper error handling. You can focus on building your application logic while the SDK manages the infrastructure concerns.