This sample demonstrates server-side rendering (SSR) with Coveo Headless commerce controllers using a generic implementation. It shows how to:
- Set up a commerce search interface with server-side rendering
- Use Headless controllers for product search and listing
- Implement a simple search interface with plain HTML/CSS/JS
- Handle search state on both server and client sides
- Node.js 22+ (LTS v22.18.0)
- npm 10+
- Server-side rendering: Initial page load with pre-rendered search results
- Client-side hydration: Interactive search functionality after page load
- esbuild bundling: Fast and efficient bundling for the client-side code
- TypeScript: Full type safety throughout the application
- Express server: Simple HTTP server for handling requests
-
Install dependencies:
npm install
-
Build the project:
npm run build
-
Start the server:
npm start
-
Open your browser to
http://localhost:3000
For development with automatic rebuilding:
npm run devThis will start the client bundler in watch mode and run the server with hot reload using tsx.
npm run testRuns the Playwright end-to-end tests.
npm run test:headedRuns the Playwright tests in headed mode (with a visible browser).