In terms of code, what's running in a web browser is a separate piece of code from what is running on the server. The two are independent. They might be made by the same person, at the same time, meant to work together, but they are independent. Each one is a different code base, different application, running on different machines. They talk to each other through a communications API (using HTTP in most cases.)
What goes out to the browser is getting distributed and is always open (meaning readable by the end user.) You cannot have secrets in that code, because it is not compiled or secret, it's wide open and always visible. So while you can have different licenses involved, you can't keep anything there secret. So that GPL can be viral in that code base should never have an impact on you and no one in the real world cares about it.
On the server side, you have different code. Likely in a different language, runtime, and likely even architecture. That code is never distributed because it's not display code.
If you think of it in terms of ancient client/server apps from the 1980s... if you have data in a database and you make apps that run on desktops that talk to it, and you license those apps under the GPL, that would never imply that because they talked to the database that that database is now GPL'd too.
If the GPL worked that way, you'd have problems because you'd have a situation where end users, buying software with never having seen code or even knowing what it was, would be forcibly making every product on earth GPL'd by nature of installing them and using them together. It just can't work that way or else installing LibreOffice on Windows would make Windows GPL'd.