π₯οΈ Chapter 5 β System Design (Software Development)
1) General Architecture
The system architecture shows how major components communicate: a mobile client connects to the backend over the Internet; the server handles business logic and integrates with Firebase (real-time features, messaging), APNS (iOS push), and a relational database (e.g., PostgreSQL/MySQL) for structured data.
- Mobile Client: iOS/Android app handling UI, local validation, and API calls.
- Server (API Layer): Authentication, authorization, business logic, integration gateways.
- Firebase: Realtime DB / Cloud Messaging for certain features.
- APNS: Push notifications for iOS clients.
- Database: Persistent storage for users, orders, products, etc.
2) Sequence Diagrams
For each key use case, a sequence diagram clarifies component interactions over time. Example below for Place an Order:
- App sends checkout request to API.
- Server validates cart & user, reserves stock, calls payment gateway.
- Server persists order, publishes realtime event (optional Firebase), returns confirmation.
- APNS pushes status notification to the userβs device (if enabled).
3) Database Analysis & ER Diagram
The ER diagram defines entities and relationships. Tables should document primary keys, foreign keys, uniqueness, and column types.
Users
Column | Type | PK | FK | Unique | Notes |
---|---|---|---|---|---|
user_id | INT | β | β | β | Auto-increment |
VARCHAR(255) | β | β | β | Login identifier | |
password_hash | VARCHAR(255) | β | β | β | BCrypt/Argon2 |
role | ENUM('customer','admin') | β | β | β | Access level |
created_at | TIMESTAMP | β | β | β | Default now() |
Orders
Column | Type | PK | FK | Unique | Notes |
---|---|---|---|---|---|
order_id | INT | β | β | β | Auto-increment |
user_id | INT | β | β β Users.user_id | β | Owner |
total_price | DECIMAL(10,2) | β | β | β | Sum of items |
status | ENUM('pending','paid','shipped','cancelled') | β | β | β | Lifecycle |
created_at | TIMESTAMP | β | β | β | Default now() |
Add more tables as needed (Products, OrderItems, Payments, etc.).
4) API Analysis
For each endpoint, specify method, URL, headers, body, response, and error cases.
Endpoint: POST /api/orders
Headers |
Authorization: Bearer <token> Content-Type: application/json
|
---|---|
Body |
|
Response (200) |
|
Errors |
|
Repeat for all endpoints (auth, products, cart, payment, profileβ¦).
5) Wireframes (UI/UX)
Provide low-fidelity layouts for key screens (Login, Dashboard, Order Details, Settings). Keep them simple and structural.