A modern, AI-powered product search interface built with SvelteKit, showcasing the capabilities of the Weaviate C# Managed Client.
- Semantic Search: Find products by meaning using vector embeddings
- Hybrid Search: Combine semantic and keyword search for best results
- Keyword Search: Traditional BM25 full-text search
- Smart Recommendations: Vector-based similar product suggestions
- Faceted Filtering: Filter by category, price, rating, and brand
- Server-Side Rendering: Fast initial page loads with SSR
- Type-Safe: Full TypeScript support throughout
- SvelteKit 7.x: Modern web framework with file-based routing
- TypeScript: Type safety across frontend and backend integration
- Vite: Fast development server with HMR
- Node.js Adapter: Production-ready Node.js deployment
- Node.js 18+ and npm
- Backend WebApi running on http://localhost:5000
- Weaviate instance running with sample data
npm installStart the development server:
npm run devThe app will be available at http://localhost:5173 with API proxy to the backend.
Build for production:
npm run buildPreview the production build:
npm run previewsrc/
├── lib/
│ ├── api.ts # API client for backend communication
│ ├── types.ts # TypeScript type definitions
│ └── components/
│ ├── ProductCard.svelte # Product display card
│ └── SearchBar.svelte # Search interface with mode selector
├── routes/
│ ├── +layout.svelte # Main layout with navigation
│ ├── +page.svelte # Home page
│ ├── +page.server.ts # Home page data loading
│ ├── +error.svelte # Error page
│ ├── search/
│ │ ├── +page.svelte # Search results page
│ │ └── +page.server.ts # Search execution
│ └── product/
│ └── [id]/
│ ├── +page.svelte # Product detail page
│ └── +page.server.ts # Product data loading
└── app.html # HTML template
static/ # Static assets (images, fonts, etc.)
The ApiClient class in src/lib/api.ts provides type-safe methods for all backend endpoints:
health(): Health checkgetProducts(params?): Get products with optional filtersgetProduct(id): Get single productgetSimilarProducts(id, limit?): Vector-based recommendationsgetFacets(): Get category and brand countssearch(request): Main search with mode selectiongetReviews(productId): Get product reviewssearchReviews(query, limit?): Search in reviews
Uses AI-powered vector embeddings to find products by meaning. Example: "device for taking photos" will find cameras.
Combines semantic search with keyword matching using an alpha parameter for optimal results.
Traditional BM25 full-text search for exact term matching.
The Vite configuration in vite.config.ts includes a proxy to forward /api requests to the backend:
server: {
port: 5173,
proxy: {
'/api': 'http://localhost:5000'
}
}Change the backend URL if your WebApi runs on a different port.
All API responses are typed using TypeScript interfaces in src/lib/types.ts:
Product: Product entity with all propertiesSearchRequest: Search parameters with mode and filtersSearchResult: Search result with object and metadataFacets: Category and brand facet counts
Server-side rendering provides:
- Faster initial page loads
- Better SEO
- Progressive enhancement
- Improved performance on slow connections
- Use the browser devtools to inspect API calls
- Check the Network tab to see search requests and responses
- Use the SvelteKit inspector to debug component state
- Hot module replacement (HMR) updates changes instantly
The project uses @sveltejs/adapter-node for Node.js deployment:
npm run build
node buildOr deploy to platforms like Vercel, Netlify, or Cloudflare Pages by changing the adapter.
- WebApi Backend: ASP.NET Core backend
- Weaviate C# Client: ORM layer
- Example Documentation: Complete example overview