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.

Prerequisites: Node.js 18+, a Supabase account, and pnpm installed (npm install -g pnpm).
1

Clone the repository and install dependencies

Clone the project and install its dependencies using pnpm.
git clone https://github.com/eggarcia98/auth-backend.git
cd auth-backend
pnpm install
2

Configure environment variables

Copy the example environment file and open it in your editor.
cp .env.example .env
Your .env file should look like this:
.env
# Environment
ENVIRONMENT=development

# Server Configuration
PORT=8080

# Supabase Configuration
SUPABASE_URL=https://xxxxxxxxxxxxx.supabase.co
SUPABASE_ANON_KEY=your-anon-key-here
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key-here

# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-min-32-chars

# Frontend URL (used for CORS)
FRONTEND_URL=http://localhost:3000
JWT_SECRET must be at least 32 characters. You can generate one with openssl rand -base64 32.
3

Create a Supabase project

  1. Go to supabase.com and sign in.
  2. Click New project and fill in the project details.
  3. Once the project is ready, navigate to Project Settings → API.
  4. Copy the following values into your .env file:
    • Project URLSUPABASE_URL
    • anon public key → SUPABASE_ANON_KEY
    • service_role key → SUPABASE_SERVICE_ROLE_KEY
The service_role key has full database access and bypasses Row Level Security. Never expose it in client-side code or public repositories.
4

Start the development server

Run the development server with hot reload.
pnpm dev
You should see output similar to:
Server listening { port: 8080, host: '0.0.0.0' }
The server is now running at http://localhost:8080.
5

Make your first request

Register a new user by sending a POST request to /api/v1/auth/signup.
curl -X POST http://localhost:8080/api/v1/auth/signup \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "SecurePass123"
  }'
A successful response returns 201 Created with user details and tokens:
{
  "success": true,
  "data": {
    "user": {
      "id": "uuid",
      "email": "user@example.com",
      "emailVerified": false,
      "provider": "email",
      "createdAt": "2026-01-01T00:00:00Z",
      "updatedAt": "2026-01-01T00:00:00Z"
    },
    "tokens": {
      "accessToken": "jwt-token",
      "refreshToken": "jwt-refresh-token",
      "expiresIn": 3600
    }
  }
}
Passwords must be at least 8 characters and include one uppercase letter, one lowercase letter, and one number.

Next steps

Configuration

Full reference for all environment variables, CORS, and cookie settings.

Email & password auth

Learn about the full login and logout flow.

OTP login

Set up passwordless email authentication.

OAuth (Google & Apple)

Add social login to your application.

Build docs developers (and LLMs) love