DEV Community

mmvergara
mmvergara

Posted on

3

"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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay