Learn Kotlin basics by building an Expense Tracker. No frameworks — just Kotlin and fun main().
| Step | Topic | What we build |
|---|---|---|
| Step 1 | Variables and Functions | val, var, fun, string templates |
| Step 2 | Data Class | data class Expense, copy(), toString() |
| Step 3 | HashMap | In-memory database, null safety ?. |
| Step 4 | Service Class | ExpenseService — logic in one place |
Each step has:
- start — project with TODO comments (your tasks)
- final — complete solution with explanatory comments
No git knowledge needed. Just download and open folders.
1. Download the repository:
Click the green Code button → Download ZIP on this page. Unzip the file.
2. Start — Step 1:
- Open IntelliJ IDEA
- File → Open → select the
step-01-startfolder - Wait for dependencies to download
- Run:
mvn compile exec:javaOr: Right-clickMain.kt→ Run - Output appears in the terminal
3. When done or stuck:
Open step-01-final/ — it has the complete solution with explanations.
4. Continue to the next step:
Close the project. Open step-02-start/. Repeat.
Step-by-step flow:
step-01-start/ → complete TODOs → compare with → step-01-final/
step-02-start/ → complete TODOs → compare with → step-02-final/
step-03-start/ → complete TODOs → compare with → step-03-final/
step-04-start/ → complete TODOs → compare with → step-04-final/
Each step has its own branch with files at the root level.
1. Clone the repository:
git clone https://github.com/UnityInFlow/expense-tracker-kotlin.git
cd expense-tracker-kotlin2. Switch to the first step:
git checkout step-01-start3. Work on the tasks:
Edit the files — complete code where you see // TODO:.
Run: mvn compile exec:java
4. When done or stuck:
git stash # save your changes aside
git checkout step-01-final # switch to the solution5. Continue to the next step:
git checkout step-02-startAll branches:
step-01-start step-01-final
step-02-start step-02-final
step-03-start step-03-final
step-04-start step-04-final
Tip — compare your work with the solution:
git diff step-01-final -- src/| Tool | Usage |
|---|---|
| IntelliJ IDEA Community | All steps |
| JDK 21 | Compilation and execution |
Want to turn this into an HTTP API? → expense-tracker-spring