Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/eggarcia98/auth-backend/llms.txt

Use this file to discover all available pages before exploring further.

Auth Backend

Auth Backend is a production-ready authentication service built with Fastify, Supabase, and TypeScript. It provides a complete authentication solution with multiple login strategies, secure token management, and flexible deployment options.

Quickstart

Get your authentication backend running in minutes

Configuration

Configure environment variables and Supabase settings

API Reference

Explore the full REST API documentation

OAuth Guide

Set up Google and Apple Sign-In with PKCE

Features

Email & Password Auth

Secure user registration and login with Zod-validated inputs and strong password requirements

OTP / Passwordless

Send one-time passwords via email for frictionless, passwordless authentication

OAuth (Google & Apple)

Full OAuth 2.0 with PKCE flow for Google and Apple Sign-In — no client secrets required

JWT Token Management

Access and refresh tokens stored in secure HTTP-only cookies with automatic rotation

Password Reset

Secure, email-based password recovery with redirect links

Docker & Cloudflare

Deploy with Docker or as a Cloudflare Worker for serverless edge authentication

Tech Stack

ComponentTechnology
FrameworkFastify 4
Auth ProviderSupabase
ValidationZod
LanguageTypeScript
TestingVitest
LoggingPino
Package Managerpnpm

API Overview

All endpoints are prefixed with /api/v1/auth. The base URL depends on your deployment environment:
Development: http://localhost:8080/api/v1/auth
Production:  https://your-domain.com/api/v1/auth

Available endpoints

MethodEndpointDescriptionAuth Required
GET/healthServer health checkNo
POST/api/v1/auth/signupRegister a new userNo
POST/api/v1/auth/loginEmail/password loginNo
POST/api/v1/auth/login/otpRequest OTP via emailNo
POST/api/v1/auth/verify-otpVerify OTP codeNo
POST/api/v1/auth/refreshRefresh access tokenNo (cookie)
POST/api/v1/auth/logoutLog out current userYes
POST/api/v1/auth/forgot-passwordRequest password resetNo
POST/api/v1/auth/reset-passwordReset with new passwordYes
GET/api/v1/auth/oauth/:providerGet OAuth authorization URLNo
POST/api/v1/auth/oauth/:provider/callbackHandle OAuth callbackNo
GET/api/v1/auth/meGet current user profileYes
POST/api/v1/auth/validate-tokenValidate or refresh tokenNo

Error Format

All errors follow a consistent JSON format:
{
  "success": false,
  "error": {
    "message": "Human-readable error message",
    "code": "ERROR_CODE",
    "details": []
  }
}
Auth Backend uses Supabase as its authentication provider. You will need a Supabase project to use this service. See the Configuration guide to get set up.

Build docs developers (and LLMs) love