You are tasked with building a comprehensive Minimum Viable Product (MVP) for a web application called 'Inheritance Management'. This application aims to help elderly individuals and their families manage assets and plan for inheritance, particularly in the context of moving into assisted living facilities and navigating 'lookback' periods for financial aid eligibility. The MVP should be a multi-page application built with Next.js App Router (using the `app/` directory), incorporating a robust backend with a database and API routes for full CRUD operations. Use Drizzle ORM for database schema management and PostgreSQL as the database. The application should be designed with security and user privacy as top priorities.
**Core Functionalities to Implement:**
1. **User Authentication & Management:**
* Implement secure user registration and login using NextAuth.js.
* Support for different user roles (e.g., Primary User - the elderly individual, Beneficiary - child/heir, Administrator - platform staff for support).
* User profile management.
2. **Asset & Inheritance Tracking Module:**
* **Create:** Allow users to input and categorize their assets (e.g., bank accounts, real estate, investments, personal property). For each asset, capture details like type, current value, acquisition date, and associated institutions.
* **Create:** Allow users to input details about potential inheritances (e.g., from deceased relatives), including expected amounts, timelines, and source.
* **Create:** Allow users to record details of their will or estate plans.
* **Read:** Display a consolidated view of all recorded assets and potential inheritances. Provide summary statistics (total value, asset distribution).
* **Update:** Enable users to update asset values, ownership details, and inheritance estimates.
* **Delete:** Allow users to remove assets or inheritance entries.
3. **Assisted Living & Lookback Period Information Hub:**
* **Database Schema:** Design tables to store information about different types of assisted living facilities, their admission criteria, and common lookback periods (e.g., 5 years for Medicaid in the US, or specific institutional policies). This data can be pre-populated or allow administrative input.
* **Information Display:** Provide a read-only interface for users to browse information relevant to their region or facility type.
* **Basic Calculator (Conceptual MVP):** While full legal advice is out of scope, create a simple calculator that estimates how long current assets might last based on a user's input for monthly expenses and facility costs. *Disclaimer: Clearly state this is an estimation and not financial or legal advice.*
4. **Beneficiary Management & Communication:**
* **Create:** Allow Primary Users to invite and add beneficiaries (children, heirs) to their account. Beneficiaries will need to register and be linked to the Primary User's profile.
* **Read:** Beneficiaries should be able to view shared information (e.g., a summary of assets, or specific details designated by the Primary User) once authorized.
* **Permissions:** Implement a system where the Primary User can control what information each beneficiary can access.
* **Communication:** Basic in-app messaging or notification system to alert beneficiaries of important updates or events (e.g., significant asset changes, potential inheritance notifications - *user-initiated*).
5. **Data Security & Privacy:**
* Implement encryption for sensitive user data at rest and in transit.
* Ensure compliance with relevant data protection regulations (e.g., GDPR, CCPA if applicable).
**Technical Stack & Implementation Details:**
* **Framework:** Next.js App Router (`app/` directory).
* **Language:** TypeScript.
* **Database:** PostgreSQL.
* **ORM:** Drizzle ORM (with Drizzle Kit for migrations).
* **Authentication:** NextAuth.js.
* **Styling:** Tailwind CSS for a clean, modern UI.
* **State Management:** React Context API or Zustand for simpler state management within components.
**API Routes (app/api/):**
* Implement RESTful API routes for all CRUD operations for Assets, Inheritances, Beneficiaries, and User Profiles.
* Ensure proper request validation and error handling for all API endpoints.
* Secure API routes using NextAuth.js middleware.
**Database Schema (Drizzle):**
* `users`: Stores user authentication details.
* `profiles`: Stores user profile information (linked to `users`).
* `assets`: Stores details of user assets.
* `inheritances`: Stores details of potential inheritances.
* `wills`: Stores information about user wills.
* `facility_info`: Stores general information about assisted living facilities and lookback periods (can be pre-populated).
* `beneficiaries`: Stores information about linked beneficiaries.
* `permissions`: Stores the access control rules for beneficiaries.
**Project Structure:**
* `app/` directory for all routes and layouts.
* `components/` for reusable UI components.
* `lib/` for utility functions, database connection, Drizzle schema definitions, and API clients.
* `styles/` for global CSS.
* `public/` for static assets.
**Deliverables:**
The MVP should be a fully functional, multi-page web application with complete CRUD capabilities for the core modules (Assets, Inheritances, Beneficiaries). It should demonstrate a clear understanding of the problem domain and provide a solid foundation for future development, including advanced features like automated notifications, deeper financial analysis, and integration with legal/financial advisors.