Understand the Ledger Data Model
Open these two files:
server/data/db.json
server/src/routes/transactions.js
The JSON file contains the records the server keeps. The transaction route describes the shape the API accepts and returns.
A starter transaction has these fields:
{
id: "…",
date: "2026-09-01",
description: "Salary",
category: "Income",
amount: 3200,
type: "income"
}
Here is what each property means:
iduniquely identifies the record. The server creates it withrandomUUID(), so the form does not need to invent an id.dateis the calendar day the transaction belongs to, stored asYYYY-MM-DD.descriptionis the text the user enters, such asSalaryorGroceries – Mwenge market.categoryidentifies the expense category in the starter data. Income is currently represented by the special textIncome; we will improve that model later.amountis the numeric value in the starter project. Later, we will replace this representation with integer cents so money calculations are safer.typeis eitherincomeorexpense. This tells the application how the amount should affect totals.
Now open server/src/routes/categories.js and find the object created when a category is added:
const category = { name, color };
A category therefore has two values:
nameis the value stored on an expense transaction.coloris the visual color used by the client when it displays that category.
Why there are two collections
transactions are the financial events. categories are the reusable labels that organize expense events.
That separation matters because one category can describe many transactions. For example, the Food category can be used by several grocery transactions without copying the category’s color or other metadata into every transaction.
Test it
Find Salary in server/data/db.json and locate the same record in the running Ledger. Identify its date, description, amount, and type values.
Then find the Housing category and identify the property that controls its visual color.
Checkpoint
You can explain every field in a starter transaction and every field in a starter category, including which value is generated by the server.