Products
The Products app lets sellers create, manage, and sell digital and physical products. It provides a full product catalog with media galleries, downloadable files, specifications, order tracking, and revenue analytics.
Key Features
Section titled “Key Features”- Create digital or physical products with pricing and compare-at pricing
- Media gallery management (images and videos)
- Downloadable file attachments for digital products
- Key-value specification pairs (e.g., Format: PDF)
- Draft / Published / Inactive lifecycle
- Order tracking with status management
- Dashboard stats: total products, published count, sales, and revenue
Page Structure
Section titled “Page Structure”| Route | Purpose |
|---|---|
/business/apps/products | Dashboard with stats cards, quick nav, and recent products list |
/business/apps/products/new | Create product form (title, description, type, pricing, thumbnail) |
/business/apps/products/[id] | Product detail view with media, files, specs, and orders sections |
Dashboard
Section titled “Dashboard”The main page displays four stat cards (Total Products, Published, Total Sales, Revenue) and a quick-nav grid linking to product management sections. Below that, the five most recent products are listed with thumbnail, title, type, sales count, price, and status badge.
Create Product
Section titled “Create Product”The creation form uses sveltekit-superforms with Zod validation (createProductSchema). Fields include title, description, product type (digital/physical), price, compare price, and thumbnail URL.
Product Detail
Section titled “Product Detail”The detail page shows full product info and provides inline management for three sub-resources via dialog modals:
- Media — add/remove images and videos
- Files — add/remove downloadable files (title + file path)
- Specifications — add/remove key-value pairs
It also lists orders for the product and supports publish and delete actions.
Data Model
Section titled “Data Model”| Table | Description |
|---|---|
ext_products.products | Core product record (title, slug, price, type, status, seller_id) |
ext_products.product_media | Image/video gallery items linked to a product |
ext_products.product_files | Downloadable file attachments |
ext_products.product_specifications | Key-value specification pairs |
ext_products.product_orders | Purchase orders with buyer, amount, and status |
Key Types
Section titled “Key Types”Product— id, seller_id, title, slug, description, price, compare_price, type (digital|physical), status (draft|published|inactive), thumbnail_url, sales_count, rating_avg, rating_countProductWithDetails— Product with nested files, media, and specifications arraysProductOrder— id, product_id, buyer_id, seller_id, amount, status (pending|completed|refunded)ProductStats— total_products, published_products, total_sales, total_revenue
Key Components
Section titled “Key Components”| Component | Location |
|---|---|
| Product list page | src/routes/(app)/business/apps/products/+page.svelte |
| Create product form | src/routes/(app)/business/apps/products/new/+page.svelte |
| Product detail + dialogs | src/routes/(app)/business/apps/products/[id]/+page.svelte |
Services
Section titled “Services”All server-side logic is in $lib/apps/products/services/index.js:
getSellerStats(userId)— aggregate stats for the dashboardlistMyProducts(userId, filters)— paginated product listingcreateProduct(userId, data)— create a new productgetProduct(id)— fetch product with details (files, media, specs)publishProduct(id)/deleteProduct(id)— lifecycle managementaddMedia()/removeMedia()/addFile()/removeFile()/addSpecification()/removeSpecification()— sub-resource CRUDlistOrders(userId)— fetch seller orders
Form Actions
Section titled “Form Actions”The [id] detail page exposes multiple SvelteKit form actions: publish, delete, add-media, remove-media, add-file, remove-file, add-spec, and remove-spec. All actions require authentication and use progressive enhancement.