Skip to main content
Version: next

FAQ

Small questions, quick answers about Server events

What events are implemented in Front-Commerce?

info

Currently, Front-Commerce only implement the OrderPlaced events, but more events will be added in the future.

EventDescription
OrderPlacedThis event is triggered when an order is placed.

How can I test Server events in local environment?

To test server events in a local environment, you need a Redis server, and you must configure redis host and port in your front-commerce.config.ts file:

front-commerce.config.ts
import { defineConfig } from "@front-commerce/core/config";

export default defineConfig({
extensions: [themeChocolatine()],
serverEvents: {
integrations: [],
redis: {
host: "127.0.0.1",
port: 6379,
},
},
});

Then you need to start the worker by running the following command from your project : pnpm run worker

If you would like to obtain additional information and enable debug mode, you can do one of the following:

  • Run the command with the DEBUG flag : DEBUG=front-commerce:server-events:cli pnpm run worker
  • Add the debug flag to your .env file : DEBUG=front-commerce:server-events:cli

What data is published for a Server Event?

The data returned by the events is an object with the following properties :

{
event_type: string, // Type of the event defined in the Event emitter
created_at: string // Timestamp of when the event was created
payload: object // The data of the event
metadata: object // The metadata of the event
}