Make the Data Dependable
The previous modules made the Ledger useful. This module makes the data underneath those features dependable.
We will work from the inside out. First we will decide exactly how money and dates are represented. Then we will move the important validation rules to the server, where they cannot be bypassed by a different client. After that we will put financial calculations in one place, strengthen the JSON persistence layer, and make API failures predictable for the browser.
You will work mainly in these areas:
client/src/lib/finance.js
server/src/domain/transactions.js
server/src/db.js
server/src/asyncHandler.js
server/src/app.js
client/src/lib/api.js
What you should be able to explain at the end
You should be able to answer four questions without guessing:
- Why does the app store
8450instead of84.50? - Where does the app decide whether a transaction is valid?
- What happens if two writes reach the JSON database close together?
- How does a server error become a readable message in the UI?
Checkpoint
Before moving on, open the files listed above and note which layer each one belongs to: browser utility, server validation, persistence, or error handling. You do not need to change anything yet.