Build a comprehensive SaaS MVP using Next.js App Router (app directory). The application should allow SaaS companies to discover new pricing opportunities from their existing customers. The core functionality involves creating and sending pricing-related surveys, analyzing responses, and suggesting new premium tiers or add-ons.
**Database Schema (Drizzle ORM with PostgreSQL):**
1. **`users`**: `id` (PK), `email` (unique), `password_hash`, `created_at`, `updated_at`
2. **`companies`**: `id` (PK), `user_id` (FK), `name`, `website`, `industry`, `created_at`, `updated_at`
3. **`customers`**: `id` (PK), `company_id` (FK), `name`, `email`, `current_plan`, `created_at`, `updated_at`
4. **`surveys`**: `id` (PK), `company_id` (FK), `title`, `description`, `status` ('draft', 'sent', 'closed'), `created_at`, `updated_at`
5. **`survey_questions`**: `id` (PK), `survey_id` (FK), `question_text`, `question_type` ('text', 'multiple_choice', 'rating'), `order`
6. **`survey_responses`**: `id` (PK), `survey_id` (FK), `customer_id` (FK), `submitted_at`
7. **`response_answers`**: `id` (PK), `survey_response_id` (FK), `survey_question_id` (FK), `answer_text`, `answer_value` (for rating/choice)
8. **`pricing_tiers`**: `id` (PK), `company_id` (FK), `name`, `price`, `features` (JSONB), `created_at`, `updated_at`
9. **`add_ons`**: `id` (PK), `company_id` (FK), `name`, `price`, `description`, `created_at`, `updated_at`
**Application Structure (Next.js App Router):**
* `/app/dashboard**: Main user dashboard after login. Displays company overview, active surveys, recent responses, and suggested pricing tiers/add-ons.
* `/app/surveys**: Module for creating, editing, viewing, and sending surveys.
* `/app/surveys/new**: Form for creating a new survey.
* `/app/surveys/[id]**: View specific survey details, including responses.
* `/app/surveys/[id]/edit**: Edit existing survey.
* `/app/customers**: Module for managing customer data. CRUD operations.
* `/app/pricing**: Module for defining and managing `pricing_tiers` and `add_ons`.
* `/app/pricing/tiers**: List and create pricing tiers.
* `/app/pricing/add-ons**: List and create add-ons.
* `/app/analytics**: Dashboard displaying aggregated survey results, customer willingness-to-pay analysis, and AI-driven recommendations.
* `/app/auth**: Authentication pages (login, signup, forgot password).
**API Routes (app/api/):**
Implement full CRUD API endpoints for all database models.
* `/api/surveys/**`
* `/api/customers/**`
* `/api/pricing/**`
* `/api/auth/**`
**Key Functionalities:**
1. **Survey Creation:** Users can create surveys with various question types (text, multiple choice, rating scales) focused on eliciting willingness-to-pay for new features, SLAs, priority support, etc.
2. **Customer Management:** Basic CRUD for customer contacts. Integration with CRM/customer databases via API would be a future enhancement, but MVP can start with manual entry.
3. **Survey Sending:** Ability to select customers and send surveys via email (integration with a transactional email service like SendGrid/Resend is needed).
4. **Response Analysis:** Automatically aggregate and visualize survey responses. Identify trends and key insights regarding customer value perception.
5. **Pricing Recommendation Engine (Basic MVP):** Based on aggregated responses, suggest potential new `pricing_tiers` or `add_ons` with recommended prices. This can start as a rule-based system (e.g., "If >70% of respondents indicated willingness to pay $X for feature Y, suggest a tier at $X+Z").
6. **Tier/Add-on Management:** CRUD interface for defining and managing these new pricing options.
7. **Authentication & Authorization:** Secure user login and company-based data isolation.
**Frontend:**
* Use React Server Components and Client Components as appropriate.
* Implement forms with validation.
* Visualize data using charting libraries (e.g., Chart.js, Recharts).
* Ensure responsive design.