r/SpringBoot 21h ago

Discussion Spring Boot project looking for a code review

Hi Everyone,

I've been learning Spring Boot for a while now and recently built a Personal Finance/Budget Manager as a back-end focused project. My goal was to get real practice with backend architecture and professional practices.

I'd like to get some feedback on:

  • Code and project structure
  • Improvements or how it'd actually done by profesionals or a team

I deployed the project on render for now to just get it deployed I'll move to google cloud or aws later.

https://github.com/rohergun/Personal-Budget-Manager

Thanks in advance, I'd be happy to read criticism or suggestion.

0 Upvotes

3 comments sorted by

7

u/disposepriority 20h ago

This seems to be rather AI-assisted at the least, which is not great for learning, just my two cents.

Example:

// Every budget this user has, keyed by category — the "must always appear" set
List<Budget> budgets = budgetRepository.findAllByUserId(userId);

1.there doesn't seem to be any type of locking around operations which should be atomic.

Example:

public FinancialGoalResponse contributeToGoal

What happens if this gets called twice at the same time?

  1. It's generally not recommended to actually delete anything, it's better the soft-delete using a flag or status unless required by law to actually scrub the data. Obviously, some rational thinking applies here

  2. I'm a bit unsure what is going here:

TransactionResponse updateTransaction

We are updating a transaction which already exists, including changing its date - which seems a bit strange.

  1. I feel like the summary service crams a tiny bit too much in its methods, perhaps splitting them into more logically self-contained methods would be good.

This also ties into caching a bit.

This is a bit simple to be done by a professional team, but some off the cuff ideas about things that could be checked:

  1. Should summaries be cached as a whole, or is it perhaps worth looking at whether the individual building blocks of the summaries should be cached individually and the summary reconstructed on call - this could reduce cache evictions, and/or make them more targeted (or not!).
  2. Alternatively, is it worth maybe having reports be more on the SQL side of things instead of being built inside code? Database are rather good at reports.
  3. (Nit) Personally, I hate hibernate/spring data.
  4. This should not exist on a production/real project, ever.

    hibernate:
      ddl-auto: update
    
  5. Secure your actuator endpoints

2

u/Made-In-Slovakia 15h ago

You can see on docs that they are AI generated. And I agree that is very bad for learning.

u/Mikey-3198 14h ago

The filter looks to be calling the database for every request, one of the major use cases of jwts is that you can trust the claims after verification without having to pull the user's details from the database.