# midouwell/ai-business-platform architecture

> Architecture diagram of the GitHub repository midouwell/ai-business-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/midouwell/ai-business-platform
- Repository: https://github.com/midouwell/ai-business-platform

## Overview

AI Business Platform is an Angular client backed by a NestJS REST API. Users register or sign in, enter the protected workspace, manage conversations, and send messages for AI responses; the backend handles authentication, conversation state, and model requests. The graph includes these product stages and the supporting API, session, and persistence layers. The README confirms the client/server split; unsampled wiring and HTTP calls between frontend and backend are shown only as unverified dashed links.

Main entry points: [`frontend/src/app/app.routes.ts`](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/app.routes.ts) (App routes), [`frontend/src/app/core/services/api.service.ts`](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/services/api.service.ts) (API client), [`frontend/src/app/core/auth/auth.service.ts`](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/auth/auth.service.ts) (Client session), [`frontend/src/app/features/workspace/workspace.component.ts`](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/workspace/workspace.component.ts) (Workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular client"]
  node_routes["App routes<br/>[app.routes.ts]"]
  node_login["Login and registration<br/>[login.component.ts]"]
  node_workspace["Workspace"]
  node_chatui["Chat view<br/>[chat.component.ts]"]
  node_home["Home view<br/>[home.component.ts]"]
  node_account["Account view"]
  node_api["API client<br/>[api.service.ts]"]
  node_convstore["Conversation store"]
end

subgraph group_identity["Authentication"]
  node_authui["Client session<br/>[auth.service.ts]"]
  node_authguard["Route guard<br/>[auth.guard.ts]"]
  node_interceptor["Auth interceptor"]
  node_authcontroller["Auth endpoints<br/>[auth.controller.ts]"]
  node_authservice["Auth service<br/>[auth.service.ts]"]
end

subgraph group_conversation["Conversations and AI"]
  node_convcontroller["Conversation endpoints"]
  node_convservice["Conversation service"]
  node_aicontroller["AI endpoint<br/>[ai.controller.ts]"]
  node_aiservice["AI service<br/>[ai.service.ts]"]
  node_ollama["Ollama model service<br/>[ollama.service.ts]"]
end

subgraph group_platform["Backend platform"]
  node_prisma["Prisma data access<br/>[prisma.service.ts]"]
  node_database[("PostgreSQL")]
end

node_user(("User"))

node_user -->|"navigates"| node_routes
node_routes -->|"loads"| node_login
node_routes -->|"loads"| node_workspace
node_routes -->|"loads"| node_chatui
node_routes -->|"loads"| node_home
node_routes -->|"loads"| node_account
node_routes -->|"checks access"| node_authguard
node_login -->|"starts session"| node_authui
node_workspace -->|"uses session"| node_authui
node_authguard -->|"checks session"| node_authui
node_interceptor -->|"reads token"| node_authui
node_chatui -->|"sends requests"| node_api
node_chatui -->|"uses state"| node_convstore
node_workspace -->|"requests data"| node_api
node_workspace -->|"uses state"| node_convstore
node_convstore -->|"loads conversations"| node_api
node_authui -.->|"calls auth API"| node_authcontroller
node_api -.->|"calls conversation API"| node_convcontroller
node_api -.->|"calls AI API"| node_aicontroller
node_authcontroller -->|"delegates to"| node_authservice
node_authservice -->|"reads and writes"| node_prisma
node_convcontroller -->|"delegates to"| node_convservice
node_convservice -->|"reads and writes"| node_prisma
node_convservice -->|"requests model reply"| node_ollama
node_aicontroller -->|"delegates to"| node_aiservice
node_aiservice -->|"requests model reply"| node_ollama
node_prisma -.->|"queries"| node_database

click node_routes "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/app.routes.ts"
click node_login "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/auth/login.component.ts"
click node_workspace "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/workspace/workspace.component.ts"
click node_chatui "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/chat/chat.component.ts"
click node_home "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/home/home.component.ts"
click node_account "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/account/account.component.ts"
click node_authui "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/auth/auth.service.ts"
click node_authguard "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/auth/auth.guard.ts"
click node_interceptor "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/auth/auth.interceptor.ts"
click node_api "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/services/api.service.ts"
click node_convstore "https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/services/conversation-store.service.ts"
click node_authcontroller "https://github.com/midouwell/ai-business-platform/blob/main/backend/src/auth/auth.controller.ts"
click node_authservice "https://github.com/midouwell/ai-business-platform/blob/main/backend/src/auth/auth.service.ts"
click node_convcontroller "https://github.com/midouwell/ai-business-platform/blob/main/backend/src/conversations/conversations.controller.ts"
click node_convservice "https://github.com/midouwell/ai-business-platform/blob/main/backend/src/conversations/conversations.service.ts"
click node_aicontroller "https://github.com/midouwell/ai-business-platform/blob/main/backend/src/ai/ai.controller.ts"
click node_aiservice "https://github.com/midouwell/ai-business-platform/blob/main/backend/src/ai/ai.service.ts"
click node_ollama "https://github.com/midouwell/ai-business-platform/blob/main/backend/src/ollama/ollama.service.ts"
click node_prisma "https://github.com/midouwell/ai-business-platform/blob/main/backend/src/prisma/prisma.service.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_routes,node_login,node_workspace,node_chatui,node_home,node_account,node_api,node_convstore,node_user toneBlue
class node_authui,node_authguard,node_interceptor,node_authcontroller,node_authservice toneAmber
class node_convcontroller,node_convservice,node_aicontroller,node_aiservice,node_ollama toneMint
class node_prisma,node_database toneRose
```

## Components

### Angular client

- [App routes](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/app.routes.ts): `frontend/src/app/app.routes.ts`
- [Login and registration](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/auth/login.component.ts): `frontend/src/app/features/auth/login.component.ts`
- [Workspace](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/workspace/workspace.component.ts): `frontend/src/app/features/workspace/workspace.component.ts`
- [Chat view](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/chat/chat.component.ts): `frontend/src/app/features/chat/chat.component.ts`
- [Home view](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/home/home.component.ts): `frontend/src/app/features/home/home.component.ts`
- [Account view](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/features/account/account.component.ts): `frontend/src/app/features/account/account.component.ts`
- [API client](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/services/api.service.ts): `frontend/src/app/core/services/api.service.ts`
- [Conversation store](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/services/conversation-store.service.ts): `frontend/src/app/core/services/conversation-store.service.ts`

### Authentication

- [Client session](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/auth/auth.service.ts): `frontend/src/app/core/auth/auth.service.ts`
- [Route guard](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/auth/auth.guard.ts): `frontend/src/app/core/auth/auth.guard.ts`
- [Auth interceptor](https://github.com/midouwell/ai-business-platform/blob/main/frontend/src/app/core/auth/auth.interceptor.ts): `frontend/src/app/core/auth/auth.interceptor.ts`
- [Auth endpoints](https://github.com/midouwell/ai-business-platform/blob/main/backend/src/auth/auth.controller.ts): `backend/src/auth/auth.controller.ts`
- [Auth service](https://github.com/midouwell/ai-business-platform/blob/main/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`

### Conversations and AI

- [Conversation endpoints](https://github.com/midouwell/ai-business-platform/blob/main/backend/src/conversations/conversations.controller.ts): `backend/src/conversations/conversations.controller.ts`
- [Conversation service](https://github.com/midouwell/ai-business-platform/blob/main/backend/src/conversations/conversations.service.ts): `backend/src/conversations/conversations.service.ts`
- [AI endpoint](https://github.com/midouwell/ai-business-platform/blob/main/backend/src/ai/ai.controller.ts): `backend/src/ai/ai.controller.ts`
- [AI service](https://github.com/midouwell/ai-business-platform/blob/main/backend/src/ai/ai.service.ts): `backend/src/ai/ai.service.ts`
- [Ollama model service](https://github.com/midouwell/ai-business-platform/blob/main/backend/src/ollama/ollama.service.ts): `backend/src/ollama/ollama.service.ts`

### Backend platform

- [Prisma data access](https://github.com/midouwell/ai-business-platform/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`
- **PostgreSQL**

### Other components

- **User**

## Connections

- User → App routes: navigates (evidence: `frontend/src/app/app.routes.ts`)
- App routes → Login and registration: loads (evidence: `frontend/src/app/app.routes.ts`)
- App routes → Workspace: loads (evidence: `frontend/src/app/app.routes.ts`)
- App routes → Chat view: loads (evidence: `frontend/src/app/app.routes.ts`)
- App routes → Home view: loads (evidence: `frontend/src/app/app.routes.ts`)
- App routes → Account view: loads (evidence: `frontend/src/app/app.routes.ts`)
- App routes → Route guard: checks access (evidence: `frontend/src/app/app.routes.ts`)
- Login and registration → Client session: starts session (evidence: `frontend/src/app/features/auth/login.component.ts`)
- Workspace → Client session: uses session (evidence: `frontend/src/app/features/workspace/workspace.component.ts`)
- Route guard → Client session: checks session (evidence: `frontend/src/app/core/auth/auth.guard.ts`)
- Auth interceptor → Client session: reads token (evidence: `frontend/src/app/core/auth/auth.interceptor.ts`)
- Chat view → API client: sends requests (evidence: `frontend/src/app/features/chat/chat.component.ts`)
- Chat view → Conversation store: uses state (evidence: `frontend/src/app/features/chat/chat.component.ts`)
- Workspace → API client: requests data (evidence: `frontend/src/app/features/workspace/workspace.component.ts`)
- Workspace → Conversation store: uses state (evidence: `frontend/src/app/features/workspace/workspace.component.ts`)
- Conversation store → API client: loads conversations (evidence: `frontend/src/app/core/services/conversation-store.service.ts`)
- Client session → Auth endpoints: calls auth API
- API client → Conversation endpoints: calls conversation API
- API client → AI endpoint: calls AI API
- Auth endpoints → Auth service: delegates to (evidence: `backend/src/auth/auth.controller.ts`)
- Auth service → Prisma data access: reads and writes (evidence: `backend/src/auth/auth.service.ts`)
- Conversation endpoints → Conversation service: delegates to (evidence: `backend/src/conversations/conversations.controller.ts`)
- Conversation service → Prisma data access: reads and writes (evidence: `backend/src/conversations/conversations.service.ts`)
- Conversation service → Ollama model service: requests model reply (evidence: `backend/src/conversations/conversations.service.ts`)
- AI endpoint → AI service: delegates to (evidence: `backend/src/ai/ai.controller.ts`)
- AI service → Ollama model service: requests model reply (evidence: `backend/src/ai/ai.service.ts`)
- Prisma data access → PostgreSQL: queries
