KeypointJS is a sophisticated, layered authentication and authorization framework for Node.js with built-in security features, plugin architecture, and real-time capabilities.
Multi-layered protection
~140KB gzipped
Extensible architecture
npm install keypointjs
Built for security, designed for developers
8-layer middleware system for comprehensive API protection and threat mitigation.
Extensible with custom plugins. Built-in Audit Logger, Rate Limiter, and WebSocket Guard.
Built-in HTTP server with zero dependencies. No Express or Fastify required.
Real-time communication with built-in authentication and connection management.
Rule-based access control with IP whitelisting, rate limiting, and time-based rules.
Choose between in-memory, file-based, or implement your own storage backend.
How KeypointJS processes every request
Request preprocessing and validation
HTTP/HTTPS/WebSocket detection & parsing
Cross-origin resource sharing handling
Authentication and keypoint verification
Authorization rules evaluation
Plugin middleware execution
Business logic processing
Response formatting and sending
Start securing your API with just a few lines of code
import { KeypointJS } from 'keypointjs';
// Initialize the framework
const api = new KeypointJS({
requireKeypoint: true,
strictMode: false,
enableCORS: true,
maxRequestSize: '5mb'
});
// Create and store a keypoint
const keypoint = await api.createKeypoint({
keyId: 'test_key',
secret: 'test_secret',
scopes: ['api:public', 'users:read'],
protocols: ['https', 'wss'],
allowedOrigins: ['https://example.com'],
rateLimit: {
requests: 1000,
window: 3600 // 1 hour
}
});
// Define protected route
api.get('/api/data', (ctx) => {
return ctx.json({
data: 'protected data',
keypointId: ctx.getKeypointId(),
scopes: ctx.keypoint?.scopes
});
});
// Start server
api.listen(3000, 'localhost', () => {
console.log('KeypointJS server running on port 3000');
});
Total Downloads
GitHub Stars
Forks
Latest Version
Everything you need to build secure applications
Complete API documentation with examples
Built-in plugins and custom plugin creation
Production-ready security configurations
Docker, Kubernetes, and cloud deployment
Real-world use cases and tutorials
Migrating from other authentication solutions
See KeypointJS in action
// Enable WebSocket support
const wsGuard = api.enableWebSocket({
path: '/ws',
requireKeypoint: true,
pingInterval: 30000,
maxConnections: 1000
});
// Handle new connections
wsGuard.onConnection((connection) => {
console.log('New WebSocket connection:', connection.id);
});
// Handle messages with authentication
wsGuard.onMessage('chat', (message, connection) => {
if (!connection.scopes?.includes('chat:write')) {
return { type: 'error', error: 'Insufficient scope' };
}
// Broadcast to all connections
wsGuard.broadcast({
type: 'chat',
from: connection.keypointId,
message: message.text,
timestamp: new Date().toISOString()
});
return { type: 'ack', success: true };
});
Join thousands of developers who trust KeypointJS for their authentication needs.