Deploy InnerLink: nextjs better-auth postgres
AI powered Therapy with AI-Human Therapist
Postgres
railwayapp-templates/postgres-ssl:16
Just deployed
/var/lib/postgresql/data
nextjs better-auth
vivekvt/InnerLink
Just deployed
Next.js Better Auth + AI Template 🚀
Complete Authentication Starter with AI-Powered Demo App
A production-ready Next.js template featuring Better Auth, PostgreSQL, and a full InnerLink AI Therapy App as a reference implementation.
✨ Features
- 🔐 Complete Auth System - Login, signup, verification, profiles
- 🤖 AI Therapists - 6 specialized virtual therapists with HeyGen avatars
- 🧘 Meditation Sessions - AI-powered guided meditation
- 💬 Real-time Chat - Voice and text with streaming avatars
- 📱 Responsive Design - Modern UI with Tailwind CSS + Radix UI
- 🛡️ Security First - Secure sessions and data handling
- 📊 Database Ready - Pre-configured PostgreSQL schema
Deploy and Host
This template is optimized for Railway deployment with one-click setup including:
- PostgreSQL database provisioning
- Environment variable configuration
- Automatic SSL certificates
- Custom domain support
About Hosting
Railway Advantages
- 🚀 Zero Config Deployment - Deploy directly from GitHub
- 📊 Managed PostgreSQL - Automatic database setup and backups
- 🔧 Environment Management - Secure variable handling
- 📈 Auto Scaling - Handle traffic spikes automatically
- 💰 Cost Effective - Pay only for what you use
- 🔒 Enterprise Security - SOC 2 compliant infrastructure
Infrastructure Requirements
- Database: PostgreSQL 14+ for user data and sessions
- Runtime: Node.js 18+ for Next.js application
- Memory: 512MB minimum for AI avatar streaming
- Storage: Minimal (stateless application)
Why Deploy
🎯 For Developers
- Quick Start: Get authentication working in minutes, not hours
- Best Practices: See production-ready patterns and security
- AI Integration: Learn how to integrate HeyGen avatars and OpenRouter
- Type Safety: Full TypeScript implementation with Drizzle ORM
🚀 For Startups
- MVP Ready: Ship user authentication and AI features fast
- Scalable Foundation: Built on modern, performant technologies
- Customizable: Easy to modify for your specific use case
- Production Tested: Security and performance optimized
📚 For Learning
- Modern Stack: Next.js 15, Better Auth, Drizzle ORM
- AI Implementation: Real-world AI avatar and chat integration
- Full-Stack Example: Complete app from auth to AI features
Common Use Cases
🤖 AI-Powered Applications
- Mental Health Apps - Therapy bots, meditation guides
- Education Platforms - AI tutors, language learning
- Customer Support - Virtual assistants, help desks
- Healthcare - Symptom checkers, wellness coaching
🔐 Authentication-Heavy Apps
- SaaS Platforms - User dashboards, subscription management
- Social Networks - Profile systems, content sharing
- E-commerce - User accounts, order history
- Content Management - Admin panels, user-generated content
💼 Business Applications
- Employee Portals - HR systems, internal tools
- Client Dashboards - Project management, reporting
- Booking Systems - Appointments, reservations
- CRM Systems - Customer relationship management
Dependencies for
Deployment Dependencies
Core Application
{
"next": "^15.4.5",
"react": "19",
"typescript": "^5",
"better-auth": "^1.3.4",
"drizzle-orm": "^0.44.4"
}
Database & ORM
{
"postgres": "^3.4.7",
"drizzle-kit": "^0.31.4",
"drizzle-zod": "^0.8.2"
}
UI & Styling
{
"tailwindcss": "^4.1.11",
"@radix-ui/react-*": "^1.1.x",
"class-variance-authority": "^0.7.1",
"tailwind-merge": "^3.3.1"
}
AI & Communication
{
"@heygen/streaming-avatar": "^2.0.16",
"@openrouter/ai-sdk-provider": "^1.1.0",
"ai": "^5.0.8",
"resend": "^4.8.0"
}
Development Tools
{
"eslint": "^9",
"prettier-plugin-tailwindcss": "^0.6.14",
"@types/node": "^24",
"@types/react": "^19"
}
Runtime Dependencies
- Node.js 18+ - Required for Next.js 15
- PostgreSQL 14+ - Database for user data and sessions
- Memory: 512MB+ - For AI avatar streaming and chat
- Storage: 50MB+ - Application code and assets
External Service Dependencies
- HeyGen API - For AI avatar streaming (optional)
- OpenRouter API - For AI conversations (optional)
- Resend - For email verification and notifications
- Railway PostgreSQL - Managed database service
Development Dependencies
- Git - Version control and Railway deployment
- npm/yarn - Package management
- Environment Variables - Configuration management
🔧 Environment Variables
Required for Basic Auth
DATABASE_URL="postgresql://..."
BETTER_AUTH_SECRET="your-secret-key"
NEXT_PUBLIC_BASE_URL="https://yourapp.railway.app"
RESEND_API_KEY="your-resend-key"
SENDER_EMAIL="[email protected]"
Optional for AI Features
HEYGEN_API_KEY="your-heygen-key"
OPEN_ROUTER_KEY="your-openrouter-key"
🚀 Quick Start
- Deploy to Railway - Click the deploy button above
- Configure APIs - Add your email and AI service keys
- Access App - Visit your Railway-provided URL
- Customize - Modify avatars, prompts, and UI to fit your needs
🛠️ Tech Stack
- Framework: Next.js 15 + App Router + Turbopack
- Auth: Better Auth + Email Verification
- Database: PostgreSQL + Drizzle ORM
- UI: Tailwind CSS + Radix UI + Shadcn
- AI: HeyGen Avatars + OpenRouter Chat
- Email: Resend
- Hosting: Railway Platform
📄 License
MIT License - Build amazing things!
🌟 Perfect for the Railway Hackathon - Deploy AI-powered apps in minutes!
Template Content
PGDATA
Directory path where PostgreSQL stores database files and configuration
PGPORT
Port number for PostgreSQL connection (typically 5432)
POSTGRES_DB
Password for PostgreSQL user authentication
DATABASE_URL
Full PostgreSQL connection string (postgresql://user:pass@host:port/db)
POSTGRES_USER
Master username for PostgreSQL instance
SSL_CERT_DAYS
Number of days SSL certificates remain valid
DATABASE_PUBLIC_URL
Public-facing database URL for external connections
RAILWAY_DEPLOYMENT_DRAINING_SECONDS
Grace period for graceful shutdown during deployments
nextjs better-auth
vivekvt/InnerLinkDIRECT_URL
Direct_URLDirect database connection for running migrations
DATABASE_URL
PostgreSQL connection string for the primary database
SENDER_EMAIL
From email address for authentication emails
HEYGEN_API_KEY
HeyGen API key for AI avatar streaming functionality
RESEND_API_KEY
API key for Resend email service (email verification)
OPEN_ROUTER_KEY
OpenRouter API key for AI conversation processing
BETTER_AUTH_SECRET
Secret key for Better Auth session encryption
NEXT_PUBLIC_BASE_URL
Public base URL of your deployed application
NEXT_PUBLIC_BASE_API_URL
Public API base URL for avatar services