# blackstocks/xelleratesai architecture

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

- Interactive diagram: https://gitdiagram.com/blackstocks/xelleratesai
- Repository: https://github.com/blackstocks/xelleratesai

## Overview

#### 1. Purpose and principal workflow

Xellerates is a Next.js investment-readiness platform for startups, investors, and administrators, with fundraising, dealflow, portfolio, document, vault, reporting, and operational-workspace screens. A browser-based investor, startup user, or administrator initiates the principal workflow by requesting the web application; Next.js renders the root shell, establishes authenticated session state, and serves the selected dashboard or account route. Separately, an HTTP client can submit investor task-board data for an AI-generated task summary.

#### 2. Components

##### Application composition and identity

- **Browser-based platform user** — Path: none. External startup, investor, or administrator who opens account and dashboard routes.
- **Next.js App Router runtime** — Path: none. External framework runtime that serves the filesystem-defined application and API routes.
- **Root Application Shell** — Path: `app/layout.js`. Globally loads styles, metadata identifying Xellerates as an investment-readiness platform, theme/auth providers, and toast rendering.
- **Theme State Provider** — Path: `app/theme-provider.jsx`. Provides the root-level visual-theme layer imported by the application shell; implementation was not sampled.
- **Authentication Session Manager** — Path: `context/AuthContext.jsx`. Maintains client user/loading/error state, signs users in and out through Supabase, rejects unapproved profiles, and persists session tokens in cookies.
- **Supabase Client Adapter** — Path: `lib/supabaseclient.js`. Creates the browser Supabase client from public environment credentials with persistent session and token refresh enabled.
- **Supabase Auth and Profile Service** — Path: none. External Supabase capability used for authentication and the `profiles` approval-status lookup.
- **Browser Cookie Store** — Path: none. External browser state used to persist/remove access, refresh, and legacy pitch-deck tokens.
- **Account and onboarding routes** — Path: `app/(auth)`. Route group contains login, registration, password recovery/update, lock-screen, and investor-form screens.

##### Dashboard navigation and investment operations

- **Dashboard Route Shell** — Path: `app/(dashboard)/layout.js`. Layout boundary for all dashboard routes; its rendered composition was not included in the sample.
- **Dashboard Chrome** — Path: `components/partials/header/index.jsx`. Header assembles responsive navigation controls, theme switching, notifications, blog/task labels, profile access, and the search modal.
- **Local Header Search** — Path: `components/partials/header/Tools/SearchModal.jsx`. Provides a modal combobox with animated investment-tool placeholders, but filters only a hard-coded list and does not perform repository-backed search.
- **Investment Dashboard** — Path: `app/(dashboard)/dashboard/page.jsx`. Dashboard route with adjacent financial-data extraction scripts, suggesting a financial overview/extraction workspace; page behavior was not sampled.
- **Fundraising Workspace** — Path: `app/(dashboard)/tools/fundraising`. Route subsystem for fundraising, including separate debt and equity flows and investor subroutes.
- **Curated Dealflow Workspace** — Path: `app/(dashboard)/tools/curated-dealflow`. Route subsystem for curated investment dealflow.
- **Portfolio Management Workspace** — Path: `app/(dashboard)/tools/portfolio-management/page.jsx`. Investor-facing portfolio-management route.
- **Document Management Workspace** — Path: `app/(dashboard)/tools/document-management`. Route subsystem for document management, including an identifier-based detail route.
- **Investment Vault** — Path: `app/(dashboard)/vault`. Folder-oriented vault routes, including a dynamic folder-name view.
- **Administrative Operations Console** — Path: `app/(dashboard)/admin`. Administration route subsystem for startups, investors, startup documents, fundraising interest, hot deals, meetings, wallets, revenue, blogs, and role-specific tools.
- **Reporting Workspace** — Path: `app/(dashboard)/report/page.jsx`. Dedicated dashboard reporting route.

##### Collaborative work and client state

