Please develop a full-stack MVP for a tax tracking application called 'Tax Tracker' using Next.js 14 (App Router), TypeScript, and Tailwind CSS. The application should be a multi-page application, not a single-page app or a landing page. It must include a PostgreSQL database managed with Drizzle ORM and full CRUD functionality through API routes.
Project Structure:
* Next.js 14 App Router (`app/` directory).
* `src/` directory for organizing backend (lib, db, api) and frontend components.
Database Schema (Drizzle ORM for PostgreSQL):
1. **`users` table:**
* `id`: `text` (UUID), primary key, default `sql` `gen_random_uuid()`
* `email`: `text`, unique, not null
* `passwordHash`: `text`, not null
* `createdAt`: `timestamp`, default `sql` `now()`
* `updatedAt`: `timestamp`, default `sql` `now()`
2. **`incomeSources` table:**
* `id`: `text` (UUID), primary key, default `sql` `gen_random_uuid()`
* `userId`: `text`, foreign key referencing `users.id`, not null
* `name`: `text`, not null (e.g., "Dividends from Company X", "Freelance Gig Y")
* `type`: `text`, not null (e.g., 'DIVIDEND', 'INTEREST', 'FREELANCE', 'OTHER')
* `description`: `text`
* `createdAt`: `timestamp`, default `sql` `now()`
* `updatedAt`: `timestamp`, default `sql` `now()`
3. **`incomeEntries` table:**
* `id`: `text` (UUID), primary key, default `sql` `gen_random_uuid()`
* `userId`: `text`, foreign key referencing `users.id`, not null
* `incomeSourceId`: `text`, foreign key referencing `incomeSources.id`, not null
* `amount`: `numeric`, not null (store as string or appropriate number type for Drizzle)
* `date`: `date`, not null
* `formType`: `text`, not null (e.g., '1099-DIV', '1099-INT', '1099-MISC', 'W-2', 'K-1', 'OTHER')
* `notes`: `text`
* `status`: `text`, default 'RECORDED' (e.g., 'RECORDED', 'REPORTED', 'PENDING')
* `createdAt`: `timestamp`, default `sql` `now()`
* `updatedAt`: `timestamp`, default `sql` `now()`
Authentication:
* Implement a simple username/password authentication flow. For MVP, mock session management or use NextAuth.js if simple integration is possible without significant complexity. Focus on backend API for login/register and a basic client-side session context.
Pages (Frontend Components & Routes):
1. **`/` (Landing Page):**
* Basic marketing page for 'Tax Tracker'. Call to action to register/login.
* Header with navigation links (Home, Login, Register).
2. **`/auth/register`:**
* User registration form (email, password).
* Submits data to `/api/auth/register`.
3. **`/auth/login`:**
* User login form (email, password).
* Submits data to `/api/auth/login`. Redirects to `/dashboard` on success.
4. **`/dashboard` (Protected Route):**
* Display a summary of the current user's income entries:
* Total income for the current year.
* Breakdown by `formType`.
* List of the most recent 5-10 `incomeEntries`.
* Quick links to 'Manage Income Sources' and 'Add New Income Entry'.
5. **`/income-sources` (Protected Route):**
* List all `incomeSources` for the current user.
* Button to "Add New Income Source" (navigate to `/income-sources/new`).
* For each source, display "Edit" and "Delete" buttons.
6. **`/income-sources/new` (Protected Route):**
* Form to create a new `incomeSource`.
* Fields: `name`, `type`, `description`.
* Submits data to `/api/income-sources`.
7. **`/income-sources/[id]/edit` (Protected Route):**
* Form to edit an existing `incomeSource`, pre-filled with current data.
* Fields: `name`, `type`, `description`.
* Submits data to `/api/income-sources/[id]`.
8. **`/income-entries` (Protected Route):**
* List all `incomeEntries` for the current user, ideally with filtering/sorting by `date` or `formType`.
* Button to "Add New Income Entry" (navigate to `/income-entries/new`).
* For each entry, display "Edit" and "Delete" buttons.
9. **`/income-entries/new` (Protected Route):**
* Form to create a new `incomeEntry`.
* Fields: `incomeSourceId` (dropdown populated from user's `incomeSources`), `amount`, `date`, `formType`, `notes`.
* Submits data to `/api/income-entries`.
10. **`/income-entries/[id]/edit` (Protected Route):**
* Form to edit an existing `incomeEntry`, pre-filled with current data.
* Fields: `incomeSourceId`, `amount`, `date`, `formType`, `notes`.
* Submits data to `/api/income-entries/[id]`.
11. **`/reports/tax-summary` (Protected Route):**
* A page to generate a simple tax summary for a given year (e.g., user selects year).
* Displays total income by `formType` for that year.
* Offers a button to "Export to CSV" for the displayed data.
API Routes (`app/api`):
1. **`app/api/auth/register/route.ts` (POST):**
* Receives `email`, `password`. Hashes password. Creates new user in DB. Returns success/error.
2. **`app/api/auth/login/route.ts` (POST):**
* Receives `email`, `password`. Verifies credentials. Creates/manages a session (e.g., JWT or server-side session, for MVP a simple token passing via cookies is acceptable) and returns user info.
3. **`app/api/income-sources/route.ts` (GET, POST):**
* **GET**: Returns all `incomeSources` for the authenticated user.
* **POST**: Creates a new `incomeSource` for the authenticated user.
4. **`app/api/income-sources/[id]/route.ts` (GET, PUT, DELETE):**
* **GET**: Returns a specific `incomeSource` by ID for the authenticated user.
* **PUT**: Updates a specific `incomeSource` by ID for the authenticated user.
* **DELETE**: Deletes a specific `incomeSource` by ID for the authenticated user.
5. **`app/api/income-entries/route.ts` (GET, POST):**
* **GET**: Returns all `incomeEntries` for the authenticated user, potentially with query parameters for fi