We work with typescript and webpack in a single repository to develop our game. To ensure shared states and objects, we have organized the code into three main folders.
This shared code is utilized on both the backend and frontend. It is crucial that server code is not imported by shared or client code to avoid any security vulnerabilities.
Previously, mistakenly importing server code led to a significant security breach, requiring us to change all keys. Unfortunately, there is no current system in place to prevent this from happening again.
One solution could be to separate the server and client into distinct projects, but this would be time-consuming and overly complex.
An alternative approach could involve running a script to detect instances where server code is being imported into shared or client files. This script could be created using Python and executed when pushing new code. However, tools like VSCode or npm may already offer similar functionalities.
Any assistance or advice on this matter would be greatly appreciated.