- **Operational Work Apps** — Path: `app/(dashboard)/(app)`. Route group for calendar, chat, email, kanban, projects, and todo interfaces.
- **Selected Document State** — Path: `context/DocumentContext.jsx`. Exposes React context for an in-memory selected-document array and setter; no provider placement or consumer was sampled.
- **Redux Application Store** — Path: `store/index.js`. Configures a Redux Toolkit store around an unprovided root reducer, with serializability checking disabled; provider wiring and state domains were not sampled.

##### AI task summarization

- **Task Summary API** — Path: `pages/api/generateTaskSummary.js`. POST endpoint serializing submitted kanban-style columns and tasks into a constrained prompt, calling Gemini Flash, and returning a JSON summary or HTTP error.
- **Task-summary HTTP Client** — Path: none. External/unknown caller expected by the API endpoint to POST a `tasks` payload.
- **Google Gemini Generative AI** — Path: none. External model service invoked with `gemini-1.5-flash` and a task-summarizer system instruction.

#### 3. Relationships

- **Browser-based platform user -> Next.js App Router runtime:** requests web routes; browser initiation and the repository’s Next.js application structure establish this entry flow.
- **Next.js App Router runtime -> Root Application Shell:** renders the root layout for application routes; the root layout is the App Router global layout entry.
- **Root Application Shell -> Theme State Provider:** wraps all rendered children in theme state; direct import and JSX composition.
- **Root Application Shell -> Authentication Session Manager:** wraps all rendered children in authentication state; direct import and JSX composition.
- **Root Application Shell -> Account and onboarding routes:** renders selected account-route children; root `children` composition plus route hierarchy.
- **Root Application Shell -> Dashboard Route Shell:** renders selected dashboard-route children; root `children` composition plus nested dashboard layout hierarchy.
- **Dashboard Route Shell -> Investment Dashboard:** hosts this selected dashboard route; App Router nesting establishes it as an alternative dashboard destination.
- **Dashboard Route Shell -> Fundraising Workspace:** hosts this selected tool route; route hierarchy establishes it as an alternative dashboard destination.
- **Dashboard Route Shell -> Curated Dealflow Workspace:** hosts this selected tool route; route hierarchy establishes it as an alternative dashboard destination.
- **Dashboard Route Shell -> Portfolio Management Workspace:** hosts this selected tool route; route hierarchy establishes it as an alternative dashboard destination.
- **Dashboard Route Shell -> Document Management Workspace:** hosts this selected tool route; route hierarchy establishes it as an alternative dashboard destination.
- **Dashboard Route Shell -> Investment Vault:** hosts this selected vault route; route hierarchy establishes it as an alternative dashboard destination.
- **Dashboard Route Shell -> Administrative Operations Console:** hosts this selected administration route; route hierarchy establishes it as an alternative dashboard destination.
- **Dashboard Route Shell -> Reporting Workspace:** hosts this selected reporting route; route hierarchy establishes it as an alternative dashboard destination.
- **Dashboard Chrome -> Local Header Search:** embeds the search modal; direct import and JSX use.
- **Authentication Session Manager -> Supabase Client Adapter:** invokes the exported client for user retrieval, auth-state subscription, password login/logout, and profile lookup; direct import.
- **Supabase Client Adapter -> Supabase Auth and Profile Service:** creates the SDK client used for authentication and database access; `createClient` construction.
- **Authentication Session Manager -> Browser Cookie Store:** writes/removes access and refresh tokens around auth-state changes and login/logout; direct cookie calls.
- **Task-summary HTTP Client -> Task Summary API:** submits POST task data; endpoint explicitly accepts POST and reads `req.body.tasks`.
- **Task Summary API -> Google Gemini Generative AI:** sends the constructed task prompt to Gemini Flash; direct SDK model creation and `generateContent` call.
- **Task Summary API -> Task-summary HTTP Client:** returns `{summary}` on success or HTTP errors on failure/method rejection; direct response calls.

#### 4. Coverage limits

