Marketplace
Overview
Section titled “Overview”The marketplace is a peer-to-peer service marketplace where sellers list professional services and buyers browse, compare, and purchase them using Stripe payments.
Module path: src/lib/modules/marketplace/
Route: /marketplace
Key Concepts
Section titled “Key Concepts”| Concept | Description |
|---|---|
| Service | A professional offering listed by a seller with pricing tiers |
| Package | A pricing tier (basic/standard/premium) with price, delivery time, revisions |
| Favorites | Users can bookmark services for quick access |
| Comparison | Side-by-side comparison of up to 10 services |
| Provider | Seller info attached to services (name, avatar, location) |
Browsing & Discovery
Section titled “Browsing & Discovery”The marketplace page displays services with:
- Category/subcategory filtering
- Search by keyword
- Favorites toggle to show only bookmarked services
- Service cards with quick view, compare, favorite, and message buttons
File: src/lib/modules/marketplace/types/marketplace.ts
interface MarketplaceService { // Service fields from hub hubId: string; hubHandle: string; hubName: string; hubLogo: string; hubOwnerId: string;}
interface ExtendedService { isFavorite?: boolean;}
interface Provider { displayName: string; avatarUrl: string; userName: string; location: string; profileId: string;}
type PackageTier = 'basic' | 'standard' | 'premium';State Management
Section titled “State Management”marketplaceManager
Section titled “marketplaceManager”File: src/lib/modules/marketplace/stores/marketplace-manager.svelte.ts
marketplaceManager.allServices; // All services with creator infomarketplaceManager.filteredServices; // Filtered by category/search/favoritesmarketplaceManager.categories; // Unique categoriesmarketplaceManager.subcategories; // Subcategories for selected category
marketplaceManager.setCategory(category);marketplaceManager.setSearchQuery(query);marketplaceManager.toggleFavoritesOnly();marketplaceManager.clearFilters();favoritesManager
Section titled “favoritesManager”File: src/lib/modules/marketplace/stores/favorites-manager.svelte.ts
favoritesManager.favorites; // Array of favorite servicesfavoritesManager.count; // Total countfavoritesManager.isFavorite(id); // Check if favoritedfavoritesManager.toggleFavorite(service);Firestore path: users/{userId}/favorites/{serviceId}
Components
Section titled “Components”| Component | Purpose |
|---|---|
service-card.svelte | Service display with actions |
quick-view.svelte | Full service details modal |
order-summary.svelte | Checkout summary before payment |
comparison.svelte | Side-by-side service comparison |
Purchase Flow
Section titled “Purchase Flow”- User browses and selects a service package
- Quick View modal shows service details and package selection
- User selects tier and enters requirements
- Order Summary dialog shows before payment
checkoutService.createMarketplaceCheckout()creates Stripe session- User redirected to Stripe Checkout
- On success, redirected to
/marketplace/order-success/{sessionId}
Stripe Integration
Section titled “Stripe Integration”- Direct Charges model via Stripe Connect
- Platform fee: 5% of order amount
- Checkout sessions stored in:
users/{buyerId}/checkout_sessions/{sessionId} - Seller receives payment minus platform fee directly to their Connect account