Building an App Backend: Part 2

Pete Casson
Geek Culture
Published in
3 min readJun 17, 2021

--

Hi again! In the first part we looked at setting up the initial API using a load balancer and kubernetes services. That gave us the basic API setup we needed to get off the ground. Now we look at the design behind the API.

Keeping with the online store theme we’re going to process an order. Here’s the flow

  • Customer places an order on the store
  • Order created in the database
  • Customer is notified via email confirmation of the order
  • Notification sent to warehouse to pack the order

There’s more to the process but for now let’s go through this.

When the customer places the order on the online store the client app communicates with our API with a POST request to the /orders endpoint. This endpoint creates the object in the database and sends the response back to the store.

Seems easy enough, but theres more to do. Your POST /orders service should only create the order in the database and not process anything else. Why? Because you need to respond to the client as fast as possible, if you go through the whole order process immediately they’ll be waiting a while for a response.

Message Queuing

This is where message queuing comes in.

A message queue is a queue of messages sent between apps or services.

--

--

Pete Casson
Geek Culture

CTO, founder, speaker and general geek. Constantly looking to make technology simple and accessible.