Skip to content

janbabak/Moneybag-BE

Repository files navigation

Moneybag logo

Moneybag - Backend

Java Spring Apache Maven MySql Swagger Postman

📝 Description

Moneybag is a tool for managing personal finances that allows users to create and categorize records, analyze income and expenses, and manage multiple accounts.

The backend was written in Java using the Spring framework and uses a MySql database for data persistence. The frontend is a single-page application connected via REST API and built with TypeScript, Vue.js, and Vuetify.

🔗 Links

⚽️ Project Goals

I created this project for several reasons. Firstly, I wanted to experiment with various technologies. Secondly, I aimed to experience all stages of the software development cycle. Additionally, I intended to add work to my portfolio that would demonstrate my development skills.

🏗️ Realization

To begin, I made a list of the necessary features and selected the appropriate technologies, and then started developing the backend server.

I developed the backend in Java and Spring framework and chose the MySql database for data persistence. The application utilizes the MVC architecture. The database runs in a Docker container. Authentication and authorization are provided by JWT token using Spring Security. The API generates Open Api documentation automatically. Additionally, I created documentation for the API using Postman, which includes example requests and responses.

🚀 Features

  • Multiple financial accounts
  • Add records and categorize them
  • Analytic of categories, incomes, expenses, cash flow...
  • Charts
  • Responsive web interface

🧑‍🔬 Technologies

❌ Issues

During the development, I encountered some issues. One of them was adding filtering and sorting parameters to the "get all records" endpoint. To solve this problem, I used the specification-arg-resolver library which can map request parameters to Jpa specifications and extended the record repository by PagingAndSortingRepository, and JpaSpecificationExecutor.

😁 Conclusion

I originally planned to create a much smaller project but finished with a larger one. I gained new knowledge during development - for instance, how to elegantly add filtering parameters to the API endpoint or use JPQL for more complex database queries. So, I am satisfied with the result of my work.

✅ Software requirements

  • Java 17
  • Docker, Docker compose

🎬 How to run

Clone repository

git clone https://github.com/babakjan/Moneybag-BE.git
cd Moneybag-BE/

Start database

docker compose up -d

Start the app

  • Set the development environment. The app will connect to the local database.

    export spring_profiles_active=dev
  • Create database schema - open ./src/main/resources/application.yml set the value of spring.jpa.hibernate.ddl-auto to create.

  • Run the app (app will run on http://localhost:8000/api)

    ./mvnw spring-boot:run
  • If you want to initiate the database with test data, stop the app and undo the changes you've done in the application properties file (set create to none), plus make sure, that the spring.sql.init.mode has value always.

  • run the app again

    ./mvnw spring-boot:run
  • If you want to run the app repeatedly, change the previously added always to never line because you don't want to insert test data every time you restart the app.

  • Swagger documentation of running app can be found at http://localhost:8000/api/swagger-ui/index.html

🎆 Screenshots

Dashboard

Dashboard

Dashboard

Dashboard