Installation

Learn how to install FortressAuth and its dependencies.

Prerequisites

Before installing FortressAuth, ensure you have:

  • Node.js 18 or later
  • npm, yarn, or pnpm
  • A supported database (PostgreSQL, MySQL, or SQLite)

Install Core Package

The core package contains the main authentication logic:

# Using npm
npm install @fortressauth/core

# Using yarn
yarn add @fortressauth/core

# Using pnpm
pnpm add @fortressauth/core

The core package includes:

  • FortressAuth - Main authentication orchestrator
  • ConsoleEmailProvider - Development email provider (logs to console)
  • All domain entities and types
  • Zod schemas for validation

Install Database Adapter

Install the SQL adapter for database support:

# Using npm
npm install @fortressauth/adapter-sql

# Using yarn
yarn add @fortressauth/adapter-sql

# Using pnpm
pnpm add @fortressauth/adapter-sql

The SQL adapter supports:

  • PostgreSQL - Recommended for production
  • MySQL - Full support with InnoDB
  • SQLite - Great for development and small deployments

You'll also need to install a database driver:

# For PostgreSQL
npm install pg

# For MySQL
npm install mysql2

# For SQLite
npm install better-sqlite3

Install HTTP Server (Optional)

If you want a standalone HTTP server:

# Using npm
npm install @fortressauth/server

# Using yarn
yarn add @fortressauth/server

# Using pnpm
pnpm add @fortressauth/server

The server package provides:

  • RESTful API endpoints for all auth operations
  • OpenAPI documentation with Scalar UI
  • CORS configuration
  • Cookie-based session management
  • Health check endpoints

Install Client SDKs (Optional)

Install the SDK for your frontend framework:

# React
npm install @fortressauth/react-sdk

# Vue
npm install @fortressauth/vue-sdk

# Angular
npm install @fortressauth/angular-sdk

# Svelte
npm install @fortressauth/svelte-sdk

# React Native / Expo
npm install @fortressauth/expo-sdk

# Electron
npm install @fortressauth/electron-sdk

Email Providers (Optional)

For production email delivery, install one of the email provider packages:

# AWS SES
npm install @fortressauth/email-ses

# SendGrid
npm install @fortressauth/email-sendgrid

# SMTP (Nodemailer)
npm install @fortressauth/email-smtp

TypeScript Configuration

FortressAuth is written in TypeScript and provides full type definitions. Ensure your tsconfig.json includes:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true
  }
}

Next Steps

Now that you have FortressAuth installed, check out the Quick Start guide to set up your first authentication flow.