Build a comprehensive SaaS MVP application called 'Tenant Rights Guide' using Next.js App Router, Drizzle ORM with PostgreSQL, and Tailwind CSS. The application should empower small business owners facing lease violations by providing legal guidance, resources, and tools.
**Project Structure:**
Use the `app/` directory for routing and page structure. Create distinct directories for authentication, dashboard, lease management, legal resources, and user profile sections.
**Core Features:**
1. **User Authentication:** Implement secure email/password and OAuth (Google) sign-up and login.
2. **Dashboard:** A personalized landing page after login showing an overview of active cases, upcoming deadlines, and quick links to key features.
3. **Lease Management:**
* **Upload Lease:** Allow users to upload their lease agreements (PDF, DOCX).
* **Lease Analysis (Basic MVP):** Implement a feature to extract key clauses (rent, term, renewal, termination, landlord obligations, tenant obligations) using basic text processing. For MVP, focus on identifying potential red flags based on common violation types (rent increase clauses, notice periods, repair clauses).
* **Violation Reporting:** A form for users to describe their specific violation scenario (e.g., 'unilateral rent increase', 'forced space reduction', 'constructive eviction').
* **Guided Legal Information:** Based on the reported violation, provide step-by-step guidance on legal rights, relevant laws (simplified for MVP), and recommended actions. This should be dynamic content.
4. **Legal Resource Center:**
* **Template Library:** Provide downloadable/editable templates for common legal documents (e.g., Notice of Lease Violation, Demand Letter, Termination Notice, Request for Repair). Each template should be accessible via a dedicated page.
* **Directory of Legal Professionals:** A searchable database of lawyers and mediators specializing in commercial landlord-tenant law. Include filtering by location and specialty. Each professional should have a profile page.
5. **User Profile:** Allow users to manage their account details and view their uploaded leases and reported cases.
**Database Schema (Drizzle ORM - PostgreSQL):**
* `users` table: id, name, email, password_hash, oAuth_provider, oAuth_id, createdAt, updatedAt
* `leases` table: id, userId, fileName, fileUrl, uploadedAt, extractedContent (JSON or TEXT, for basic extracted clauses)
* `violation_reports` table: id, userId, leaseId, violationType (enum: RENT_INCREASE, SPACE_REDUCTION, EVICTION_THREAT, REPAIR_ISSUE, OTHER), description, reportedAt, status (enum: OPEN, RESOLVED, CLOSED)
* `legal_templates` table: id, title, description, filePath, category
* `legal_professionals` table: id, name, specialty, location, contactInfo (phone, email), website, profileUrl
**API Routes (Next.js App Router):**
* `/api/auth/*`: For authentication (signup, login, logout, OAuth callback).
* `/api/leases`: CRUD operations for lease uploads and retrieval.
* `/api/violations`: CRUD operations for violation reports.
* `/api/legal-templates`: API to fetch template lists and specific templates.
* `/api/legal-professionals`: API to fetch and filter legal professionals.
**Development Considerations:**
* **State Management:** Utilize React Context API or Zustand for efficient client-side state management.
* **UI Framework:** Use Tailwind CSS for styling. Ensure a responsive and clean user interface.
* **Error Handling:** Implement robust error handling for API requests and user interactions.
* **Security:** Sanitize all user inputs. Ensure secure handling of file uploads and sensitive user data.
* **MVP Focus:** Prioritize core functionality. Advanced AI analysis for lease interpretation can be a future enhancement. For MVP, focus on structured data extraction and rule-based guidance.