For the complete documentation index, see llms-docs.txt or the site index llms.txt. Full docs corpus: llms-full-docs.txt. Prefer the markdown version of this page at /docs/setup/backend/auth.md. Product capabilities: skill.md. Docs MCP: /docs/mcp. Site MCP: /mcp.

Auth

Set up, configure, and run the Reloop auth microservice locally.

User signup, login, sessions, organizations, and workspace membership via Better Auth.

Run bun setup once from the monorepo root (Postgres + Redis via Docker). Env files come from bun setup / bun env:setup.

Overview

PropertyValue
Directoryapps/backend/auth
Port8000
Local URLhttps://local.reloop.sh/api/auth
Swagger UIhttps://local.reloop.sh/api/auth/openapi
StackElysiaJS · Better Auth · PostgreSQL · Redis · NATS

Quick start

bun be:auth:dev

Or start every backend: bun backend:dev / bun dev.

Open the dashboard at https://local.reloop.sh/dashboard, not localhost:3001. Session cookies are scoped to local.reloop.sh. Local OTP is 888888.

Environment

apps/backend/auth/.env — created/merged by bun setup / bun env:setup from .env.dev.

# Database & Cache
PG_URL=postgresql://reloop:reloop123@localhost:5432/reloop
REDIS_URL=redis://:reloop123@localhost:6379

# Better Auth
BETTER_AUTH_SECRET=tENkVU4GrhckuRw4Bcfh93EWgXOFcszn
BASE_URL="https://local.reloop.sh"
PORT=8000
NODE_ENV=development

# Event Bus
NATS_URL=nats://localhost:4222

# Local dev helpers
DEFAULT_OTP=888888
DISABLE_SIGNUP=false

# OAuth (optional)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
VariableRequiredDefaultNotes
PG_URLYESpostgresql://...Shared Postgres from Docker
REDIS_URLYESredis://...Sessions and rate limits
BETTER_AUTH_SECRETYESSession encryption key
BASE_URLYEShttps://local.reloop.shPublic origin for OAuth / invites
PORTYES8000Host port
NATS_URLYESnats://localhost:4222Event bus
DEFAULT_OTPNo888888Dev OTP bypass
DISABLE_SIGNUPNofalseSet true after creating an admin

Commands

CommandDescription
bun be:auth:devStart dev server with hot reloading
bun run --filter=be-auth buildCompile production bundle
bun run --filter=be-auth startRun compiled production build
bun run --filter=be-auth check-typesTypeScript type-check

Architecture

LayerDetail
SessionsBetter Auth manages login, OAuth, and cookie sessions via Redis + Postgres
Multi-tenancyUsers belong to organizations through member (packages/db/src/schema/auth.ts)
EventsAuth lifecycle events published to NATS under auth.*
First loginUse OTP 888888 locally when DEFAULT_OTP is set

Next

Was this page helpful?

Edit this page