The main purpose of the application is to manage income, expenses and savings.
It is a stateless backend REST API with oAuth2 authorization.
User data stores in PostgreSQL database.
Core technologies:
- Java 21
- Spring Boot 3.2.2
- PostgreSQL 16.1
- Maven
OAuth2 authentication through Google or VKontakte
Implemented by spring-boot-starter-oauth2-client but customized to remove sessions and make the application stateless RESTful API with JWT token
Schema:
- Frontend requests this backend API like this: http://localhost:8080/oauth2/authorize/google?redirect_uri=http://localhost:3000/oauth2/redirect
- Backend redirects frontend to chosen provider (Google or VK) login page with specific provider credentials (client_id, client_secret, etc.) and redirect_uri param which provider will use to send response to the backend. Example with Google:
- User sees his login page, accept authentication of our app or not
- Backend handles response from provider on http://localhost:8080/oauth2/callback/PROVIDER
- if it is successfully authenticated then redirects back to the frontend with new JWT token like this: http://localhost:3000/oauth2/redirect?token=TOKEN. Oauth2AuthenticationSuccessHandler
- If it is failed then like this: http://localhost:3000/oauth2/redirect?error=error. Oauth2AuthenticationFailureHandler
See details in HttpCookieOauth2AuthorizationRequestRepository.java
- Run PostgreSQL by docker-compose.yml
- Change GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET and other credentials in .env (or as environment variables) to actual
- Call
mvn clean package
at root of the project to build the application.-Drevision=1.0.0
can be added to change the version of the project - Built result (jar file) will be in 'target' directory at the root of the project
- Call
java -Duser.timezone=UTC -jar money-manager-<version>.jar
to start the application