The sampled source does not establish the contents of most route pages, dashboard-layout composition, authorization middleware, Supabase table schemas beyond `profiles`, actual document upload/storage behavior, Redux reducers/provider wiring, or a frontend call site connecting the kanban UI to the task-summary API. The repository tree shows many additional template-style UI, chart, form, map, email, and widget screens, but their product use and data integrations cannot be confirmed from the excerpts.

Main entry points: [`app/(dashboard)/layout.js`](https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/layout.js) (Dashboard Route Shell), [`app/layout.js`](https://github.com/blackstocks/xelleratesai/blob/main/app/layout.js) (Root Application Shell), [`context/AuthContext.jsx`](https://github.com/blackstocks/xelleratesai/blob/main/context/AuthContext.jsx) (Authentication Session Manager), [`pages/api/generateTaskSummary.js`](https://github.com/blackstocks/xelleratesai/blob/main/pages/api/generateTaskSummary.js) (Task Summary API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Application Identity"]
  node_root_shell["Root Application Shell<br/>layout"]
  node_theme_provider["Theme State Provider<br/>[theme-provider.jsx]"]
  node_auth_manager["Authentication Session Manager<br/>client context"]
  node_supabase_adapter["Supabase Client Adapter<br/>[supabaseclient.js]"]
  node_account_routes["Account and Onboarding Routes<br/>route group"]
end

subgraph group_dashboard["Dashboard Operations"]
  node_dashboard_shell["Dashboard Route Shell<br/>layout"]
  node_dashboard_chrome["Dashboard Chrome<br/>navigation UI"]
  node_header_search["Local Header Search<br/>search modal"]
  node_investment_dashboard["Investment Dashboard<br/>route"]
  node_fundraising["Fundraising Workspace<br/>route subsystem"]
  node_curated_dealflow["Curated Dealflow Workspace<br/>route subsystem"]
  node_portfolio_management["Portfolio Management Workspace<br/>route"]
  node_document_management["Document Management Workspace<br/>route subsystem"]
  node_investment_vault["Investment Vault<br/>route subsystem"]
  node_admin_console["Administrative Operations Console<br/>route subsystem"]
  node_reporting["Reporting Workspace<br/>route"]
end

subgraph group_collaboration["Operational Workspace"]
  node_operational_apps["Operational Work Apps<br/>route group"]
end

subgraph group_ai["AI Task Summarization"]
  node_task_api["Task Summary API<br/>API endpoint"]
end

subgraph group_external["External Services"]
  node_platform_user(("Platform User<br/>external actor"))
  node_next_runtime{{"Next.js App Router<br/>framework runtime"}}
  node_supabase_service[("Supabase Auth and Profile Service<br/>external service")]
  node_cookie_store[("Browser Cookie Store<br/>browser state")]
  node_task_client(("Task-summary HTTP Client<br/>external client"))
  node_gemini{{"Google Gemini Generative AI<br/>external model"}}
end

node_platform_user -->|"requests routes"| node_next_runtime
node_next_runtime -->|"renders shell"| node_root_shell
node_root_shell -->|"wraps children"| node_theme_provider
node_root_shell -->|"wraps children"| node_auth_manager
node_root_shell -->|"renders account routes"| node_account_routes
node_root_shell -->|"renders dashboard routes"| node_dashboard_shell
node_dashboard_shell -->|"hosts dashboard"| node_investment_dashboard
node_dashboard_shell -->|"hosts fundraising"| node_fundraising
node_dashboard_shell -->|"hosts dealflow"| node_curated_dealflow
node_dashboard_shell -->|"hosts portfolio"| node_portfolio_management
node_dashboard_shell -->|"hosts documents"| node_document_management
node_dashboard_shell -->|"hosts vault"| node_investment_vault
node_dashboard_shell -->|"hosts administration"| node_admin_console
node_dashboard_shell -->|"hosts reporting"| node_reporting
node_dashboard_chrome -->|"embeds search"| node_header_search
node_auth_manager -->|"invokes client"| node_supabase_adapter
node_supabase_adapter -->|"creates SDK client"| node_supabase_service
node_auth_manager -->|"stores tokens"| node_cookie_store
node_task_client -->|"submits task data"| node_task_api
node_task_api -->|"generates summary"| node_gemini
node_task_api -->|"returns summary"| node_task_client

click node_root_shell "https://github.com/blackstocks/xelleratesai/blob/main/app/layout.js"
click node_theme_provider "https://github.com/blackstocks/xelleratesai/blob/main/app/theme-provider.jsx"
click node_auth_manager "https://github.com/blackstocks/xelleratesai/blob/main/context/AuthContext.jsx"
click node_supabase_adapter "https://github.com/blackstocks/xelleratesai/blob/main/lib/supabaseclient.js"
click node_account_routes "https://github.com/blackstocks/xelleratesai/tree/main/app/(auth)"
click node_dashboard_shell "https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/layout.js"
click node_dashboard_chrome "https://github.com/blackstocks/xelleratesai/blob/main/components/partials/header/index.jsx"
click node_header_search "https://github.com/blackstocks/xelleratesai/blob/main/components/partials/header/Tools/SearchModal.jsx"
click node_investment_dashboard "https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/dashboard/page.jsx"
click node_fundraising "https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/tools/fundraising"
click node_curated_dealflow "https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/tools/curated-dealflow"
click node_portfolio_management "https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/tools/portfolio-management/page.jsx"
click node_document_management "https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/tools/document-management"
click node_investment_vault "https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/vault"
click node_admin_console "https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/admin"
click node_reporting "https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/report/page.jsx"
click node_operational_apps "https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/(app)"
click node_task_api "https://github.com/blackstocks/xelleratesai/blob/main/pages/api/generateTaskSummary.js"

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_shell,node_theme_provider,node_auth_manager,node_supabase_adapter,node_account_routes toneBlue
class node_dashboard_shell,node_dashboard_chrome,node_header_search,node_investment_dashboard,node_fundraising,node_curated_dealflow,node_portfolio_management,node_document_management,node_investment_vault,node_admin_console,node_reporting toneAmber
class node_operational_apps toneMint
class node_task_api toneRose
class node_platform_user,node_next_runtime,node_supabase_service,node_cookie_store,node_task_client,node_gemini toneIndigo
```

## Components

### Application Identity

Application shell, authentication, and account access.

- [Root Application Shell](https://github.com/blackstocks/xelleratesai/blob/main/app/layout.js): layout · `app/layout.js`
- [Theme State Provider](https://github.com/blackstocks/xelleratesai/blob/main/app/theme-provider.jsx): provider · `app/theme-provider.jsx`
- [Authentication Session Manager](https://github.com/blackstocks/xelleratesai/blob/main/context/AuthContext.jsx): client context · `context/AuthContext.jsx`
- [Supabase Client Adapter](https://github.com/blackstocks/xelleratesai/blob/main/lib/supabaseclient.js): client adapter · `lib/supabaseclient.js`
- [Account and Onboarding Routes](https://github.com/blackstocks/xelleratesai/tree/main/app/(auth)): route group · `app/(auth)`

### Dashboard Operations

Dashboard navigation and investment workflows.

- [Dashboard Route Shell](https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/layout.js): layout · `app/(dashboard)/layout.js`
- [Dashboard Chrome](https://github.com/blackstocks/xelleratesai/blob/main/components/partials/header/index.jsx): navigation UI · `components/partials/header/index.jsx`
- [Local Header Search](https://github.com/blackstocks/xelleratesai/blob/main/components/partials/header/Tools/SearchModal.jsx): search modal · `components/partials/header/Tools/SearchModal.jsx`
- [Investment Dashboard](https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/dashboard/page.jsx): route · `app/(dashboard)/dashboard/page.jsx`
- [Fundraising Workspace](https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/tools/fundraising): route subsystem · `app/(dashboard)/tools/fundraising`
- [Curated Dealflow Workspace](https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/tools/curated-dealflow): route subsystem · `app/(dashboard)/tools/curated-dealflow`
- [Portfolio Management Workspace](https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/tools/portfolio-management/page.jsx): route · `app/(dashboard)/tools/portfolio-management/page.jsx`
- [Document Management Workspace](https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/tools/document-management): route subsystem · `app/(dashboard)/tools/document-management`
- [Investment Vault](https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/vault): route subsystem · `app/(dashboard)/vault`
- [Administrative Operations Console](https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/admin): route subsystem · `app/(dashboard)/admin`
- [Reporting Workspace](https://github.com/blackstocks/xelleratesai/blob/main/app/(dashboard)/report/page.jsx): route · `app/(dashboard)/report/page.jsx`

### Operational Workspace

Collaborative work applications.

- [Operational Work Apps](https://github.com/blackstocks/xelleratesai/tree/main/app/(dashboard)/(app)): route group · `app/(dashboard)/(app)`

### AI Task Summarization

Task summary API and model integration.

- [Task Summary API](https://github.com/blackstocks/xelleratesai/blob/main/pages/api/generateTaskSummary.js): API endpoint · `pages/api/generateTaskSummary.js`

### External Services

Browser, Supabase, and Gemini dependencies.

- **Platform User**: external actor · Startup, investor, or administrator using the browser platform.
- **Next.js App Router**: framework runtime · Serves filesystem-defined application and API routes.
- **Supabase Auth and Profile Service**: external service · Provides authentication and profiles approval-status lookup.
- **Browser Cookie Store**: browser state · Persists and removes authentication tokens.
- **Task-summary HTTP Client**: external client · Caller that submits kanban task data.
- **Google Gemini Generative AI**: external model · Gemini 1.5 Flash task summarization service.

## Connections

- Platform User → Next.js App Router: requests routes · Browser initiation of web routes.
- Next.js App Router → Root Application Shell: renders shell · Global App Router layout entry.
- Root Application Shell → Theme State Provider: wraps children · Direct theme provider composition.
- Root Application Shell → Authentication Session Manager: wraps children · Direct authentication provider composition.
- Root Application Shell → Account and Onboarding Routes: renders account routes · Root children composition and route hierarchy.
- Root Application Shell → Dashboard Route Shell: renders dashboard routes · Root children composition and nested dashboard layout hierarchy.
- Dashboard Route Shell → Investment Dashboard: hosts dashboard · Alternative dashboard destination.
- Dashboard Route Shell → Fundraising Workspace: hosts fundraising · Alternative dashboard destination.
- Dashboard Route Shell → Curated Dealflow Workspace: hosts dealflow · Alternative dashboard destination.
- Dashboard Route Shell → Portfolio Management Workspace: hosts portfolio · Alternative dashboard destination.
- Dashboard Route Shell → Document Management Workspace: hosts documents · Alternative dashboard destination.
- Dashboard Route Shell → Investment Vault: hosts vault · Alternative dashboard destination.
- Dashboard Route Shell → Administrative Operations Console: hosts administration · Alternative dashboard destination.
- Dashboard Route Shell → Reporting Workspace: hosts reporting · Alternative dashboard destination.
- Dashboard Chrome → Local Header Search: embeds search · Direct import and JSX use.
- Authentication Session Manager → Supabase Client Adapter: invokes client · User retrieval, auth state, login/logout, and profile lookup.
- Supabase Client Adapter → Supabase Auth and Profile Service: creates SDK client · SDK client for authentication and database access.
- Authentication Session Manager → Browser Cookie Store: stores tokens · Writes and removes access and refresh tokens.
- Task-summary HTTP Client → Task Summary API: submits task data · POST request containing a tasks payload.
- Task Summary API → Google Gemini Generative AI: generates summary · Sends the constructed prompt to Gemini Flash.
- Task Summary API → Task-summary HTTP Client: returns summary · Returns summary JSON or HTTP errors.
