Create a full-stack web application using Next.js App Router (app directory), Drizzle ORM with PostgreSQL, and Tailwind CSS. The application will be a MVP for managing rental properties, specifically targeting 'house hacking' scenarios.
**Core Features & Requirements:**
1. **User Authentication:** Implement secure user authentication (e.g., NextAuth.js or Clerk) allowing users to sign up and log in.
2. **Multi-Tenancy (Implicit):** Each user should only see their own properties and data.
3. **Database Schema (Drizzle ORM):** Define the following tables using Drizzle ORM for PostgreSQL:
* `users`: Standard user information.
* `properties`: `id`, `userId`, `address`, `city`, `state`, `zipCode`, `purchaseDate`, `purchasePrice`, `description`, `createdAt`, `updatedAt`.
* `units`: `id`, `propertyId` (foreign key to `properties`), `unitNumber`, `rentAmount`, `isOccupied` (boolean), `createdAt`, `updatedAt`.
* `tenants`: `id`, `unitId` (foreign key to `units`), `name`, `email`, `phone`, `leaseStartDate`, `leaseEndDate`, `createdAt`, `updatedAt`.
* `transactions`: `id`, `unitId` (nullable, for property-level expenses), `tenantId` (nullable, for rent payments), `type` (enum: 'income', 'expense'), `category` (string, e.g., 'Rent', 'Maintenance', 'Property Tax'), `amount` (decimal), `date`, `description`, `createdAt`, `updatedAt`.
4. **Next.js App Router Structure:** Organize the application using the `app/` directory. Create separate pages for:
* Dashboard (`/`): Overview of properties, units, upcoming rent, recent transactions.
* Properties (`/properties`): List of all properties.
* Add Property (`/properties/new`): Form to add a new property.
* Edit Property (`/properties/[id]`): Form to edit an existing property.
* Units (`/properties/[propertyId]/units`): List of units for a specific property.
* Add Unit (`/properties/[propertyId]/units/new`): Form to add a new unit to a property.
* Edit Unit (`/properties/[propertyId]/units/[unitId]`): Form to edit a unit.
* Tenants (`/tenants`): List of all tenants.
* Add Tenant (`/tenants/new`): Form to add a new tenant.
* Edit Tenant (`/tenants/[id]`): Form to edit a tenant.
* Transactions (`/transactions`): List of all transactions.
* Add Transaction (`/transactions/new`): Form to add a new income or expense.
* Reports (`/reports`): Basic financial reports (e.g., monthly income/expense summary).
5. **API Routes (app/api):** Implement RESTful API endpoints for CRUD operations for properties, units, tenants, and transactions. Use Drizzle ORM to interact with the database.
* `POST /api/properties`: Create a new property.
* `GET /api/properties`: Get all properties for the logged-in user.
* `PUT /api/properties/[id]`: Update a property.
* `DELETE /api/properties/[id]`: Delete a property.
* Similar endpoints for `units`, `tenants`, and `transactions`.
6. **Frontend (React Components & Tailwind CSS):** Build a responsive and user-friendly interface using React components within the Next.js App Router. Utilize Tailwind CSS for styling.
* Implement forms for creating and editing all data types with appropriate validation.
* Display data in tables with sorting and filtering capabilities where applicable.
* Create a dashboard summarizing key metrics.
7. **Full CRUD Implementation:** Ensure that every entity (properties, units, tenants, transactions) supports Create, Read, Update, and Delete operations through the API and is reflected correctly on the frontend.
8. **Error Handling:** Implement robust error handling on both the frontend and backend.
9. **Validation:** Implement server-side validation for all API routes and client-side validation for forms.
10. **Deployment Considerations:** Structure the code for easy deployment on platforms like Vercel or Netlify.
**Do NOT:**
* Create only a landing page.
* Create a simple Single Page Application (SPA) without proper routing and data management.
* Omit database schema definition or CRUD operations.
* Forget to include API routes for data management.