A modern Next.js application for engaging in roleplay conversations with AI-powered fictional characters.
- 🎭 Character Roleplay - Interact with diverse fictional characters
- 💬 AI-Powered Chat - Advanced conversations using local AI models
- 🔒 Private & Secure - Your conversations stay private
- 🎨 Custom Characters - Create your own characters
- 🔐 Secure Authentication - User registration and login with NextAuth.js
- 📱 Responsive Design - Works on desktop and mobile devices
- Framework: Next.js 15 with App Router
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js v4
- UI: Radix UI with Tailwind CSS
- Validation: Zod
- TypeScript: For type safety
- Node.js 18+
- PostgreSQL database
- npm/yarn/pnpm
- Clone the repository:
git clone <your-repo-url>
cd roleplay-chat-app
- Install dependencies:
npm install
# or
yarn install
# or
pnpm install
- Set up environment variables:
cp .env.example .env.local
Edit .env.local
with your values:
DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"
- Set up the database:
npx prisma db push
npx prisma db seed
- Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 with your browser to see the result.
src/
├── app/ # Next.js App Router pages
│ ├── api/ # API routes
│ ├── login/ # Login page
│ ├── register/ # Registration page
│ └── dashboard/ # Protected dashboard
├── components/ # Reusable components
├── lib/ # Utility functions
│ ├── auth.ts # Password hashing utilities
│ ├── prisma.ts # Database client
│ ├── validations.ts # Zod schemas
│ └── api-utils.ts # API response utilities
├── types/ # TypeScript type definitions
└── auth.ts # NextAuth.js configuration
The application uses the following main entities:
- Users: Authentication and user management
- Characters: AI roleplay characters with personalities and prompts
- Conversations: Chat sessions between users and characters
- Messages: Individual messages within conversations
npm run dev
- Start development servernpm run build
- Build for productionnpm run start
- Start production servernpm run lint
- Run ESLintnpm run db:seed
- Seed database with sample characters
Variable | Description | Required |
---|---|---|
DATABASE_URL |
PostgreSQL connection string | Yes |
NEXTAUTH_URL |
App URL for NextAuth | Yes |
NEXTAUTH_SECRET |
Secret for NextAuth sessions | Yes |
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.