Create a full-stack Next.js application using the App Router (app/ directory) that helps elderly individuals manage their finances after the passing of a spouse. The application should have a multi-page structure and implement full CRUD (Create, Read, Update, Delete) functionality for all core features.
**Database Schema (using Drizzle ORM):**
1. **Users Table:**
* `id` (UUID, primary key)
* `email` (VARCHAR, unique)
* `name` (VARCHAR)
* `createdAt` (TIMESTAMP)
* `updatedAt` (TIMESTAMP)
2. **Income Sources Table:**
* `id` (UUID, primary key)
* `userId` (UUID, foreign key to Users.id)
* `sourceName` (VARCHAR)
* `amount` (DECIMAL)
* `frequency` (VARCHAR, e.g., 'monthly', 'one-time')
* `startDate` (DATE)
* `createdAt` (TIMESTAMP)
* `updatedAt` (TIMESTAMP)
3. **Expenses Table:**
* `id` (UUID, primary key)
* `userId` (UUID, foreign key to Users.id)
* `description` (VARCHAR)
* `amount` (DECIMAL)
* `category` (VARCHAR, e.g., 'housing', 'food', 'transportation', 'healthcare', 'personal', 'travel')
* `date` (DATE)
* `createdAt` (TIMESTAMP)
* `updatedAt` (TIMESTAMP)
4. **Savings Goals Table:**
* `id` (UUID, primary key)
* `userId` (UUID, foreign key to Users.id)
* `goalName` (VARCHAR)
* `targetAmount` (DECIMAL)
* `currentAmount` (DECIMAL, default 0)
* `targetDate` (DATE, optional)
* `createdAt` (TIMESTAMP)
* `updatedAt` (TIMESTAMP)
5. **Emergency Fund Table:**
* `id` (UUID, primary key)
* `userId` (UUID, foreign key to Users.id)
* `amount` (DECIMAL)
* `createdAt` (TIMESTAMP)
* `updatedAt` (TIMESTAMP)
**Application Structure & Features:**
* **Technology Stack:** Next.js (App Router), React, Drizzle ORM (with PostgreSQL or SQLite), Tailwind CSS for styling.
* **Authentication:** Implement secure user authentication (e.g., NextAuth.js or Clerk).
* **Multi-Page Structure (app/ directory):**
* `/dashboard`: User's financial overview (summary of income, expenses, savings, emergency fund).
* `/income`: Manage income sources (CRUD operations).
* `/expenses`: Manage expenses (CRUD operations), including categorization.
* `/savings-goals`: Define and track savings goals (CRUD operations).
* `/emergency-fund`: Manage the emergency fund.
* `/budget`: Create and manage personalized budgets based on income and expenses.
* `/planning-tools`: Tools for financial simulations (e.g., planning for a move or travel. This can be a simple input form with calculated outputs).
* `/tips`: Display financial literacy tips.
* **API Routes (app/api/):** Create API routes for each entity to handle CRUD operations. For example:
* `app/api/income/[id]/route.ts` (GET, PUT, DELETE)
* `app/api/expenses/route.ts` (POST, GET)
* Ensure proper error handling and response formats (JSON).
* **Frontend Components:** Develop reusable React components for forms, data display, charts (optional, but good for visualization), and navigation.
* **Data Visualization (Optional for MVP but recommended):** Use a charting library (e.g., Chart.js, Recharts) to visualize income vs. expenses, savings progress, etc.
* **User Experience:** Focus on a clean, intuitive, and accessible UI suitable for elderly users. Use clear labels, large fonts, and straightforward navigation.
* **Deployment:** The application should be deployable to platforms like Vercel or Netlify.
**Deliverables:**
1. Fully functional Next.js application with the described multi-page structure and App Router.
2. Database schema implemented using Drizzle ORM.
3. API routes for all CRUD operations.
4. Frontend components for user interaction and data display.
5. User authentication system.
6. Basic styling using Tailwind CSS.
**Exclusions for MVP:**
* Automated bank account syncing/import.
* Investment management features.
* Real-time collaboration or multi-user features beyond authentication.