Create a full-stack web application using Next.js App Router (app/ directory), TypeScript, Drizzle ORM with PostgreSQL, and Tailwind CSS. The application will be a personal finance security dashboard called 'Account Security Shield'.
**Core Functionality:**
1. **User Authentication:** Implement secure user registration, login, and logout using NextAuth.js with email/password and potentially OAuth providers.
2. **Account Linking (Simulated for MVP):** For the MVP, simulate linking financial accounts. Users should be able to add placeholder 'accounts' (e.g., Credit Card, Bank Account) with a name and a simulated starting balance. In a real-world scenario, this would involve Plaid or similar aggregation services, but for the MVP, manual entry or mock data is sufficient.
3. **Transaction Monitoring:** Allow users to manually add 'transactions' to their linked accounts. Implement a basic algorithm to flag potentially suspicious transactions based on predefined rules (e.g., transactions over a certain amount, international transactions, transactions occurring close to each other in different locations - simulate location for MVP).
4. **Alerts System:** Develop a system to generate and display alerts within the application when suspicious transactions are detected. Users should be able to dismiss alerts.
5. **Reporting Assistance:** Provide a section where users can view details of flagged transactions and generate a simple 'fraud report' summary that they can use when contacting their financial institution.
**Technical Stack & Requirements:**
* **Framework:** Next.js (App Router - app/ directory).
* **Language:** TypeScript.
* **Database:** PostgreSQL with Drizzle ORM for type-safe database interactions.
* **Styling:** Tailwind CSS.
* **Authentication:** NextAuth.js.
* **State Management:** React Context API or Zustand for global state.
**Database Schema (Drizzle):**
* `users` table: `id`, `name`, `email`, `password` (hashed), `createdAt`.
* `accounts` table: `id`, `userId` (foreign key to users), `accountName`, `accountType` (e.g., 'credit_card', 'bank_account'), `currentBalance`, `createdAt`.
* `transactions` table: `id`, `accountId` (foreign key to accounts), `description`, `amount`, `transactionType` ('debit', 'credit'), `transactionDate`, `location` (string, e.g., 'New York', 'Online - International'), `isSuspicious` (boolean, default false), `createdAt`.
* `alerts` table: `id`, `userId` (foreign key to users), `transactionId` (foreign key to transactions, nullable), `alertType` ('suspicious_transaction', 'low_balance'), `message`, `isRead` (boolean, default false), `createdAt`.
**API Routes (app/api/ routes or route handlers within app/ directory):**
* **Auth:** `/api/auth/...` (handled by NextAuth.js).
* **Accounts:**
* `POST /api/accounts`: Create a new account.
* `GET /api/accounts`: Get all accounts for the logged-in user.
* `PUT /api/accounts/:id`: Update an account (e.g., balance).
* `DELETE /api/accounts/:id`: Delete an account.
* **Transactions:**
* `POST /api/transactions`: Add a new transaction (trigger suspicious check).
* `GET /api/transactions?accountId=:id`: Get transactions for a specific account.
* `GET /api/transactions/suspicious`: Get all suspicious transactions for the user.
* `PUT /api/transactions/:id/flag`: Manually flag/unflag a transaction.
* **Alerts:**
* `GET /api/alerts`: Get all alerts for the logged-in user.
* `PUT /api/alerts/:id/read`: Mark an alert as read.
**Frontend Structure (app/ directory):**
* `layout.tsx`: Root layout with navigation and auth provider.
* `page.tsx`: Dashboard overview showing linked accounts, recent transactions, and active alerts.
* `(auth)/login/page.tsx`, `(auth)/register/page.tsx`: Authentication pages.
* `accounts/page.tsx`: Page to view and manage linked accounts.
* `accounts/new/page.tsx`: Form to add a new account.
* `transactions/page.tsx`: Page to view all transactions (filterable).
* `transactions/new/page.tsx`: Form to add a new transaction.
* `alerts/page.tsx`: Page to view all generated alerts.
* `reports/page.tsx`: Page to generate and view fraud report summaries.
**Key Implementation Details:**
* Implement CRUD operations for all relevant entities (users, accounts, transactions, alerts).
* The suspicious transaction detection logic should be triggered when a new transaction is added via the API.
* Ensure proper error handling and loading states on the frontend.
* Use Tailwind CSS for a clean and responsive UI.
* Generate seed data for PostgreSQL to pre-populate the database for testing purposes.
* The application should be deployable (e.g., to Vercel).