Event Modeling

Learn how to use subscriptions to model an event.

Introduction to modeling

Subscriptions push data in response to events or actions within our system, so it isn’t enough to think of subscriptions as a purely API-related concern. A system that can’t model change will have a tough time communicating about changes to subscribers. When we design our application, we want to arrive at a model that lets us track the life cycle of an order as it is started, completed, and ultimately picked up by the customer. Along the way, each of these changes should be transmitted immediately to employees tasked with making the order, and to the hungry customer waiting for their food.

This part of the system is a bit more involved than the menu, so let’s take it in pieces. The first piece focuses on creating the orders and building our first simple subscription to see those orders in real-time. Then, we’ll circle back and expand these abilities to cover the full life cycle of the order.

Placing orders

To jump-start this process, we’re going to use the Phoenix context generator to rapidly build out the main files we need:

Get hands-on with 1200+ tech skills courses.