Better-T-Stack provides integrated authentication setup with automatic configuration for your chosen stack.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/amanvarshney01/create-better-t-stack/llms.txt
Use this file to discover all available pages before exploring further.
Authentication Providers
- Better-Auth
- Clerk
- None
Comprehensive auth framework for TypeScript.
Overview
Better-Auth is a self-hosted, framework-agnostic authentication library that provides a complete authentication solution with maximum flexibility and control.What’s Included:- Email/password authentication
- Social OAuth providers
- Session management
- CSRF protection
- Type-safe API
- Database schema generation
- Email verification
- Password reset flows
Features
Self-Hosted
Full control over your authentication data and infrastructure.
Type-Safe
End-to-end TypeScript support with automatic type inference.
Framework Agnostic
Works with any frontend or backend framework.
Extensible
Plugin system for custom authentication flows.
Frontend Compatibility
Better-Auth is available for:- TanStack Router
- TanStack Start
- Next.js
- React Native (Bare, Uniwind, Unistyles)
- Any frontend when using a compatible backend
When using Convex backend, Better-Auth is only available for specific frontends (see above).
Backend Requirements
Better-Auth requires a backend that is not set tonone. It works with:- All server frameworks (Hono, Express, Fastify, Elysia)
- Self (fullstack) mode
- Convex (limited frontend compatibility)
Database Integration
Better-Auth automatically integrates with your database choice:- Creates authentication tables/collections
- Configures ORM models
- Sets up migrations
- Handles schema updates
- SQLite (with Drizzle or Prisma)
- PostgreSQL (with Drizzle or Prisma)
- MySQL (with Drizzle or Prisma)
- MongoDB (with Mongoose or Prisma)
Configuration Example
Best For
Full Control
Full Control
- Complete control over authentication logic
- Custom authentication flows
- Self-hosted requirements
- Compliance needs (GDPR, HIPAA)
Cost Optimization
Cost Optimization
- No per-user pricing
- Predictable costs
- High-volume applications
- Budget-conscious projects
Customization
Customization
- Custom user models
- Unique authentication flows
- Integration with existing systems
- Specialized requirements
Comparison
| Feature | Better-Auth | Clerk |
|---|---|---|
| Hosting | Self-hosted | Managed |
| Cost | Free (infrastructure only) | Free tier + paid plans |
| Database | Required | Not required |
| Customization | Full control | Limited to Clerk’s features |
| UI Components | Build your own | Pre-built |
| Setup Complexity | Moderate | Low |
| Organizations | Custom implementation | Built-in |
| MFA | Custom implementation | Built-in |
| User Dashboard | Custom implementation | Built-in |
| Social Providers | Configure yourself | 20+ pre-configured |
Choosing Your Auth Provider
Check Your Backend
- Convex: Better-Auth or Clerk
- Other backends: Better-Auth
- None: No auth available
Evaluate Your Needs
- Self-hosted: Better-Auth
- Managed service: Clerk
- Organizations: Clerk (built-in)
- Custom flows: Better-Auth
Consider Your Budget
- Cost-sensitive: Better-Auth
- Time-sensitive: Clerk
- High volume: Better-Auth
- Prototype: Either (Clerk faster setup)
Integration with Other Features
Payments Integration
Payments Integration
When you add Polar payments, authentication is automatically integrated:
- User accounts linked to customer profiles
- Subscription management
- Payment history
Database Schema
Database Schema
Better-Auth creates necessary database tables:
- Users table
- Sessions table
- Accounts table (for OAuth)
- Verification tokens
Protected Routes
Protected Routes
Both providers integrate with your frontend:
- Route protection
- Authentication state
- User profile access
- Session management
Next Steps
Addons
Enhance your stack with additional features
Deployment
Deploy your authenticated application