Prerequisites
Before you begin, ensure you have the following installed:- Node.js 20.x or later
- npm, yarn, or pnpm package manager
- PostgreSQL database (local or hosted)
- Git for version control
Installation
Install dependencies
Install the project dependencies using your preferred package manager:
The project uses Next.js 15 with React 18, Prisma ORM, and various AI/communication integrations.
Configure environment variables
Create a
.env file in the root directory and configure your environment variables.See the Environment Variables page for a complete reference.Set up the database
Generate the Prisma client and run database migrations:This will:
- Generate the Prisma client based on your schema
- Create all necessary database tables and relationships
- Apply any pending migrations
Development Scripts
The following npm scripts are available for development:| Script | Command | Description |
|---|---|---|
| dev | npm run dev | Start Next.js development server |
| build | npm run build | Build production bundle |
| start | npm start | Start production server |
| lint | npm run lint | Run ESLint code linting |
| db:generate | npm run db:generate | Generate Prisma client |
| db:migrate | npm run db:migrate | Run database migrations |
| sms:check | npm run sms:check | Check SMS segment calculations |
Project Structure
The jøsh codebase follows Next.js 15 App Router conventions:The application uses tRPC for type-safe API calls between client and server.
Database Schema
The application uses PostgreSQL with Prisma ORM. Key models include:- User - Application users with voting history
- Photo - Photo entries with ELO ratings
- Vote - User votes for photo comparisons
- TpoUser - TPO (Time, Place, Occasion) dating users
- TpoDate - Scheduled dates between users
- Shot - Shot-shooting feature entries
prisma/schema.prisma:1
AI & Communication Integrations
jøsh integrates with several external services:- OpenAI - AI-powered features via AI SDK
- Mistral - Alternative AI provider
- Supabase - File storage and authentication
- Surge SMS - SMS messaging for dating features
- PostHog - Analytics and feature flags
Troubleshooting
Database Connection Issues
If you encounter database connection errors:- Verify your
DATABASE_URLandDIRECT_URLare correct - Ensure PostgreSQL is running
- Check that the database exists
- Run
npm run db:migrateto apply migrations
Prisma Client Errors
If Prisma client is not found:Port Already in Use
If port 3000 is already in use, you can specify a different port:Next Steps
Environment Variables
Configure all required environment variables
Deployment
Deploy jøsh to production