# aha-shaf/optisuite architecture

> Architecture diagram of the GitHub repository aha-shaf/optisuite, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aha-shaf/optisuite
- Repository: https://github.com/aha-shaf/optisuite

## Overview

#### Purpose and runtime

A Next.js TypeScript dashboard for optimizing SaaS applications: usage analytics, license management, vendor/role/user views, recommendations, notifications, and an AI interface. It runs as a React/Next.js application, styled with Tailwind CSS. Primary application entry points are `app/layout.tsx` and `app/page.tsx`.

#### Application shell and navigation

The shared dashboard frame likely owns persistent navigation, header content, and page composition:
- `components/dashboard-shell.tsx`
- `components/app-sidebar.tsx`
- `components/dashboard-header.tsx`

Route pages under `app/` provide the feature-level entry points, including the root dashboard at `app/page.tsx`.

#### Authentication boundary

Login is implemented as a dedicated page plus a server API endpoint:
- `app/login/page.tsx`
- `components/login-form.tsx`
- `app/api/auth/login/route.ts`

Client-side access control is represented by `components/auth-guard.tsx`, while authentication-related logic is centralized in `lib/auth.ts`. This separates protected dashboard UI from the login/API boundary.

#### Dashboard and analytics presentation

The dashboard composes reusable metric, chart, alert, and status components to display optimization signals:
- `app/analytics/page.tsx`
- `components/metric-card.tsx`
- `components/chart-card.tsx`
- `components/heatmap-card.tsx`

Analytics is a routed UI surface; chart components are presentation boundaries that should remain independent of API or source-data acquisition.

#### SaaS management domains

Dedicated routes organize the core entities and decision workflows:
- Licenses: `app/licenses/page.tsx`, `app/licenses/details/page.tsx`, `components/license-table.tsx`
- Organization views: `app/users/page.tsx`, `app/roles/page.tsx`, `app/vendors/page.tsx`
- Optimization actions: `app/recommendations/page.tsx`, `components/recommendation-card.tsx`

The license details route is the apparent drill-down boundary, while tables/cards provide reusable views across entity and recommendation workflows.

#### Profile, settings, and notifications

User-specific and operational UI is split into independent routed areas:
- `app/settings/page.tsx`
- `app/notifications/page.tsx`
- `components/profile-card.tsx`

Profile data has its own API boundary at `app/api/profile-data/route.ts`, allowing profile UI to fetch or evolve separately from authentication.

#### AI interaction and data model

The AI feature is a first-class route with a reusable chat panel:
- `app/ai/page.tsx`
- `components/ai-chat-panel.tsx`

The repository currently appears to use local mock-backed domain data and shared types rather than a visible database or external SaaS-provider integration:
- `data/mock.tsx`
- `types/index.ts`

Those files form the primary data-contract boundary for pages and components. No external infrastructure, persistence layer, or AI-provider server endpoint is present in the supplied tree.

