Skip to content

UnityInFlow/expense-tracker-spring

Repository files navigation

Expense Tracker — Spring Boot

Learn Kotlin + Spring Boot by building an Expense Tracker with HTTP API. From your first @RestController to a documented REST API with Swagger UI.

Workshop Structure

Step Topic What we build
Step 1 First Controller @GetMapping, @PathVariable, string templates
Step 2 Data Class data class Expense, JSON responses
Step 3 HashMap + Service ExpenseService, POST, DELETE, CRUD
Step 4 ResponseEntity Proper HTTP status codes (200, 404)
Step 5 REST Best Practices Complete API with filters and bulk operations
Step 6 Swagger UI SpringDoc, @Operation, API documentation

Each step has:

  • start — project with TODO comments (your tasks)
  • final — complete solution with explanatory comments

How to Work With This Repository

Option A — Folders (recommended for beginners)

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-start folder
  • Wait for dependencies to download
  • Run: ./mvnw spring-boot:run
  • Open in browser: http://localhost:8080/hello

3. When done or stuck:

Open step-01-final/ in IntelliJ — it has the complete solution.

4. Continue to the next step:

Stop the app (Ctrl+C). Close project. Open step-02-start/. Run again.

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/
step-05-start/  →  complete TODOs  →  compare with  →  step-05-final/
step-06-start/  →  complete TODOs  →  compare with  →  step-06-final/

Option B — Git branches (for advanced users)

Each step has its own branch with files at the root level.

1. Clone the repository:

git clone https://github.com/UnityInFlow/expense-tracker-spring.git
cd expense-tracker-spring

2. Switch to the first step:

git checkout step-01-start

3. Work on the tasks:

Edit files — complete code where you see // TODO:. Run: ./mvnw spring-boot:run Open: http://localhost:8080/hello

4. When done or stuck:

git stash                     # save your changes aside
git checkout step-01-final    # switch to the solution

5. Continue to the next step:

git checkout step-02-start

All 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
step-05-start    step-05-final
step-06-start    step-06-final

Tools

Tool Usage
IntelliJ IDEA Community All steps
JDK 21 Compilation and execution
Browser Test API endpoints

Related

Pure Kotlin version (no Spring):expense-tracker-kotlin

Session 2 — SQLite + Repository:expense-tracker-workshop-02

About

Expense Tracker — Spring Boot (Controller-first). Step-by-step workshop for learning Kotlin + Spring Boot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages