###### tags `interview`
Wallet System Design
===
Imagine that you are running a project that helps customers manage
their money inside your company.
### Requirements
- 1 Customer can have multiple wallets
- Cusotmers can transfer their money to others
- Customers are able to check their own wallet balance
- Customers are able to query for their transaction history
### Question:
- How would you design from Database layer to API layer
# Database schema
```
wallet
id
transaction
amount +-
wallet_id
SELECT SUM(transaction.amount)
FROM transaction
WHERE wallet_id = ''
```
#### customer
# API Layer
Request example:
```
```
Pseudo Code:
```
```
# Additional Requirements
- Let's say your have servers that can deal with multiple requests at the same time.
- When there are serveral customer doing high frequency transactions, how do you ensure your system is correct
- When system has uncaught error, that causes user's balance not to be updated correctly:
- what would you do to recover your system?
- how do you get the alert as early as you can?
- If you are leading a team, how would you do the technical scoping?