Create a full-stack web application using Next.js App Router, Drizzle ORM with PostgreSQL, and Tailwind CSS. The application will serve as an AI-powered dating profile and messaging assistant for busy professionals.
**Core Functionality:**
1. **User Authentication:** Implement secure authentication using NextAuth.js. Users should be able to sign up and log in with email/password and potentially Google OAuth.
2. **Profile Management:** Users can create and manage their dating profiles. This includes uploading photos, writing bios, and specifying preferences. The MVP should include AI-powered suggestions for bio writing and photo selection based on user input and best practices.
3. **AI Match Scouting:** An AI module that scans potential matches on integrated platforms (simulated for MVP, actual integration is out of scope for MVP but architecture should support it) based on user preferences. It should present a list of 'recommended' matches to the user.
4. **AI Conversation Assistant:** For each recommended match, the AI should draft initial conversation starters and subsequent messages. All messages must go through a user approval step before being sent. The AI should learn from user feedback on conversations (e.g., 'good response', 'bad response').
5. **Date Scheduling Assistance:** Once a conversation progresses, the AI should suggest potential times and places for a date, based on user's availability and location preferences.
6. **Feedback Loop:** Users can provide feedback on matches and conversation quality, which will be used to retrain/fine-tune the AI models.
**Technical Stack:**
* **Frontend:** Next.js App Router, React, Tailwind CSS, Shadcn/ui components.
* **Backend:** Node.js, Next.js API Routes.
* **Database:** PostgreSQL with Drizzle ORM for type-safe database interactions.
* **AI Integration:** Utilize placeholder functions for AI calls (e.g., `generateBioSuggestion(prompt: string)`, `generateConversationStarter(context: string)`, `suggestDateLocation(conversationHistory: string)`). The actual implementation of these AI models is out of scope, but the application structure should make it easy to plug them in later (e.g., using libraries like LangChain or direct API calls to services like OpenAI/Gemini).
**Project Structure (Next.js App Router):**
* `app/` directory for all routes and UI components.
* `(auth)/` for authentication pages (login, signup).
* `(app)/` for authenticated user routes (dashboard, profile, matches, conversations).
* `dashboard/page.tsx`
* `profile/page.tsx`
* `matches/page.tsx`
* `conversations/[matchId]/page.tsx`
* `api/` for API routes.
* `lib/` for utility functions, database connection (Drizzle), AI client placeholders.
* `components/` for shared UI components.
* `db/schema.ts` for Drizzle schema definitions.
**Database Schema (Drizzle ORM):**
* `users` table: `id`, `name`, `email`, `hashedPassword`, `createdAt`, `updatedAt`.
* `profiles` table: `id`, `userId` (foreign key to users), `bio`, `photos` (array of URLs), `preferences` (JSONB), `createdAt`, `updatedAt`.
* `matches` table: `id`, `user1Id`, `user2Id`, `status` (e.g., 'pending', 'accepted', 'rejected'), `createdAt`, `updatedAt`.
* `conversations` table: `id`, `matchId`, `senderId` (user ID), `messageText`, `isAI`, `timestamp`, `feedback` (e.g., 'positive', 'negative', null).
* `dateSuggestions` table: `id`, `conversationId`, `suggestedTime`, `suggestedLocation`, `status` (e.g., 'proposed', 'accepted', 'declined'), `createdAt`.
**API Routes (CRUD Operations):**
* `/api/auth/...` (handled by NextAuth.js)
* `/api/profile` (POST, GET, PUT for profile management)
* `/api/matches` (GET for fetching recommended matches)
* `/api/conversations` (POST to send message, GET to fetch conversation history for a match)
* `/api/date-suggestions` (POST to create, PUT to update status)
**AI Placeholder Functions:**
Define placeholder functions in `lib/ai.ts` that simulate AI responses. For example:
```typescript
export async function generateBioSuggestion(prompt: string): Promise<string> { return `AI generated bio suggestion based on: ${prompt}`; }
export async function generateConversationStarter(context: string): Promise<string> { return `AI drafted opening line for context: ${context}`; }
export async function suggestDateLocation(conversationHistory: string): Promise<{ time: string, location: string }> { return { time: 'Tomorrow evening', location: 'Local Coffee Shop' }; }
```
**Development Steps:**
1. Set up Next.js project with App Router, Tailwind CSS, and Drizzle ORM.
2. Implement user authentication (NextAuth.js).
3. Develop profile creation and editing UI with AI bio/photo suggestions (using placeholder AI functions).
4. Implement the 'matches' display page, simulating AI match scouting.
5. Develop the conversation interface, including sending user messages and receiving AI-drafted messages (with approval step).
6. Implement date suggestion functionality.
7. Add user feedback mechanisms for conversations.
8. Ensure all data is persisted and retrieved correctly from PostgreSQL using Drizzle.
9. Structure the code following the App Router conventions and keep components reusable.
10. Add basic error handling and loading states.