---
title: "Deploy InnerLink: nextjs better-auth postgres"
description: "AI powered Therapy with AI-Human Therapist"
category: "AI/ML"
url: https://railway.com/deploy/innerlink-nextjs-better-auth-postgres
---

# Deploy InnerLink: nextjs better-auth postgres

AI powered Therapy with AI-Human Therapist

**[Deploy InnerLink: nextjs better-auth postgres on Railway](https://railway.com/template/innerlink-nextjs-better-auth-postgres)**

- **Creator:** Vivek Projects
- **Category:** AI/ML

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:16

### nextjs better-auth 

- **Source:** https://github.com/vivekvt/InnerLink
- **Public domain:** Yes

## Documentation

# 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.

![Next.js](https://img.shields.io/badge/Next.js-15-black)
![Better Auth](https://img.shields.io/badge/Better%20Auth-1.3-green)
![PostgreSQL](https://img.shields.io/badge/PostgreSQL-blue)
![AI](https://img.shields.io/badge/AI-Powered-purple)

## ✨ 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

[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/your-template-id)

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
```json
{
  "next": "^15.4.5",
  "react": "19",
  "typescript": "^5",
  "better-auth": "^1.3.4",
  "drizzle-orm": "^0.44.4"
}
```

#### Database & ORM
```json
{
  "postgres": "^3.4.7",
  "drizzle-kit": "^0.31.4",
  "drizzle-zod": "^0.8.2"
}
```

#### UI & Styling
```json
{
  "tailwindcss": "^4.1.11",
  "@radix-ui/react-*": "^1.1.x",
  "class-variance-authority": "^0.7.1",
  "tailwind-merge": "^3.3.1"
}
```

#### AI & Communication
```json
{
  "@heygen/streaming-avatar": "^2.0.16",
  "@openrouter/ai-sdk-provider": "^1.1.0",
  "ai": "^5.0.8",
  "resend": "^4.8.0"
}
```

#### Development Tools
```json
{
  "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
```env
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="noreply@yourdomain.com"
```

### Optional for AI Features
```env
HEYGEN_API_KEY="your-heygen-key"
OPEN_ROUTER_KEY="your-openrouter-key"
```

## 🚀 Quick Start

1. **Deploy to Railway** - Click the deploy button above
2. **Configure APIs** - Add your email and AI service keys
3. **Access App** - Visit your Railway-provided URL
4. **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!**

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/innerlink-nextjs-better-auth-postgres