Main entry points: [`components/app-sidebar.tsx`](https://github.com/aha-shaf/optisuite/blob/main/components/app-sidebar.tsx) (App Sidebar), [`data/mock.tsx`](https://github.com/aha-shaf/optisuite/blob/main/data/mock.tsx) (Mock Domain Data), [`components/dashboard-shell.tsx`](https://github.com/aha-shaf/optisuite/blob/main/components/dashboard-shell.tsx) (Dashboard Shell), [`app/analytics/page.tsx`](https://github.com/aha-shaf/optisuite/blob/main/app/analytics/page.tsx) (Analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["App Shell"]
  node_root_layout["Root Layout<br/>Next.js layout<br/>[layout.tsx]"]
  node_dashboard_shell["Dashboard Shell<br/>shared UI"]
  node_sidebar["App Sidebar<br/>navigation<br/>[app-sidebar.tsx]"]
  node_header["Dashboard Header<br/>shared UI"]
end

subgraph group_routes["Feature Routes"]
  node_dashboard["Dashboard<br/>route page<br/>[page.tsx]"]
  node_analytics["Analytics<br/>route page<br/>[page.tsx]"]
  node_analytics_cards["Analytics Cards<br/>presentation components<br/>[chart-card.tsx]"]
  node_licenses["Licenses<br/>route page<br/>[page.tsx]"]
  node_license_details["License Details<br/>drill-down route<br/>[page.tsx]"]
  node_license_table["License Table<br/>reusable view<br/>[license-table.tsx]"]
  node_organization_views["Users, Roles &amp; Vendors<br/>route pages<br/>[page.tsx]"]
  node_recommendations["Recommendations<br/>route page<br/>[page.tsx]"]
  node_recommendation_card["Recommendation Card<br/>reusable view"]
  node_ai["AI<br/>route page<br/>[page.tsx]"]
  node_ai_chat["AI Chat Panel<br/>reusable UI<br/>[ai-chat-panel.tsx]"]
  node_settings_notifications["Settings &amp; Notifications<br/>route pages<br/>[page.tsx]"]
end

subgraph group_auth["Authentication"]
  node_login["Login<br/>public route<br/>[page.tsx]"]
  node_login_form["Login Form<br/>client UI<br/>[login-form.tsx]"]
  node_auth_api{{"Login API<br/>server endpoint<br/>[route.ts]"}}
  node_auth_logic["Auth Logic<br/>shared library<br/>[auth.ts]"]
  node_auth_guard["Auth Guard<br/>client access control<br/>[auth-guard.tsx]"]
  node_profile_api{{"Profile Data API<br/>server endpoint<br/>[route.ts]"}}
end

subgraph group_data["Data Contracts"]
  node_mock_data[("Mock Domain Data<br/>local data source<br/>[mock.tsx]")]
  node_domain_types["Domain Types<br/>TypeScript contracts<br/>[index.ts]"]
end

node_root_layout -->|"frames"| node_dashboard_shell
node_dashboard_shell -->|"includes"| node_sidebar
node_dashboard_shell -->|"includes"| node_header
node_dashboard_shell -->|"protects UI with"| node_auth_guard
node_sidebar -->|"navigates to"| node_dashboard
node_sidebar -->|"navigates to"| node_analytics
node_sidebar -->|"navigates to"| node_licenses
node_sidebar -->|"navigates to"| node_recommendations
node_sidebar -->|"navigates to"| node_ai
node_analytics -->|"composes"| node_analytics_cards
node_licenses -->|"renders"| node_license_table
node_license_table -->|"drills into"| node_license_details
node_recommendations -->|"renders"| node_recommendation_card
node_ai -->|"hosts"| node_ai_chat
node_login -->|"renders"| node_login_form
node_login_form -->|"submits credentials"| node_auth_api
node_auth_api -->|"uses"| node_auth_logic
node_auth_guard -->|"checks session via"| node_auth_logic
node_dashboard -->|"reads"| node_mock_data
node_analytics -->|"reads"| node_mock_data
node_licenses -->|"reads"| node_mock_data
node_organization_views -->|"reads"| node_mock_data
node_recommendations -->|"reads"| node_mock_data
node_mock_data -->|"conforms to"| node_domain_types
node_profile_api -->|"returns"| node_domain_types

click node_root_layout "https://github.com/aha-shaf/optisuite/blob/main/app/layout.tsx"
click node_dashboard_shell "https://github.com/aha-shaf/optisuite/blob/main/components/dashboard-shell.tsx"
click node_sidebar "https://github.com/aha-shaf/optisuite/blob/main/components/app-sidebar.tsx"
click node_header "https://github.com/aha-shaf/optisuite/blob/main/components/dashboard-header.tsx"
click node_dashboard "https://github.com/aha-shaf/optisuite/blob/main/app/page.tsx"
click node_analytics "https://github.com/aha-shaf/optisuite/blob/main/app/analytics/page.tsx"
click node_analytics_cards "https://github.com/aha-shaf/optisuite/blob/main/components/chart-card.tsx"
click node_licenses "https://github.com/aha-shaf/optisuite/blob/main/app/licenses/page.tsx"
click node_license_details "https://github.com/aha-shaf/optisuite/blob/main/app/licenses/details/page.tsx"
click node_license_table "https://github.com/aha-shaf/optisuite/blob/main/components/license-table.tsx"
click node_organization_views "https://github.com/aha-shaf/optisuite/blob/main/app/users/page.tsx"
click node_recommendations "https://github.com/aha-shaf/optisuite/blob/main/app/recommendations/page.tsx"
click node_recommendation_card "https://github.com/aha-shaf/optisuite/blob/main/components/recommendation-card.tsx"
click node_ai "https://github.com/aha-shaf/optisuite/blob/main/app/ai/page.tsx"
click node_ai_chat "https://github.com/aha-shaf/optisuite/blob/main/components/ai-chat-panel.tsx"
click node_settings_notifications "https://github.com/aha-shaf/optisuite/blob/main/app/settings/page.tsx"
click node_login "https://github.com/aha-shaf/optisuite/blob/main/app/login/page.tsx"
click node_login_form "https://github.com/aha-shaf/optisuite/blob/main/components/login-form.tsx"
click node_auth_api "https://github.com/aha-shaf/optisuite/blob/main/app/api/auth/login/route.ts"
click node_auth_logic "https://github.com/aha-shaf/optisuite/blob/main/lib/auth.ts"
click node_auth_guard "https://github.com/aha-shaf/optisuite/blob/main/components/auth-guard.tsx"
click node_profile_api "https://github.com/aha-shaf/optisuite/blob/main/app/api/profile-data/route.ts"
click node_mock_data "https://github.com/aha-shaf/optisuite/blob/main/data/mock.tsx"
click node_domain_types "https://github.com/aha-shaf/optisuite/blob/main/types/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_root_layout,node_dashboard_shell,node_sidebar,node_header toneBlue
class node_dashboard,node_analytics,node_analytics_cards,node_licenses,node_license_details,node_license_table,node_organization_views,node_recommendations,node_recommendation_card,node_ai,node_ai_chat,node_settings_notifications toneAmber
class node_login,node_login_form,node_auth_api,node_auth_logic,node_auth_guard,node_profile_api toneMint
class node_mock_data,node_domain_types toneRose
```

## Components

### App Shell

- [Root Layout](https://github.com/aha-shaf/optisuite/blob/main/app/layout.tsx): Next.js layout · Application entry and shared page frame. · `app/layout.tsx`
- [Dashboard Shell](https://github.com/aha-shaf/optisuite/blob/main/components/dashboard-shell.tsx): shared UI · Composes persistent dashboard chrome. · `components/dashboard-shell.tsx`
- [App Sidebar](https://github.com/aha-shaf/optisuite/blob/main/components/app-sidebar.tsx): navigation · `components/app-sidebar.tsx`
- [Dashboard Header](https://github.com/aha-shaf/optisuite/blob/main/components/dashboard-header.tsx): shared UI · `components/dashboard-header.tsx`

### Feature Routes

- [Dashboard](https://github.com/aha-shaf/optisuite/blob/main/app/page.tsx): route page · Root optimization overview. · `app/page.tsx`
- [Analytics](https://github.com/aha-shaf/optisuite/blob/main/app/analytics/page.tsx): route page · `app/analytics/page.tsx`
- [Analytics Cards](https://github.com/aha-shaf/optisuite/blob/main/components/chart-card.tsx): presentation components · Metric, chart, heatmap, alert, and status views. · `components/chart-card.tsx`
- [Licenses](https://github.com/aha-shaf/optisuite/blob/main/app/licenses/page.tsx): route page · `app/licenses/page.tsx`
- [License Details](https://github.com/aha-shaf/optisuite/blob/main/app/licenses/details/page.tsx): drill-down route · `app/licenses/details/page.tsx`
- [License Table](https://github.com/aha-shaf/optisuite/blob/main/components/license-table.tsx): reusable view · `components/license-table.tsx`
- [Users, Roles & Vendors](https://github.com/aha-shaf/optisuite/blob/main/app/users/page.tsx): route pages · Organization entity views. · `app/users/page.tsx`
- [Recommendations](https://github.com/aha-shaf/optisuite/blob/main/app/recommendations/page.tsx): route page · `app/recommendations/page.tsx`
- [Recommendation Card](https://github.com/aha-shaf/optisuite/blob/main/components/recommendation-card.tsx): reusable view · `components/recommendation-card.tsx`
- [AI](https://github.com/aha-shaf/optisuite/blob/main/app/ai/page.tsx): route page · `app/ai/page.tsx`
- [AI Chat Panel](https://github.com/aha-shaf/optisuite/blob/main/components/ai-chat-panel.tsx): reusable UI · `components/ai-chat-panel.tsx`
- [Settings & Notifications](https://github.com/aha-shaf/optisuite/blob/main/app/settings/page.tsx): route pages · Independent operational user surfaces. · `app/settings/page.tsx`

### Authentication

- [Login](https://github.com/aha-shaf/optisuite/blob/main/app/login/page.tsx): public route · `app/login/page.tsx`
- [Login Form](https://github.com/aha-shaf/optisuite/blob/main/components/login-form.tsx): client UI · `components/login-form.tsx`
- [Login API](https://github.com/aha-shaf/optisuite/blob/main/app/api/auth/login/route.ts): server endpoint · `app/api/auth/login/route.ts`
- [Auth Logic](https://github.com/aha-shaf/optisuite/blob/main/lib/auth.ts): shared library · `lib/auth.ts`
- [Auth Guard](https://github.com/aha-shaf/optisuite/blob/main/components/auth-guard.tsx): client access control · `components/auth-guard.tsx`
- [Profile Data API](https://github.com/aha-shaf/optisuite/blob/main/app/api/profile-data/route.ts): server endpoint · `app/api/profile-data/route.ts`

### Data Contracts

- [Mock Domain Data](https://github.com/aha-shaf/optisuite/blob/main/data/mock.tsx): local data source · Current source for SaaS domain data. · `data/mock.tsx`
- [Domain Types](https://github.com/aha-shaf/optisuite/blob/main/types/index.ts): TypeScript contracts · `types/index.ts`

## Connections

- Root Layout → Dashboard Shell: frames
- Dashboard Shell → App Sidebar: includes
- Dashboard Shell → Dashboard Header: includes
- Dashboard Shell → Auth Guard: protects UI with
- App Sidebar → Dashboard: navigates to
- App Sidebar → Analytics: navigates to
- App Sidebar → Licenses: navigates to
- App Sidebar → Recommendations: navigates to
- App Sidebar → AI: navigates to
- Analytics → Analytics Cards: composes
- Licenses → License Table: renders
- License Table → License Details: drills into
- Recommendations → Recommendation Card: renders
- AI → AI Chat Panel: hosts
- Login → Login Form: renders
- Login Form → Login API: submits credentials
- Login API → Auth Logic: uses
- Auth Guard → Auth Logic: checks session via
- Dashboard → Mock Domain Data: reads
- Analytics → Mock Domain Data: reads
- Licenses → Mock Domain Data: reads
- Users, Roles & Vendors → Mock Domain Data: reads
- Recommendations → Mock Domain Data: reads
- Mock Domain Data → Domain Types: conforms to
- Profile Data API → Domain Types: returns
