A modern e-commerce admin dashboard built with SvelteKit, showcasing integration with the Commercify API platform. This application provides a comprehensive interface for managing products, categories, orders, and customer data.
- Product Management: Create, update, and organize product catalogs
- Category Management: Hierarchical category structure with advanced organization
- Order Processing: Real-time order management and fulfillment tracking
- Customer Management: Comprehensive customer data and interaction history
- Analytics Dashboard: Key performance metrics and business insights
- Responsive Design: Modern, mobile-first UI with dark/light mode support
- Health Monitoring: Built-in health checks and API diagnostics
- Docker Support: Production-ready containerization
- Frontend: SvelteKit 5.x with TypeScript
- Styling: TailwindCSS 4.x with custom component library
- UI Components: Custom component library with accessibility features
- API Client: Type-safe Commercify API integration
- Development: Vite for fast development and building
- Package Manager: Bun for lightning-fast package management
- Containerization: Docker with multi-stage builds
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher)
- Bun (latest version) - Install Bun
- Docker (optional, for containerized deployment)
- Git
git clone <repository-url>
cd commercify-go-appbun installCopy the example environment file and configure your API endpoints:
cp .env.example .envbun run devThe application will be available at http://localhost:5173
| Script | Description |
|---|---|
bun run dev |
Start development server with hot reload |
bun run build |
Build production application |
bun run preview |
Preview production build locally |
bun run check |
Run type checking |
bun run check:watch |
Run type checking in watch mode |
bun run format |
Format code with Prettier |
bun run lint |
Check code formatting |
- Build the image:
docker build -t commercify-go-app .- Run the container:
docker run -p 3000:3000 \
-e API_BASE_URL_DEV=http://localhost:6091/api \
-e API_BASE_URL_PROD=https://api.commercify.com/v1 \
commercify-go-appFor easier management, use Docker Compose:
# Production
docker-compose up -d
# Development
docker-compose --profile dev up -dcommercify-go-app/
βββ src/
β βββ lib/
β β βββ components/ # Reusable UI components
β β β βββ ui/ # Base UI component library
β β βββ server/ # Server-side utilities
β β β βββ api/ # API clients and utilities
β β β βββ env.ts # Environment configuration
β β βββ types/ # TypeScript type definitions
β β βββ utils.ts # Shared utilities
β βββ routes/ # SvelteKit routes
β β βββ +layout.svelte # Root layout
β β βββ +page.svelte # Home page
β β βββ health/ # Health check endpoints
β βββ app.html # HTML template
βββ static/ # Static assets
βββ docker-compose.yml # Docker Compose configuration
βββ Dockerfile # Production Docker image
βββ Dockerfile.dev # Development Docker image
βββ package.json # Project configuration
The application integrates with the Commercify API platform:
- Type-safe API client with full TypeScript support
- Automatic error handling with retry logic
- Environment-based configuration for dev/prod endpoints
- Request/response validation using Zod schemas
- Built-in authentication with token management
import { commercify } from '$lib/server/api/commercify';
// Fetch products
const products = await commercify.searchProducts({
page: 1,
page_size: 20,
search: 'laptop'
});
// Create a new product
const newProduct = await commercify.createProduct({
name: 'New Product',
description: 'Product description',
price: 99.99
});This project supports running a separate customer-facing storefront alongside the admin dashboard. The storefront is a SvelteKit app that fetches product, category, and order data from the Commercify API.
- Ensure you have Docker and Docker Compose installed
- The Commercify API backend must be running (see docker-compose.yml)
Create a .env file for your storefront (or use Docker Compose environment variables):
NODE_ENV=production
API_BASE_URL_PROD=http://commercify-api:6091
CACHE_INVALIDATION_API_KEY=your-cache-secret
ORIGIN=http://localhost:3000Add a service for your storefront in docker-compose.yml:
storefront-app:
build:
context: .
dockerfile: Dockerfile
ports:
- '3000:3000'
environment:
- NODE_ENV=production
- ORIGIN=http://localhost:3000
- CACHE_INVALIDATION_API_KEY=your-cache-secret
- API_BASE_URL_PROD=http://commercify-api:6091
depends_on:
commercify-api:
condition: service_healthy
postgres:
condition: service_healthy
restart: unless-stopped
networks:
- hh-commercify-networkStart all services:
docker-compose up -dThe storefront will be available at http://localhost:3000.
When you update products or categories in the admin dashboard, cache invalidation requests are sent to the storefront (storefront-app) to ensure customers see fresh data immediately. Make sure the storefront implements the /api/cache/invalidate endpoint for this to work.
- Update branding, theme, and layout in the
src/routesandsrc/lib/components/uifolders - Configure payment, shipping, and other integrations as needed
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Run tests and linting:
bun run check && bun run lint - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature-name - Submit a pull request
Built with β€οΈ using SvelteKit and the Commercify API