Centralized configuration files for authentication setup.
Location: apps/web/src/config/urls.ts, apps/tanstack/src/config/urls.ts
export const APP_URLS = {
frontend: import.meta.env.VITE_FRONTEND_URL || window.location.origin,
api: import.meta.env.VITE_API_BASE_URL || "http://localhost:8080",
} as const;Usage:
import { APP_URLS } from "@/config/urls";
// In providers
<AuthUIProvider baseURL={APP_URLS.frontend} />
// In API client
const apiClient = axios.create({ baseURL: APP_URLS.api });Location: apps/web/src/config/redirects.ts, apps/tanstack/src/config/redirects.ts
export const AUTH_REDIRECTS = {
afterLogin: "/dashboard",
} as const;Location: packages/auth/src/config/redirects.ts
export const AUTH_REDIRECTS = {
afterLogin: "/dashboard",
afterEmailVerification: "/dashboard",
afterMagicLink: "/dashboard",
organizationInvitation: "/accept-invitation",
} as const;Usage:
// Frontend
import { AUTH_REDIRECTS } from "@/config/redirects";
const redirectTo = AUTH_REDIRECTS.afterLogin;
// Backend
import { AUTH_REDIRECTS } from "./config/redirects";
const url = buildEmailUrlWithFrontendCallback(url, AUTH_REDIRECTS.afterLogin);# Frontend URL (for OAuth callbacks)
VITE_FRONTEND_URL=http://localhost:5173
# Backend API URL
VITE_API_BASE_URL=http://localhost:8080# Better Auth Configuration
BETTER_AUTH_URL=http://localhost:8080
BETTER_AUTH_SECRET=your-secret-key-here
FRONTEND_URL=http://localhost:5173
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
# OAuth Providers
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# Email (Optional)
EMAIL_FROM_ADDRESS=noreply@example.com
EMAIL_FROM_NAME=FlowStack
# CORS (Optional)
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000
# Domain (Production)
DOMAIN=.example.com
NODE_ENV=productionFrontend:
// apps/web/src/config/redirects.ts
export const AUTH_REDIRECTS = {
afterLogin: "/home", // ← Change here
} as const;Backend:
// packages/auth/src/config/redirects.ts
export const AUTH_REDIRECTS = {
afterLogin: "/home", // ← Change here
// ...
} as const;// apps/web/src/config/urls.ts
export const APP_URLS = {
frontend: "https://app.example.com", // ← Hardcode or use env var
api: "https://api.example.com",
} as const;See Adding Providers guide.
| What to Change | File to Edit |
|---|---|
| Login redirect path | config/redirects.ts (frontend + backend) |
| Frontend URL | config/urls.ts (frontend) |
| API URL | config/urls.ts (frontend) |
| OAuth providers | packages/auth/src/auth.ts |
| Email templates | packages/auth/src/email/*.ts |
| Trusted origins | .env → ALLOWED_ORIGINS |