@techify/next-shield
v1.0.5
Published
Security and obfuscation package for Next.js applications
Readme
@techify/next-shield
Advanced security and obfuscation package for Next.js applications. Protect your production builds with automated obfuscation, anti-debugging, and content protection measures.
Installation
npm i @techify/next-shieldUsage
1. Security Initializer
Import and use the SecurityInitializer component in your root layout (e.g., app/layout.tsx or pages/_app.tsx). This component activates runtime protections like DevTools detection, anti-debugging, and copy/paste disabling.
import { SecurityInitializer } from '@techify/next-shield';
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<SecurityInitializer />
{children}
</body>
</html>
);
}Props
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| allowClipboard | boolean | false | When true, allows clipboard operations (copy, cut, paste) and text selection. |
Example with clipboard enabled:
<SecurityInitializer allowClipboard />2. Build Obfuscation
To automatically obfuscate your production build, add the shieldjs ofuscate command to your build script in package.json. This will encrypt and obfuscate the JavaScript and CSS files generated by Next.js.
git
{
"scripts": {
"build": "next build && npx @techify/next-shield ofuscate"
}
}Features
- 🛡️ Source Code Obfuscation: Automatically obfuscates and encrypts JS/CSS chunks in
.nextproduction build. - 🚫 DevTools Detection: Detects when DevTools are opened and redirects to a blank page.
- 🐛 Anti-Debugging: Prevents debugging and code inspection.
- 📋 Content Protection: Disables copy, cut, paste, drag-and-drop, and context menus.
- ⌨️ Shortcut Blocking: Blocks common keyboard shortcuts used for inspection (F12, Ctrl+Shift+I, Ctrl+U, etc.).
License
ISC
