Introduction to FortressAuth
FortressAuth is a secure-by-default, database-agnostic authentication library built with TypeScript and hexagonal architecture.
What is FortressAuth?
FortressAuth is a production-ready authentication library that provides secure user authentication, session management, email verification, and password reset functionality. It's designed with security best practices built-in and follows hexagonal architecture for maximum flexibility.
Key Features
- Secure by Default - Argon2id password hashing, split session tokens, timing-attack prevention, and rate limiting built-in.
- Database Agnostic - Works with PostgreSQL, MySQL, and SQLite via the SQL adapter, or bring your own adapter.
- Email Provider Agnostic - Pluggable email providers including Console, Resend, AWS SES, SendGrid, and SMTP.
- Hexagonal Architecture - Clean separation between business logic and infrastructure with zero dependencies in core.
- Type Safe - Written in TypeScript with comprehensive type definitions for excellent developer experience.
Architecture Overview
FortressAuth follows a ports-and-adapters (hexagonal) architecture pattern. The core business logic has no external dependencies, making it easy to test and adapt to different infrastructure requirements.
Core Components
- FortressAuth - The main orchestrator class that coordinates all authentication operations.
- AuthRepository - The persistence layer interface for storing users, accounts, sessions, and tokens.
- EmailProvider - A pluggable service for sending verification and password reset emails.
- RateLimiter - A component that limits authentication attempts to prevent brute force attacks.