You are tasked with building a full-stack web application called 'Debt Navigator' using Next.js 14 with the App Router, Drizzle ORM for database interactions, and Tailwind CSS for styling. The application's core purpose is to help users manage and optimize their large, long-term debts like car loans, offering scenario analysis and budget integration. The application must support multi-page navigation and full CRUD operations for its main data models. Here are the specific requirements: 1. Project Setup: Initialize a Next.js 14 project using the App Router (app/ directory). Integrate Drizzle ORM with a PostgreSQL database (provide mock connection details for development, e.g., using dotenv). Configure Tailwind CSS for styling. 2. Database Schema (Drizzle ORM): `users` table: `id` (UUID, primary key), `email` (String, unique, not null), `passwordHash` (String, not null), `createdAt` (Timestamp, default now), `updatedAt` (Timestamp, default now on update). `debts` table: `id` (UUID, primary key), `userId` (UUID, foreign key to `users.id`, not null), `name` (String, e.g., "Car Loan", not null), `principalAmount` (Decimal, not null) - initial loan amount, `currentPrincipal` (Decimal, not null) - remaining principal, `interestRate` (Decimal, not null) - annual percentage rate (e.g., 0.06 for 6%), `loanTermMonths` (Integer, not null) - original term in months, `monthlyPayment` (Decimal, not null), `startDate` (Date, not null), `createdAt` (Timestamp, default now), `updatedAt` (Timestamp, default now on update). `transactions` table (for recording payments/extra payments): `id` (UUID, primary key), `debtId` (UUID, foreign key to `debts.id`, not null), `type` (Enum: 'payment', 'extraPayment', not null), `amount` (Decimal, not null), `transactionDate` (Date, not null), `createdAt` (Timestamp, default now). `scenarios` table (for simulation results): `id` (UUID, primary key), `debtId` (UUID, foreign key to `debts.id`, not null), `name` (String, e.g., "Refinance Option 1"), `scenarioType` (Enum: 'refinance', 'extraPayments', 'sell', not null), `parameters` (JSONB, stores scenario-specific inputs like new interest rate, extra monthly amount, selling price, etc.), `results` (JSONB, stores calculated results like new total interest, new loan term, monthly savings/cost), `createdAt` (Timestamp, default now). 3. Pages (App Router): `/`: Home page (simple landing page with login/signup links, "About Us" section). `/dashboard`: User's main dashboard. Displays an overview of all debts, current principal, next payment due. `/debts/new`: Page to add a new debt. `/debts/[id]`: Detail page for a specific debt. Displays all debt info, list of payments, and links to scenario planner. `/debts/[id]/edit`: Page to edit an existing debt. `/debts/[id]/plan`: Scenario planning page for a specific debt. This is crucial. `/profile`: User profile settings. `/auth/login`: Login page. `/auth/signup`: Signup page. 4. API Routes (app/api directory): `/api/auth/login` (POST). `/api/auth/signup` (POST). `/api/debts` (GET for all debts, POST for new debt). `/api/debts/[id]` (GET for single debt, PUT for update, DELETE for delete). `/api/debts/[id]/transactions` (GET for debt's transactions, POST for new transaction). `/api/debts/[id]/scenarios` (GET for debt's scenarios, POST for new scenario calculation/storage). `/api/scenarios/[id]` (GET for single scenario, DELETE for delete). 5. Functionality (CRUD & Logic): User Authentication: Implement basic user registration and login (mock with sessions/cookies for MVP, no JWT needed initially). Debt Management (CRUD): Create: Add new car loans or other debts with all specified fields. Read: Display a list of all user's debts on the dashboard, and a detailed view for each debt. Update: Modify existing debt details. Delete: Remove a debt (and associated transactions/scenarios). Transaction Management (CRUD): Create: Add payments or extra payments to a debt. Read: View a history of payments for a specific debt. Scenario Analysis and Simulation (CORE FEATURE): On `/debts/[id]/plan` page, allow users to input parameters for different scenarios: Extra Payments: Input an additional fixed monthly amount. Calculate the new loan term, total interest paid, and total savings. Refinance: Input a new interest rate and new loan term. Calculate the new monthly payment, total interest paid, and difference from original. Sell Car: Input the estimated selling price and current principal. Calculate the 'negative equity' or 'positive equity' and show the remaining amount to be paid/received. Store the generated scenarios in the `scenarios` table. Display clear visual comparisons (e.g., charts) between the original debt plan and the simulated scenarios on the `/debts/[id]/plan` page. Basic Budgeting Integration: On the `/dashboard` or `/profile` page, allow users to input estimated monthly income and key expenses (rent, groceries, insurance). This data will be used internally by the scenario planner to suggest how much 'extra' a user *could* potentially pay towards debt. (No `budget` table for MVP, can be calculated on the fly or stored simply in `users` table as `monthlyIncome`, `monthlyExpenses` JSONB). 6. Styling: Use Tailwind CSS for a clean, modern UI. Focus on responsiveness. Constraints & Deliverables: Do NOT build just a landing page or a single-page application. Ensure all defined CRUD operations are functional via API routes and corresponding UI. The scenario planner must perform the specified calculations and store results. Provide clear instructions on how to set up and run the application locally, including database setup. Focus on functionality over elaborate UI for MVP, but ensure usability. No external authentication providers (Google, GitHub) needed for MVP. No real-time features required. Database migrations should be handled by Drizzle (generate example migration script).