When you want to run some big process in the background, we can do two things so that the client feels good and has a good experience

Long Term Polling

The client sends the request.

The server processes the request, and a good, beautiful loader is shown for the client while the server does the process

After completing, the server sends back the response.