I have this requirement that I would deploy the application (Our company's) to a client device/server, but I don't want to expose my codebase as there is a potential issue like rebranding or discontinuing our service after. Is there any like packages or methods to do this?
I have this requirement that I would deploy the application (Our company's) to a client device/server, but I don't want to expose my codebase as there is a potential issue like rebranding or discontinuing our service after. Is there any like packages or methods to do this?
Share Improve this question asked Feb 6 at 0:05 Karl CusiKarl Cusi 491 silver badge5 bronze badges 2- Most times these concerns are unfounded. People usually just use client side code and don't suffer from this. If you're certain this is not your case then don't use a framework with a client side (nextjs) – Estus Flask Commented Feb 6 at 8:15
- When the code is built usually the code get uglified and not really readable!!! – Faouzi Mohamed Commented Feb 6 at 9:18
1 Answer
Reset to default 2If you want to hide or at least minimize your code exposure to your client, you can try these methods:
Compile Your App: For
Next.js
, runnext build
to generate an optimized production build. This ensures that only the necessary assets and server-side code are deployed, minimizing exposure. ForNest.js
, compile your TypeScript code into JavaScript (tsc
ornest build
). While JavaScript is still readable, it reduces direct access to the original TypeScript source code.Dockerize Your App: Package your application into a Docker container so the client only runs the container without accessing the raw source code. This method adds an extra layer of abstraction, making it harder for clients to extract or modify the code.
Hope this answers your question!