Create a full-stack Minimum Viable Product (MVP) for a SaaS sales optimization and simulation platform called 'Sales Simulator'. The application should help SaaS founders identify and improve key metrics that buyers value during an acquisition: customer concentration, competitive defensibility, and founder dependency.
**Technology Stack:**
- **Frontend:** Next.js App Router (using the `app/` directory)
- **Backend/API:** Next.js API Routes
- **Database:** PostgreSQL with Drizzle ORM
- **Authentication:** NextAuth.js
- **Styling:** Tailwind CSS
**Core Features (MVP):**
1. **User Authentication & Management:** Secure signup, login, and user profile management.
2. **Customer Concentration Analysis Module:**
* Allow users to input their top 5 customers and their corresponding revenue percentages.
* Visualize customer concentration (e.g., pie charts, bar graphs).
* Simulate scenarios: What if a top customer churns? How does it affect valuation?
* Provide recommendations to diversify.
3. **Competitive Defensibility Module:**
* Allow users to input competitors, their features, and potential market disruption factors (e.g., AI, big tech entry).
* Present a framework for users to self-assess their defensibility (e.g., unique tech, IP, network effects).
* Generate a defensibility score based on user input and predefined criteria.
* Suggest strategies to build stronger defensibility.
4. **Founder Dependency Module:**
* Allow users to assess their personal involvement in key business functions (sales, development, support, etc.).
* Provide tools to track the delegation and automation of these functions.
* Simulate scenarios: What happens if the founder is unavailable for an extended period?
* Offer best practices for reducing founder dependency.
5. **Simulation & Reporting Dashboard:**
* A central dashboard displaying key metrics from all modules.
* A simulation engine that allows users to adjust variables (e.g., reduce top customer revenue, increase team size) and see the projected impact on a hypothetical sale valuation.
* Generate downloadable PDF reports summarizing the analysis and simulation results.
**Database Schema (Drizzle ORM - PostgreSQL):**
- `users`: id, name, email, emailVerified, image
- `accounts`: id, userId, type, provider, providerAccountId, refresh_token, access_token, expires_at, token_type, scope, id_token, session_state
- `sessions`: id, sessionToken, userId, expires
- `verificationTokens`: identifier, token, expires
- `companies`: id, userId, name, arr, currency, createdAt, updatedAt
- `customers`: id, companyId, name, revenue, isTopCustomer (boolean)
- `customer_concentrations`: id, companyId, percentage, customerName
- `competitors`: id, companyId, name, keyFeatures, disruptionRiskLevel
- `defensibility_assessments`: id, companyId, technicalScore, ipScore, networkScore, overallScore, strategicRecommendations
- `founder_dependencies`: id, companyId, function (e.g., 'Sales', 'Dev'), founderInvolvementLevel (e.g., 'High', 'Medium', 'Low'), delegationProgress
- `simulations`: id, companyId, name, dateCreated, simulationParameters (JSONB), projectedValuation
- `reports`: id, companyId, name, dateGenerated, filePath
**API Routes (Next.js API Routes):**
- `/api/auth/*` (handled by NextAuth.js)
- `/api/company/*`: CRUD operations for company data.
- `/api/company/:companyId/customers`: CRUD for customers, including top customer identification.
- `/api/company/:companyId/customer-concentration`: Analyze and simulate concentration.
- `/api/company/:companyId/defensibility`: Assess and strategize defensibility.
- `/api/company/:companyId/founder-dependency`: Assess and track founder dependency.
- `/api/company/:companyId/simulate`: Run valuation simulations based on adjusted parameters.
- `/api/company/:companyId/reports`: Generate and retrieve reports.
**Implementation Details:**
- Use the Next.js App Router structure (`app/page.tsx`, `app/dashboard/page.tsx`, `app/auth/signin/page.tsx`, etc.).
- Implement full CRUD functionality for all relevant data entities.
- Ensure responsive UI design using Tailwind CSS.
- Implement robust error handling and validation.
- The simulation engine should take inputs from all modules and provide a projected valuation range, explaining the key drivers.
- For the initial MVP, focus on the core simulation logic and user input interfaces. Advanced AI-driven insights can be a future iteration, but the prompt requires the *structure* for AI integration (e.g., placeholder logic for AI analysis).