IAM
Essentials
Core concepts and features of the IAM service, from JWT tokens and anomaly detection to rate limiting, database schema, and service startup.
The IAM service is composed of several interconnected subsystems. Each one is designed to work independently as a library export, and together they form a complete authentication stack. This section documents every core concept in detail.
Token system
Tokens
How the IAM service generates, caches, verifies, rotates, and revokes JWT access tokens and MySQL-backed refresh tokens.
Access Tokens
How the IAM service generates, caches, verifies, and revokes access tokens, and how library users wire roles and route protection.
Authentication flows
Signup
How the IAM service registers new users, the full validation pipeline from rate limiting through email domain verification to password breach checks.
Login
How the IAM service authenticates users with email and password, the rate limiting and validation pipeline, device trust, and token issuance.
Security and verification
Anomaly Detection
Nine sequential behavioral checks that run on every refresh-token use, including canary cookie matching, IP range comparison, and device fingerprint consistency.
MFA
Adaptive email OTP triggered automatically by anomaly detection, custom MFA flows for protecting sensitive actions, and OTP code generation and verification.
Magic Links
Signed temporary JWT links for adaptive MFA, password reset, email update, and custom flows. All link tokens are cached and single-use by design.
Fingerprinting
How the IAM service builds a composite device fingerprint from IP geolocation and user-agent parsing, and how it persists and compares fingerprints for anomaly detection.
Communication and delivery
Infrastructure
Rate Limiting
Layered rate limiters with union pairing, strike-based blocking, consecutive failure caches, and per-endpoint limiter groups for every sensitive route.
Logging
Application and HTTP request logging with Pino, log file layout, redaction, request IDs, child loggers, and asset filtering.