DEV Community

mmvergara
mmvergara

Posted on

"Utils.ts" Security?

Up until now I always put my client side and server side utils on the same file

1st Method

---rootfiles...
---utils.ts
Enter fullscreen mode Exit fullscreen mode

2nd Method
but maybe this approach is better and more secure

---Utils
------ClientUtils.ts
------ServerUtils.ts
------SharedUtils.ts
Enter fullscreen mode Exit fullscreen mode

This method makes it clearer which code is intended to run on the client side and which code is designed to run on the server side, which can help you manage and comprehend your codebase more easily.


QUESTION

Let's assume we are doing named imports
Is using 1st method can expose some server side utils in the client side?

Top comments (0)