@shikhar1809/vajra-shield
v1.0.1
Published
DDoS protection and bot detection SDK for web applications
Downloads
130
Maintainers
Readme
VAJRA Shield SDK
🛡️ DDoS Protection & Bot Detection for Web Applications
Protect your web applications from DDoS attacks, malicious bots, and suspicious traffic with VAJRA Shield.
Features
- ✅ Real-time DDoS Protection - Automatic rate limiting and traffic analysis
- ✅ Bot Detection - ML-powered bot and crawler identification
- ✅ Geographic Blocking - Block traffic from specific countries
- ✅ Fortress Mode - Emergency lockdown for active attacks
- ✅ Traffic Analytics - Real-time monitoring dashboard
- ✅ Easy Integration - Works with Express, Next.js, and more
Installation
npm install @shikhar1809/vajra-shieldQuick Start
import { Shield } from '@shikhar1809/vajra-shield';
const shield = new Shield({
apiKey: 'your-api-key',
projectId: 'your-project-id'
});
// Start protection
shield.protect();Configuration
const shield = new Shield({
apiKey: 'your-api-key',
projectId: 'your-project-id',
rateLimit: 100, // requests per minute
blockBots: true, // block malicious bots
geoBlocking: ['CN'], // block specific countries
fortressMode: false // emergency lockdown
});Advanced Usage
Log Traffic
await shield.logTraffic({
ip: '192.168.1.1',
path: '/api/users',
method: 'GET',
userAgent: 'Mozilla/5.0...',
blocked: false
});Check if Request Should Be Blocked
const { block, reason } = await shield.shouldBlock(
'192.168.1.1',
'BadBot/1.0'
);
if (block) {
console.log(`Blocked: ${reason}`);
}Enable Fortress Mode
// Emergency lockdown during active attack
await shield.enableFortressMode();
// Disable when safe
await shield.disableFortressMode();Dashboard
Monitor your protected applications in real-time at: https://vajra-protection.vercel.app/compliance
API Reference
Shield
Main class for Shield protection.
Constructor
new Shield(config: ShieldConfig)Methods
protect()- Start protecting your applicationlogTraffic(log: TrafficLog)- Log traffic to VAJRA backendshouldBlock(ip, userAgent)- Check if request should be blockedconfigure(config)- Update Shield configurationenableFortressMode()- Enable emergency lockdowndisableFortressMode()- Disable emergency lockdown
License
MIT
Support
For issues and questions:
- GitHub: https://github.com/shikhar1809/vajra-shield
- Dashboard: https://vajra-protection.vercel.app
