vLoading... 200+ Downloads

Layered Authentication for Modern APIs

KeypointJS is a sophisticated, layered authentication and authorization framework for Node.js with built-in security features, plugin architecture, and real-time capabilities.

8-Layer Security

Multi-layered protection

Lightweight

~140KB gzipped

Plugin System

Extensible architecture

Install with npm
npm install keypointjs

Why KeypointJS?

Built for security, designed for developers

Layered Security

8-layer middleware system for comprehensive API protection and threat mitigation.

Plugin Architecture

Extensible with custom plugins. Built-in Audit Logger, Rate Limiter, and WebSocket Guard.

High Performance

Built-in HTTP server with zero dependencies. No Express or Fastify required.

WebSocket Support

Real-time communication with built-in authentication and connection management.

Policy Engine

Rule-based access control with IP whitelisting, rate limiting, and time-based rules.

Multiple Storage

Choose between in-memory, file-based, or implement your own storage backend.

8-Layer Architecture

How KeypointJS processes every request

0

Pre-processing Hooks

Request preprocessing and validation

1

Protocol Engine

HTTP/HTTPS/WebSocket detection & parsing

2

CORS Middleware

Cross-origin resource sharing handling

3

Keypoint Validation

Authentication and keypoint verification

4

Policy Check

Authorization rules evaluation

5

Plugin Processing

Plugin middleware execution

6

Route Execution

Business logic processing

7

Response Processing

Response formatting and sending

Get Started in 60 Seconds

Start securing your API with just a few lines of code

Basic Setup
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');
});
0

Total Downloads

0

GitHub Stars

0

Forks

v1.0.0

Latest Version

Comprehensive Documentation

Everything you need to build secure applications

Real-World Examples

See KeypointJS in action

WebSocket Authentication
// 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 };
});

Ready to Secure Your API?

Join thousands of developers who trust KeypointJS for their authentication needs.