You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
173
+
174
+
### 1. Prerequisites
175
+
- Ensure you have Docker and Docker Compose installed
176
+
- The Commercify API backend must be running (see docker-compose.yml)
177
+
178
+
### 2. Environment Configuration
179
+
Create a `.env` file for your storefront (or use Docker Compose environment variables):
180
+
181
+
```env
182
+
NODE_ENV=production
183
+
API_BASE_URL_PROD=http://commercify-api:6091
184
+
CACHE_INVALIDATION_API_KEY=your-cache-secret
185
+
ORIGIN=http://localhost:3000
186
+
```
187
+
188
+
### 3. Docker Compose Setup
189
+
Add a service for your storefront in `docker-compose.yml`:
190
+
191
+
```yaml
192
+
storefront-app:
193
+
build:
194
+
context: .
195
+
dockerfile: Dockerfile
196
+
ports:
197
+
- '3000:3000'
198
+
environment:
199
+
- NODE_ENV=production
200
+
- ORIGIN=http://localhost:3000
201
+
- CACHE_INVALIDATION_API_KEY=your-cache-secret
202
+
- API_BASE_URL_PROD=http://commercify-api:6091
203
+
depends_on:
204
+
commercify-api:
205
+
condition: service_healthy
206
+
postgres:
207
+
condition: service_healthy
208
+
restart: unless-stopped
209
+
networks:
210
+
- hh-commercify-network
211
+
```
212
+
213
+
### 4. Running the Storefront
214
+
215
+
Start all services:
216
+
```bash
217
+
docker-compose up -d
218
+
```
219
+
220
+
The storefront will be available at `http://localhost:3000`.
221
+
222
+
### 5. Cache Invalidation
223
+
224
+
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.
225
+
226
+
### 6. Customizing the Storefront
227
+
- Update branding, theme, and layout in the `src/routes` and `src/lib/components/ui` folders
228
+
- Configure payment, shipping, and other integrations as needed
0 commit comments