Create a comprehensive full-stack web application using Next.js 14 App Router, Drizzle ORM with PostgreSQL, and Tailwind CSS. The application will be a personal finance management tool called 'Budget Coach'.
**Project Structure:**
Use the `app/` directory for routing.
- `app/(marketing)/page.tsx`: Landing page with features, testimonials, and pricing.
- `app/(auth)/layout.tsx`: Authentication layout (login, signup).
- `app/(auth)/login/page.tsx`: Login page.
- `app/(auth)/signup/page.tsx`: Signup page.
- `app/(app)/layout.tsx`: Main application layout with navigation (sidebar or top bar).
- `app/(app)/dashboard/page.tsx`: User dashboard showing overview of finances (income, expenses, budget status, debt progress).
- `app/(app)/transactions/page.tsx`: Page to view, add, edit, and delete financial transactions. Implement filtering and sorting.
- `app/(app)/budgets/page.tsx`: Page to create, view, edit, and delete budgets. Visualize budget adherence.
- `app/(app)/debts/page.tsx`: Page to manage debts (add, edit, delete). Track repayment progress and suggest strategies.
- `app/(app)/settings/page.tsx`: User profile and application settings.
- `app/api/auth/[...nextauth]/route.ts`: NextAuth.js integration for authentication.
- `app/api/transactions/route.ts`: API routes for CRUD operations on transactions.
- `app/api/budgets/route.ts`: API routes for CRUD operations on budgets.
- `app/api/debts/route.ts`: API routes for CRUD operations on debts.
- `lib/db.ts`: Drizzle configuration and connection to PostgreSQL.
- `lib/schema.ts`: Drizzle schema definition for users, transactions, budgets, debts.
- `components/`: Reusable UI components (e.g., forms, charts, modals).
- `utils/`: Utility functions.
**Database Schema (Drizzle ORM with PostgreSQL):**
1. `users` table: `id` (UUID, primary key), `name` (text), `email` (text, unique), `password` (text), `createdAt` (timestamp).
2. `transactions` table: `id` (UUID, primary key), `userId` (UUID, foreign key to users.id), `description` (text), `amount` (numeric), `type` (enum: 'income' | 'expense'), `category` (text), `date` (date), `createdAt` (timestamp).
3. `budgets` table: `id` (UUID, primary key), `userId` (UUID, foreign key to users.id), `name` (text), `amount` (numeric), `period` (enum: 'monthly' | 'yearly'), `startDate` (date), `endDate` (date).
4. `budgetItems` table: `id` (UUID, primary key), `budgetId` (UUID, foreign key to budgets.id), `categoryId` (text), `amount` (numeric).
5. `debts` table: `id` (UUID, primary key), `userId` (UUID, foreign key to users.id), `name` (text), `totalAmount` (numeric), `currentAmount` (numeric), `interestRate` (numeric), `dueDate` (date), `createdAt` (timestamp).
**API Routes:**
Implement full CRUD (Create, Read, Update, Delete) functionality for transactions, budgets, and debts using Next.js API routes. Ensure proper request handling (GET, POST, PUT, DELETE) and response formatting (JSON).
**Authentication:**
Integrate NextAuth.js for secure user authentication (email/password, potentially Google/Apple OAuth later).
**AI Features (MVP - Placeholder logic, can be enhanced later):**
- **Transaction Categorization:** Basic rule-based categorization for expenses.
- **Spending Anomaly Detection:** Simple checks for unusually high spending in specific categories compared to historical averages or budget limits. Display alerts on the dashboard.
- **Debt Strategy Suggestion:** Basic logic to suggest snowball or avalanche methods based on user-input debt details.
**Frontend:**
- Use React Server Components and Client Components within the `app/` directory.
- Implement dynamic routing for user-specific data.
- Utilize Tailwind CSS for styling, ensuring a responsive and clean UI.
- Consider using a charting library (e.g., Chart.js or Recharts) for visualizing financial data on the dashboard and budget pages.
**Deployment Considerations:**
Ensure the application is set up for easy deployment on platforms like Vercel.
**DO NOT:**
- Generate only a landing page or a simple SPA.
- Skip any of the specified features or technologies.
- Use any backend framework other than Next.js API routes with Drizzle ORM.
- Forget to implement full CRUD operations for core entities.