$ show curveball/a12n-server
This is a fully-featured OAuth2 and OpenID Connect authentication and authorization server built with Node.js/TypeScript and the Curveball framework. It provides user management, role-based access control, multi-factor authentication (TOTP, WebAuthn), and an administrative web UI. The project is self-contained with its own database migrations, CLI binary, and Docker support. It supports multiple database backends (PostgreSQL, MySQL, SQLite) via Knex. The codebase is well-structured following a modular architecture with clear separation between controllers, services, and format handlers. It implements the OAuth2 authorization framework including authorization code, client credentials, implicit, and refresh token grants with PKCE support. The OpenID Connect layer provides discovery, JWKS, and userinfo endpoints. Authentication is modular with pluggable challenge strategies for passwords, TOTP, email OTP, and WebAuthn. The project is retired, as explicitly stated in the README, and the authors recommend migrating to Keycloak. Despite being deprecated, the code remains a solid reference implementation for OAuth2/OIDC in Node.js and contains several reusable components including an abstract key-value store, an SMS adapter pattern, and cryptographic utilities.
The LLM identified 3 files worth highlighting for reuse:
Defines a generic, abstract key-value store interface with methods like get, set, delete, and a TTL-based expiry. The implementation is completely self-contained and can be extracted to provide reusable storage abstraction for session tokens, verification codes, or any temporary data. The pattern enables easy switching between in-memory, Redis, or custom backends.
Provides a minimal interface for sending SMS messages, with a concrete adapter for AWS SNS. This is a textbook example of the adapter pattern for external services, making it straightforward to integrate alternative SMS providers without changing core logic. The interface is small and focused.
A self-contained module for cryptographic operations including secure random token generation (URL-safe and hex), diceware-style password generation, and verification digit computation. It relies only on Node.js crypto module and demonstrates best practices for generating high-entropy secrets and tokens.