open-index/open-npm huggingface dataset:
npm package: @fortressauth/adapter-mongodb
Description: MongoDB adapter for FortressAuth using the official MongoDB Node.js driver.
Latest version: 0.1.12

# @fortressauth/adapter-mongodb

MongoDB adapter for FortressAuth using the official MongoDB Node.js driver.

## Features

- Native MongoDB storage with typed collections
- Automatic index creation helper
- Transactions with replica set support and graceful fallback
- Full AuthRepository implementation

## Installation

```bash
npm install @fortressauth/adapter-mongodb @fortressauth/core mongodb
# or
pnpm add @fortressauth/adapter-mongodb @fortressauth/core mongodb
# or
yarn add @fortressauth/adapter-mongodb @fortressauth/core mongodb
```

## Connection Examples

```bash
# Local MongoDB
MONGODB_URL=mongodb://user:password@localhost:27017/fortressauth

# MongoDB Atlas
MONGODB_URL=mongodb+srv://user:password@cluster.mongodb.net/fortressauth
```

## Quick Start

```typescript
import { MongoClient } from 'mongodb';
import { MongoAdapter } from '@fortressauth/adapter-mongodb';

const client = new MongoClient(process.env.MONGODB_URL!);
await client.connect();

const adapter = new MongoAdapter({
  client,
  databaseName: 'fortressauth',
});

await adapter.ensureIndexes();
```

## Collections & Schemas

The adapter uses the following collections (names are configurable):

- `users`: `{ _id, email, emailVerified, createdAt, updatedAt, lockedUntil }`
- `accounts`: `{ _id, userId, providerId, providerUserId, passwordHash, createdAt }`
- `sessions`: `{ _id, userId, selector, verifierHash, expiresAt, ipAddress, userAgent, createdAt }`
- `email_verifications`: `{ _id, userId, selector, verifierHash, expiresAt, createdAt }`
- `password_resets`: `{ _id, userId, selector, verifierHash, expiresAt, createdAt }`
- `login_attempts`: `{ _id, userId, email, ipAddress, success, createdAt }`

You can override collection names:

```typescript
const adapter = new MongoAdapter({
  client,
  databaseName: 'fortressauth',
  collections: {
    emailVerifications: 'auth_email_verifications',
    passwordResets: 'auth_password_resets',
  },
});
```

## Index Requirements

Call `ensureIndexes()` once during startup to create required indexes:

- `users.email` unique
- `accounts.providerId + accounts.providerUserId` unique
- `sessions.selector` unique
- `sessions.expiresAt` TTL (auto cleanup)
- `email_verifications.selector` unique
- `password_resets.selector` unique
- Support indexes for lookups (userId, email + createdAt)

## Transactions

MongoDB transactions require a replica set or sharded cluster. For local development:

```bash
mongod --replSet rs0
mongosh --eval "rs.initiate()"
```

The adapter automatically falls back to non-transactional execution if transactions are not
supported. You can also disable transactions explicitly:

```typescript
const adapter = new MongoAdapter({
  client,
  databaseName: 'fortressauth',
  enableTransactions: false,
});
```

## Database Permissions

The MongoDB user must be able to:

- Read and write all collections used by the adapter
- Create and drop indexes

## License

MIT
npm package: @fortressauth/angular-sdk
Description: Angular service for FortressAuth authentication.
Latest version: 0.1.12

# @fortressauth/angular-sdk

Angular service for FortressAuth authentication.

## Features

- Injectable `AuthService` with RxJS observables
- Cookie-based sessions with CSRF handling
- TypeScript types for auth responses and user state

## Installation

```bash
npm install @fortressauth/angular-sdk
# or
pnpm add @fortressauth/angular-sdk
# or
yarn add @fortressauth/angular-sdk
```

## Quick Start

### Configure base URL

Provide a base URL via `AUTH_CONFIG` or set `window.__FORTRESS_API_URL__` at runtime.

```ts
import { bootstrapApplication } from '@angular/platform-browser';
import { AUTH_CONFIG } from '@fortressauth/angular-sdk';
import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent, {
  providers: [
    { provide: AUTH_CONFIG, useValue: { baseUrl: 'http://localhost:3000' } },
  ],
});
```

### Use the service

```ts
import { Component } from '@angular/core';
import { AuthService } from '@fortressauth/angular-sdk';

@Component({
  selector: 'app-login',
  template: `
    <div *ngIf="(loading$ | async)">Loading...</div>
    <div *ngIf="(error$ | async) as err">{{ err }}</div>
    <button (click)="signIn()">Sign In</button>
  `,
})
export class LoginComponent {
  user$ = this.auth.user$;
  loading$ = this.auth.loading$;
  error$ = this.auth.error$;

  constructor(private readonly auth: AuthService) {}

  async signIn() {
    await this.auth.signIn('user@example.com', 'password123');
  }
}
```

## License

MIT
npm package: @fortressauth/email-sendgrid
Description: SendGrid email provider for FortressAuth.
Latest version: 0.1.12

# @fortressauth/email-sendgrid

SendGrid email provider for FortressAuth.

## Installation

```bash
npm install @fortressauth/email-sendgrid
# or
pnpm add @fortressauth/email-sendgrid
# or
yarn add @fortressauth/email-sendgrid
```

## Usage

```ts
import { SendGridEmailProvider } from '@fortressauth/email-sendgrid';

const provider = new SendGridEmailProvider({
  apiKey: process.env.SENDGRID_API_KEY ?? '',
  fromEmail: 'noreply@yourdomain.com',
  fromName: 'Your App',
});
```

## License

MIT
npm package: @fortressauth/email-ses
Description: AWS SES email provider for FortressAuth.
Latest version: 0.1.12

# @fortressauth/email-ses

AWS SES email provider for FortressAuth.

## Installation

```bash
npm install @fortressauth/email-ses
# or
pnpm add @fortressauth/email-ses
# or
yarn add @fortressauth/email-ses
```

## Usage

```ts
import { SESEmailProvider } from '@fortressauth/email-ses';

const provider = new SESEmailProvider({
  region: 'us-east-1',
  fromEmail: 'noreply@yourdomain.com',
  fromName: 'Your App',
  credentials: {
    accessKeyId: process.env.SES_ACCESS_KEY_ID ?? '',
    secretAccessKey: process.env.SES_SECRET_ACCESS_KEY ?? '',
    sessionToken: process.env.SES_SESSION_TOKEN,
  },
});
```

## License

MIT
npm package: @fortressauth/email-smtp
Description: SMTP email provider for FortressAuth (via nodemailer).
Latest version: 0.1.12

# @fortressauth/email-smtp

SMTP email provider for FortressAuth (via nodemailer).

## Installation

```bash
npm install @fortressauth/email-smtp
# or
pnpm add @fortressauth/email-smtp
# or
yarn add @fortressauth/email-smtp
```

## Usage

```ts
import { SMTPEmailProvider } from '@fortressauth/email-smtp';

const provider = new SMTPEmailProvider({
  host: 'smtp.example.com',
  port: 587,
  secure: false,
  auth: {
    user: process.env.SMTP_USER ?? '',
    pass: process.env.SMTP_PASS ?? '',
  },
  fromEmail: 'noreply@yourdomain.com',
  fromName: 'Your App',
  tls: {
    rejectUnauthorized: false,
  },
});
```

## License

MIT
npm package: @fortressauth/expo-sdk
Description: Expo SDK for FortressAuth with SecureStore-backed token storage.
Latest version: 0.1.12

# @fortressauth/expo-sdk

Expo SDK for FortressAuth with SecureStore-backed token storage.

## Features

- Expo-optimized `AuthProvider`
- Uses `expo-secure-store` for token storage
- Re-exports `useAuth` and `useUser` hooks

## Installation

```bash
npm install @fortressauth/expo-sdk
# or
pnpm add @fortressauth/expo-sdk
# or
yarn add @fortressauth/expo-sdk
```

## Quick Start

```tsx
import { AuthProvider, useAuth, useUser } from '@fortressauth/expo-sdk';

export function App() {
  return (
    <AuthProvider baseUrl="http://localhost:3000">
      <Root />
    </AuthProvider>
  );
}
```

## License

MIT
npm package: @fortressauth/react-native-sdk
Description: React Native SDK for FortressAuth with token-based authentication.
Latest version: 0.1.12

# @fortressauth/react-native-sdk

React Native SDK for FortressAuth with token-based authentication.

## Features

- `AuthProvider` with `useAuth` and `useUser` hooks
- Token-based auth (no cookies)
- AsyncStorage-backed token storage (overrideable)

## Installation

```bash
npm install @fortressauth/react-native-sdk
# or
pnpm add @fortressauth/react-native-sdk
# or
yarn add @fortressauth/react-native-sdk
```

## Quick Start

```tsx
import { AuthProvider, useAuth, useUser } from '@fortressauth/react-native-sdk';

export function App() {
  return (
    <AuthProvider baseUrl="http://localhost:3000">
      <Root />
    </AuthProvider>
  );
}

function Root() {
  const { signIn, loading, error } = useAuth();
  const { user } = useUser();

  return null;
}
```

### Custom Storage

```tsx
import type { AuthStorage } from '@fortressauth/react-native-sdk';

const storage: AuthStorage = {
  getItem: async (key) => /* ... */,
  setItem: async (key, value) => /* ... */,
  removeItem: async (key) => /* ... */,
};

<AuthProvider baseUrl="http://localhost:3000" storage={storage}>
  <App />
</AuthProvider>
```

## License

MIT
npm package: @fortressauth/svelte-sdk
Description: Svelte stores for FortressAuth authentication.
Latest version: 0.1.12

# @fortressauth/svelte-sdk

Svelte stores for FortressAuth authentication.

## Features

- `createAuthStore` and `getAuthStore` helpers
- Cookie-based sessions with CSRF handling
- Svelte stores for user, loading, and error state

## Installation

```bash
npm install @fortressauth/svelte-sdk
# or
pnpm add @fortressauth/svelte-sdk
# or
yarn add @fortressauth/svelte-sdk
```

## Quick Start

```svelte
<script lang="ts">
  import { createAuthStore } from '@fortressauth/svelte-sdk';

  const auth = createAuthStore({ baseUrl: 'http://localhost:3000' });
  const { user, loading, error, signIn } = auth;

  async function handleLogin() {
    await signIn('user@example.com', 'password123');
  }
</script>

{#if $loading}
  <p>Loading...</p>
{:else if $user}
  <p>Welcome {$user.email}</p>
{:else}
  {#if $error}<p class="error">{$error}</p>{/if}
  <button on:click={handleLogin}>Sign In</button>
{/if}
```

### Environment Variables

For Vite projects, the SDK reads `VITE_API_BASE_URL` automatically:

```bash
VITE_API_BASE_URL=http://localhost:3000
```

## License

MIT