ELTE-Clean / Clean-Administration-Platform

2 stars 1 forks source link

Frontend-Backend Connection. #12

Closed Mohido closed 2 years ago

Mohido commented 2 years ago

In this issue you need to start with a local simple build and deployment for the backend and frontend. At the end of this issue, we need to have a simple deployment to fire the frontend and the backend on the local machine and not the Dockerized environment. Running "npm run" from the backend or frontend will have to start the application on the host machine.

Mohido commented 2 years ago

Here you need to add some next js to the server.js so it can handle requests of rendering the pages before calling the APIs.

Mohido commented 2 years ago

@the4t4 @Abdulla-Alkhulaqui @RealGorandos . I am thinking of having a mini-server for the front-end and making the back-end as a pure API back-end. The front-end mini-server will direct any API request to the back-end. Back-end will handle only API requests coming from the sources. This way we can have a very pure back-end that can accept the request of whatever interface, but not specifically coming from react interfaces? What do you people think? This will be very helpful I think in the future, specially for demonstrators to create their own local application and use the API to gather students data (Grading and such). So if the front-end is offline for maintenance, it will not affect the process of the demonstrators nor the teachers.

the4t4 commented 2 years ago

@Mohido So we don't care anymore about deploying both ends at the same time? Also I don't see cases where only the frontend is affected during a maintenance.

Mohido commented 2 years ago

@the4t4 I am thinking of such a similar structure, where device 2 is requesting directly with /api/... and device 1 is connecting to the frontend, and the frontend is requesting to the backend via the api/ requests, to make stuff easier. The diagram is a quite simplified version of the intranet server. So at the end we can have a very minimalist container for the frontend (All it will be doing is loading the pages and directing to the rest api service (backend))

Untitled Diagram drawio

After revising, there will be a connection as well between Auth server (keycloak) and the database (postgre). Moreover, I think there shouldn't be a direct api intranet request between frontend and backend. It should lead back to the load balancer then the load balancer can forward to the intranet service (backend).

the4t4 commented 2 years ago

@Mohido so in regards to this task, connect backend to frontend, it should be backend <-> load balancer <-> frontend? I think the load balancer should be implemented in nginx before ANY requests enter.

Mohido commented 2 years ago

@the4t4 Yeah. This issue must be delayed, and a minimalist frontend server should be installed. Then the frontend server will handle the api request and just forward the request as it is to the load balancer (Since we don't have a load balancer now, we can just forward the api call directly to the backend service). So for now it can be internet <-> frontend <-> backend or internet <-> backend (via api calls) Once we have a load balancer or an Nginx container, we can do: internet <-> nginx (load balancer) <-> frontend <-> nginx <-> backend ... or directly by using the api from even your shell environment: internet <-> nginx <-> backend

the4t4 commented 2 years ago

We will have an independent backend for the frontend.