Assignments; questions and answers,
complete solution.
Christopher Parrish Documentation Assignments - Set
2
Assignment 6: System Design Documentation
Question 1
Document a microservices architecture for a food delivery application with the
following services:
• Order Service (handles order creation, updates, status)
• Restaurant Service (manages restaurant info, menus)
• Delivery Service (coordinates delivery personnel)
• Payment Service (processes payments)
• Notification Service (sends emails/SMS)
• API Gateway (single entry point)
Include:
1. Sequence diagram for placing an order
2. Service contracts for Order Service API
, 3. Data flow description
4. Failure handling strategy
Answer:
1. Architecture Overview
text
┌─────────────────────────────────────────────────────────────────────┐
│ FOOD DELIVERY MICROSERVICES │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Mobile │ │ Web │ │ Restaurant │ │
│ │ App │────│ App │────│ Portal │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │ │
│ ┌──────▼──────┐ │
│ │ API Gateway │ │
│ │ (Kong/Ocelot)│ │
│ └──────┬──────┘ │
│ │ │
│ ┌──────────┬─────────┼─────────┬──────────┬──────────┐ │
│ ┌───▼──┐ ┌─────▼────┐┌──▼───┐┌────▼────┐┌─────▼────┐┌───▼──┐ │
│ │Order │ │Restaurant││Delivery││Payment ││Notification││Auth │ │
│ │Service│ │ Service ││Service ││Service ││ Service ││Service│ │
│ └──┬───┘ └─────────┘└────────┘└────────┘└──────────┘└──────┘ │
│ │ │ │ │ │ │
│ ┌──▼────────▼──────────▼─────────▼─────────▼──────────────┐ │
│ │ Message Queue (RabbitMQ/Kafka) │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
,2. Sequence Diagram: Order Placement
3. Order Service API Contract (OpenAPI 3.0)
yaml
openapi: 3.0.0
info:
title: Order Service API
version: 1.0.0
description: Handles order lifecycle for food delivery
paths:
/orders:
post:
summary: Create a new order
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrderRequest'
responses:
'201':
description: Order created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid order data
'503':
description: Service temporarily unavailable
/orders/{orderId}:
get:
, summary: Get order details
parameters:
- name: orderId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Order details
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
components:
schemas:
CreateOrderRequest:
type: object
required:
- customerId
- restaurantId
- items
- deliveryAddress
properties:
customerId:
type: string
format: uuid
restaurantId:
type: string
format: uuid
items:
type: array
items:
$ref: '#/components/schemas/OrderItem'
deliveryAddress:
$ref: '#/components/schemas/Address'
specialInstructions: