TheAxelander / OpenBudgeteer

OpenBudgeteer is a budgeting app based on the Bucket Budgeting Principle
https://theaxelander.github.io
MIT License
761 stars 43 forks source link

[Refactor] Extract API #140

Closed csillaggyujto closed 9 months ago

csillaggyujto commented 1 year ago

Extract REST API between frontend and back-end. Extract separate back-end docker container Create docker-compose file with front-end and back-end. Enables issues: #127 #88 #100 #68

TheAxelander commented 1 year ago

I'm wondering how to split frontend and backend in Blazor Server. Current plan is to have a separate optional container for API.

csillaggyujto commented 1 year ago

This is just a reminder to myself what I'm planning to do. (Or others if they are quicker :), you have decent code quality, so it's easy to contribute) Doing it while keeping Blazor Server would be tricky, but not unfeasible. Trick is to create a business logic layer with an interface at first, make the .Core project a full-fledged back-end project serving a REST API, and make an implementation in the front-end project which depends on the REST API. The FE and BE are now two separate containers (stateless), so they can be now scaled independently, and only need to comminucate in-cluster. Since this will make the FE thinner, we could explore client-side Blazor as well, and others can (I'm not an android dev) look at automation, nexcloud FE, and mobile.

TheAxelander commented 1 year ago

Alright, I'm interested to see how it will look like. Just to share some more details how I was thinking on the overall architecture:

The idea was to have the Core which handles all of the logics and database storage part. As a shared project any .Net based project could just reference and consume it and then build on top of it the UI part. Currently there is only the Blazor Server part.

I later understood having the need of an API which could be also used by any non-.Net based environment, so my plan was to offer it in a separate project/container

csillaggyujto commented 1 year ago

My idea exactly :) The API would be a separate project building on the .Core one, which will host the business logic. So EF packages could be contained to the .Core package and no further. Later, when we have Auth (I'm looking on Keycloak for that one, since you definitely do NOT want to implement OAuth2, and self-hosted guys SSO with Keycloak), we can just wire it up to the API and Blazor (nice experience will be integrating OAuth with Blazor, I'm an Angular girl myself :) ) Obviously separate entry point = separate container, so the app will have 4+1 containers (postgres, BE, FE, Keycloak + init container) of which postgres and keycloak is shared with other self-hosted stuff on the cluster.

csillaggyujto commented 1 year ago

Hi @TheAxelander . The API is being worked on. Please see the branch ISS140 in my fork.