Bank-grade security features including Audit Logging, Secrets Management, and OAuth2 Provider. Build compliant applications with SOC2, HIPAA, and GDPR support.
Immutable audit trails for SOC2, HIPAA, and GDPR compliance.
Unified interface for Vault, AWS Secrets Manager, or environment variables.
Turn your app into an Identity Provider with built-in OAuth2 server.
Protect against brute force and DDoS with configurable rate limits.
Create immutable audit trails for compliance. Use the @Audit decorator or auditLogger() for manual logging.
1import { Audit, auditLogger } from 'canxjs';23class PaymentController {45// Method Decorator - automatically logs action6@Audit('payment.process')7async process(req: Request) {8// Your payment logic here9}1011// Manual Logging - more control12async refund(req: Request) {13await auditLogger().log('payment.refund', {14actor: { id: req.user.id, type: 'user' },15resource: { type: 'payment', id: '123' },16status: 'success',17metadata: { reason: 'customer_request' }18});19}20}
Unified interface to access secrets from Environment, HashiCorp Vault, or AWS Secrets Manager.
1import { secrets } from 'canxjs';23// Get or Throw (if missing)4const apiKey = await secrets.getOrThrow('STRIPE_API_KEY');56// Get with default7const dbHost = await secrets.get('DB_HOST') || 'localhost';89// Batch get10const { DB_USER, DB_PASS } = await secrets.getMany([11'DB_USER',12'DB_PASS'13]);1415// Configure driver16secrets.configure({17driver: 'vault',18url: process.env.VAULT_URL,19token: process.env.VAULT_TOKEN20});
Turn your CanxJS application into an Identity Provider (IdP) with built-in OAuth2 Server support.
1import { OAuth2Server, createAuthorizationServer } from 'canxjs';23const authServer = createAuthorizationServer({4issuer: 'https://auth.myapp.com',5clients: [6{7id: 'mobile-app',8secret: 'super-secret',9redirectUris: ['myapp://callback']10}11]12});1314// Authorization endpoint15app.get('/oauth/authorize', authServer.authorize());1617// Token endpoint18app.post('/oauth/token', authServer.token());1920// Protected resource21app.get('/api/userinfo', authServer.authenticate(), (req) => {22return { user: req.user };23});
Protect your API from abuse with configurable rate limiting at global or route level.
1import { rateLimit, createRateLimiter } from 'canxjs';23// Simple rate limiting4app.use(rateLimit({5windowMs: 15 * 60 * 1000, // 15 minutes6max: 100 // limit each IP to 100 requests per window7}));89// Per-route rate limiting10app.post('/api/login',11rateLimit({ max: 5, windowMs: 60000 }),12loginHandler13);1415// Custom key generator16const userLimiter = createRateLimiter({17max: 1000,18keyGenerator: (req) => req.user?.id || req.ip19});