Create a comprehensive Next.js App Router (app/ directory) application for "Financial Safety Compass" (Finansal Güvenlik Pusulası). This application should serve as a financial crisis management tool for homeowners facing job loss and debt. The MVP should include robust user authentication, a multi-page structure, and full CRUD (Create, Read, Update, Delete) functionality for all data managed by the application.
**Core Features to Implement:
1. **User Authentication:** Secure user registration, login, and logout using NextAuth.js or a similar robust authentication solution.
2. **Dashboard:** A personalized overview of the user's financial situation, including debt summary, emergency fund status, and upcoming financial obligations.
3. **Debt Management Module:**
* **Database Schema (Drizzle ORM):** Define tables for `users`, `debts` (with fields like `userId`, `name`, `type` (e.g., mortgage, car, personal, loan), `originalAmount`, `currentAmount`, `interestRate`, `minimumPayment`, `dueDate`), and `debtPaymentSchedules`.
* **CRUD Operations:** Allow users to add, view, edit, and delete different types of debts.
* **Debt Prioritization Engine:** Implement logic to suggest debt repayment strategies (e.g., snowball, avalanche) based on user-defined preferences and financial data.
* **Payment Schedule Simulation:** A tool to simulate payment scenarios and visualize payoff timelines.
4. **Emergency Fund Module:**
* **Database Schema (Drizzle ORM):** Define tables for `emergencyFunds` (with fields like `userId`, `targetAmount`, `currentAmount`, `contributionFrequency`, `lastContributionDate`).
* **CRUD Operations:** Users can set emergency fund goals, track contributions, and view progress.
* **Savings Goal Setting:** Allow users to set realistic savings targets based on their income and expenses.
5. **Asset Management & Sales/Rental Module:**
* **Database Schema (Drizzle ORM):** Define tables for `assets` (with fields like `userId`, `name`, `type` (e.g., house, car), `estimatedValue`, `status` (e.g., owned, for sale, rented), `salePrice`, `rentalIncome`).
* **CRUD Operations:** Users can list their assets, input details, and track their status.
* **Market Comparison:** Integrate a placeholder or simulated market data API to provide rough estimates for sale prices or rental income based on asset type and general location (initially simulated).
* **Step-by-Step Guides:** Content pages offering guidance on selling or renting out assets.
6. **Alternative Housing Solutions Module:**
* **Content Pages:** Static or dynamically generated pages providing information and resources on temporary housing options, moving in with family, or short-term rentals. No complex CRUD needed for MVP, but links and structured information.
7. **API Routes (app/api/):** Implement API routes for all CRUD operations, handling requests from the frontend and interacting with the Drizzle ORM.
8. **Database Setup:** Configure Drizzle ORM with a PostgreSQL database (e.g., Vercel Postgres, Supabase, or a local setup).
9. **Frontend:** Use React Server Components and Client Components within the `app/` directory. Implement responsive UI using a component library like shadcn/ui or Tailwind CSS.
10. **Error Handling & Validation:** Implement robust client-side and server-side validation for all user inputs and API requests.
**Project Structure:**
* `app/` for Next.js App Router.
* `lib/` for utility functions, database connection, Drizzle schema definitions.
* `components/` for reusable UI components.
* `api/` for API routes.
* `styles/` for global styles.
**Deliverables:** A fully functional, multi-page Next.js application with the described features, ready for deployment. Ensure the code is well-organized, commented, and follows best practices for Next.js development.