最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Hide source code of Next.js and Nest.js app on client's deviceserver - Stack Overflow

programmeradmin2浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 2

If 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, run next build to generate an optimized production build. This ensures that only the necessary assets and server-side code are deployed, minimizing exposure. For Nest.js, compile your TypeScript code into JavaScript (tsc or nest 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!

发布评论

评论列表(0)

  1. 暂无评论