AI Consultant Toolkit Pro ‐ Technical Architecture Report - magicplatforms/new-machine-workflows GitHub Wiki
The AI Consultant Toolkit Pro is a modern React-based Single Page Application (SPA) built with TypeScript and Vite. It features a sophisticated subdomain-based multi-tenancy system that allows different branded experiences while sharing a single codebase. The application is deployed on Azure Static Web Apps and uses GitHub Actions for CI/CD.
- Technology Stack
- Application Architecture
- Subdomain & Templating System
- Deployment Architecture
- JavaScript Libraries
- Component Architecture
- Build & Development Workflow
- Frontend Framework: React 18.3.1
- Language: TypeScript 5.5.3
- Build Tool: Vite 5.4.1
- Styling: Tailwind CSS 3.4.11
- Routing: React Router DOM 6.26.2
- State Management: React Context API
- Component Library: Shadcn/ui (Radix UI primitives)
- Deployment: Azure Static Web Apps
- Linting: ESLint 9.9.0
- Package Manager: npm
- Version Control: Git/GitHub
- CI/CD: GitHub Actions
graph TB
subgraph "Client Browser"
A[User Access] --> B{Subdomain Detection}
B -->|URL Param| C[Query String Parser]
B -->|Hostname| D[Domain Parser]
end
subgraph "React Application"
C --> E[useSubdomain Hook]
D --> E
E --> F[ContentProvider Context]
F --> G[Content Configuration]
G --> H[Dynamic Component Rendering]
H --> I[Hero Component]
H --> J[ProblemSection Component]
H --> K[ToolkitOverview Component]
H --> L[PricingTiers Component]
H --> M[Footer Component]
end
subgraph "Content Management"
G --> N[contentConfigs Object]
N --> O[Default Config]
N --> P[Healthcare Config]
N --> Q[Developer Config]
N --> R[Supply Chain Config]
N --> S[Legal Config]
end
style A fill:#f9f,stroke:#333,stroke-width:2px
style F fill:#bbf,stroke:#333,stroke-width:2px
style N fill:#bfb,stroke:#333,stroke-width:2px
sequenceDiagram
participant User
participant Browser
participant useSubdomain Hook
participant ContentProvider
participant Components
User->>Browser: Access website
Browser->>useSubdomain Hook: Window.location
alt URL Parameter Present
useSubdomain Hook->>useSubdomain Hook: Check ?subdomain=X
useSubdomain Hook->>ContentProvider: Return subdomain from URL
else Azure Static App or Localhost
useSubdomain Hook->>useSubdomain Hook: Check URL params first
useSubdomain Hook->>ContentProvider: Return subdomain or 'default'
else Production Domain
useSubdomain Hook->>useSubdomain Hook: Parse hostname
useSubdomain Hook->>useSubdomain Hook: Extract first part
useSubdomain Hook->>ContentProvider: Return subdomain
end
ContentProvider->>ContentProvider: Load content config
ContentProvider->>Components: Provide themed content
Components->>Browser: Render customized UI
Browser->>User: Display branded experience
The templating system uses a centralized configuration object that defines:
- Branding: Logo, company name, tagline
- Hero Section: Headlines, CTAs, value propositions
- Problem Section: Statistics, benefits, pain points
- Toolkit Overview: Features, tools, additional offerings
- Pricing: Tiers, features, special offers
- Theme: Primary colors, accent colors, backgrounds
- default: General AI consulting toolkit
- healthcare: Healthcare-specific AI solutions
- developer: Developer-focused AI tools
- supply: Supply chain AI optimization
- legal: Legal practice AI solutions
graph LR
subgraph "Development"
A[Local Development] --> B[Git Push]
end
subgraph "GitHub"
B --> C[GitHub Repository]
C --> D[GitHub Actions]
D --> E[Build Process]
E --> F[Vite Build]
end
subgraph "Azure"
F --> G[Azure Static Web Apps]
G --> H[CDN Distribution]
H --> I[Global Edge Nodes]
end
subgraph "Users"
I --> J[End Users]
end
style C fill:#f96,stroke:#333,stroke-width:2px
style G fill:#69f,stroke:#333,stroke-width:2px
-
Build Output:
dist
directory - API Location: None (frontend only)
-
Routing: Client-side with fallback to
index.html
-
GitHub Secret:
AZURE_STATIC_WEB_APPS_API_TOKEN
Library | Version | Purpose |
---|---|---|
react | 18.3.1 | UI framework |
react-dom | 18.3.1 | React DOM rendering |
react-router-dom | 6.26.2 | Client-side routing |
@tanstack/react-query | 5.56.2 | Server state management |
react-hook-form | 7.53.0 | Form handling |
zod | 3.23.8 | Schema validation |
graph TD
subgraph "Entry Points"
A[main.tsx] --> B[App.tsx]
end
subgraph "Context Layer"
B --> C[QueryClientProvider]
C --> D[ContentProvider]
D --> E[TooltipProvider]
end
subgraph "Routing"
E --> F[BrowserRouter]
F --> G[Routes]
G --> H[Index Page]
G --> I[NotFound Page]
end
subgraph "Page Components"
H --> J[Hero]
H --> K[ProblemSection]
H --> L[ToolkitOverview]
H --> M[PricingTiers]
H --> N[Footer]
H --> O[SubdomainDemo]
end
subgraph "Shared Systems"
J --> P[useContentConfig]
K --> P
L --> P
M --> P
P --> Q[ContentContext]
Q --> R[useSubdomain Hook]
end
style A fill:#f9f,stroke:#333,stroke-width:2px
style D fill:#bbf,stroke:#333,stroke-width:2px
style R fill:#bfb,stroke:#333,stroke-width:2px
-
Layout Components
-
Hero.tsx
: Landing page hero section -
ProblemSection.tsx
: Problem/opportunity presentation -
ToolkitOverview.tsx
: Feature showcase -
PricingTiers.tsx
: Pricing and tier display -
Footer.tsx
: Site footer
-
-
UI Components (Shadcn/ui)
- 50+ pre-built components
- Based on Radix UI primitives
- Styled with Tailwind CSS
- Type-safe with TypeScript
-
Demo Components
-
SubdomainDemo.tsx
: Development subdomain switcher
-
graph LR
subgraph "Development"
A[npm run dev] --> B[Vite Dev Server]
B --> C[Hot Module Replacement]
C --> D[localhost:8080]
end
subgraph "Build Process"
E[npm run build] --> F[TypeScript Compilation]
F --> G[Vite Build]
G --> H[Minification]
H --> I[dist/]
end
subgraph "Deployment"
I --> J[GitHub Push]
J --> K[GitHub Actions]
K --> L[Azure Deploy]
end
style A fill:#9f9,stroke:#333,stroke-width:2px
style E fill:#f99,stroke:#333,stroke-width:2px
style L fill:#99f,stroke:#333,stroke-width:2px
- Hot Module Replacement: Instant updates without page reload
- TypeScript Support: Full type safety and IntelliSense
-
Path Aliases:
@/
maps tosrc/
directory - Component Tagging: Development-only component inspection
- CSS Processing: PostCSS with Tailwind CSS
- Code Splitting: Automatic route-based splitting
- Tree Shaking: Removes unused code
- Minification: JavaScript and CSS optimization
- Asset Optimization: Image and font optimization
- Source Maps: Debug support in production
- Content Security Policy: Configured in Azure Static Web Apps
- HTTPS Only: Enforced by Azure
- No Server-Side Code: Static site reduces attack surface
- Environment Variables: Managed through Azure configuration
- Lazy Loading: Routes loaded on demand
- CDN Distribution: Global edge caching
- Optimized Bundle Size: ~250KB gzipped
- Efficient Re-renders: React Context optimization
- Tailwind Purge: Removes unused CSS classes
- Subdomain Multi-tenancy: Infinite branded experiences
- Static Hosting: No server scaling required
- Edge Caching: Global performance
- Configuration-driven: Easy to add new subdomains
- Component Reusability: Shared UI components
- GitHub Actions: Build and deployment status
- Azure Portal: Traffic and performance metrics
- Application Insights: Optional detailed monitoring
- Browser DevTools: Client-side performance
- Page Load Time: Target < 2 seconds
- Time to Interactive: Target < 3 seconds
- Bundle Size: Monitor growth
- Error Rate: Track client-side errors
- Conversion Rate: Per subdomain tracking
- Progressive Web App: Add offline support
- Internationalization: Multi-language support
- A/B Testing: Built-in experimentation
- Analytics Integration: Google Analytics or similar
- API Integration: Backend services for dynamic content
- CMS Integration: Content management system
- Authentication: User accounts and personalization
- SEO Optimization: Server-side rendering consideration
The AI Consultant Toolkit Pro demonstrates a modern approach to building multi-tenant SaaS applications using React and TypeScript. The subdomain-based templating system provides flexibility while maintaining a single codebase, and the Azure Static Web Apps deployment ensures global performance and reliability. The architecture is well-suited for scaling to support additional verticals and use cases with minimal development effort.
# AI Consultant Toolkit Pro - Technical Architecture ReportThe AI Consultant Toolkit Pro is a modern React-based Single Page Application (SPA) built with TypeScript and Vite. It features a sophisticated subdomain-based multi-tenancy system that allows different branded experiences while sharing a single codebase. The application is deployed on Azure Static Web Apps and uses GitHub Actions for CI/CD.
- [Technology Stack](#technology-stack)
- [Application Architecture](#application-architecture)
- [Subdomain & Templating System](#subdomain--templating-system)
- [Deployment Architecture](#deployment-architecture)
- [JavaScript Libraries](#javascript-libraries)
- [Component Architecture](#component-architecture)
- [Build & Development Workflow](#build--development-workflow)
- Frontend Framework: React 18.3.1
- Language: TypeScript 5.5.3
- Build Tool: Vite 5.4.1
- Styling: Tailwind CSS 3.4.11
- Routing: React Router DOM 6.26.2
- State Management: React Context API
- Component Library: Shadcn/ui (Radix UI primitives)
- Deployment: Azure Static Web Apps
- Linting: ESLint 9.9.0
- Package Manager: npm
- Version Control: Git/GitHub
- CI/CD: GitHub Actions
graph TB
subgraph "Client Browser"
A[User Access] --> B{Subdomain Detection}
B -->|URL Param| C[Query String Parser]
B -->|Hostname| D[Domain Parser]
end
subgraph "React Application"
C --> E[useSubdomain Hook]
D --> E
E --> F[ContentProvider Context]
F --> G[Content Configuration]
G --> H[Dynamic Component Rendering]
H --> I[Hero Component]
H --> J[ProblemSection Component]
H --> K[ToolkitOverview Component]
H --> L[PricingTiers Component]
H --> M[Footer Component]
end
subgraph "Content Management"
G --> N[contentConfigs Object]
N --> O[Default Config]
N --> P[Healthcare Config]
N --> Q[Developer Config]
N --> R[Supply Chain Config]
N --> S[Legal Config]
end
style A fill:#f9f,stroke:#333,stroke-width:2px
style F fill:#bbf,stroke:#333,stroke-width:2px
style N fill:#bfb,stroke:#333,stroke-width:2px
sequenceDiagram
participant User
participant Browser
participant useSubdomain Hook
participant ContentProvider
participant Components
User->>Browser: Access website
Browser->>useSubdomain Hook: Window.location
alt URL Parameter Present
useSubdomain Hook->>useSubdomain Hook: Check ?subdomain=X
useSubdomain Hook->>ContentProvider: Return subdomain from URL
else Azure Static App or Localhost
useSubdomain Hook->>useSubdomain Hook: Check URL params first
useSubdomain Hook->>ContentProvider: Return subdomain or 'default'
else Production Domain
useSubdomain Hook->>useSubdomain Hook: Parse hostname
useSubdomain Hook->>useSubdomain Hook: Extract first part
useSubdomain Hook->>ContentProvider: Return subdomain
end
ContentProvider->>ContentProvider: Load content config
ContentProvider->>Components: Provide themed content
Components->>Browser: Render customized UI
Browser->>User: Display branded experience
The templating system uses a centralized configuration object that defines:
- Branding: Logo, company name, tagline
- Hero Section: Headlines, CTAs, value propositions
- Problem Section: Statistics, benefits, pain points
- Toolkit Overview: Features, tools, additional offerings
- Pricing: Tiers, features, special offers
- Theme: Primary colors, accent colors, backgrounds
- default: General AI consulting toolkit
- healthcare: Healthcare-specific AI solutions
- developer: Developer-focused AI tools
- supply: Supply chain AI optimization
- legal: Legal practice AI solutions
graph LR
subgraph "Development"
A[Local Development] --> B[Git Push]
end
subgraph "GitHub"
B --> C[GitHub Repository]
C --> D[GitHub Actions]
D --> E[Build Process]
E --> F[Vite Build]
end
subgraph "Azure"
F --> G[Azure Static Web Apps]
G --> H[CDN Distribution]
H --> I[Global Edge Nodes]
end
subgraph "Users"
I --> J[End Users]
end
style C fill:#f96,stroke:#333,stroke-width:2px
style G fill:#69f,stroke:#333,stroke-width:2px
-
Build Output:
dist
directory - API Location: None (frontend only)
-
Routing: Client-side with fallback to
index.html
-
GitHub Secret:
AZURE_STATIC_WEB_APPS_API_TOKEN
Library | Version | Purpose |
---|---|---|
react | 18.3.1 | UI framework |
react-dom | 18.3.1 | React DOM rendering |
react-router-dom | 6.26.2 | Client-side routing |
@tanstack/react-query | 5.56.2 | Server state management |
react-hook-form | 7.53.0 | Form handling |
zod | 3.23.8 | Schema validation |
Library | Version | Purpose |
---|---|---|
@radix-ui/* | Various | Headless UI components |
lucide-react | 0.462.0 | Icon library |
tailwindcss | 3.4.11 | Utility-first CSS |
clsx | 2.1.1 | Conditional classes |
tailwind-merge | 2.5.2 | Merge Tailwind classes |
class-variance-authority | 0.7.1 | Component variants |
Library | Version | Purpose |
---|---|---|
date-fns | 3.6.0 | Date manipulation |
recharts | 2.12.7 | Data visualization |
sonner | 1.5.0 | Toast notifications |
cmdk | 1.0.0 | Command menu |
vaul | 0.9.3 | Drawer component |
graph TD
subgraph "Entry Points"
A[main.tsx] --> B[App.tsx]
end
subgraph "Context Layer"
B --> C[QueryClientProvider]
C --> D[ContentProvider]
D --> E[TooltipProvider]
end
subgraph "Routing"
E --> F[BrowserRouter]
F --> G[Routes]
G --> H[Index Page]
G --> I[NotFound Page]
end
subgraph "Page Components"
H --> J[Hero]
H --> K[ProblemSection]
H --> L[ToolkitOverview]
H --> M[PricingTiers]
H --> N[Footer]
H --> O[SubdomainDemo]
end
subgraph "Shared Systems"
J --> P[useContentConfig]
K --> P
L --> P
M --> P
P --> Q[ContentContext]
Q --> R[useSubdomain Hook]
end
style A fill:#f9f,stroke:#333,stroke-width:2px
style D fill:#bbf,stroke:#333,stroke-width:2px
style R fill:#bfb,stroke:#333,stroke-width:2px
-
Layout Components
-
Hero.tsx
: Landing page hero section -
ProblemSection.tsx
: Problem/opportunity presentation -
ToolkitOverview.tsx
: Feature showcase -
PricingTiers.tsx
: Pricing and tier display -
Footer.tsx
: Site footer
-
-
UI Components (Shadcn/ui)
- 50+ pre-built components
- Based on Radix UI primitives
- Styled with Tailwind CSS
- Type-safe with TypeScript
-
Demo Components
-
SubdomainDemo.tsx
: Development subdomain switcher
-
graph LR
subgraph "Development"
A[npm run dev] --> B[Vite Dev Server]
B --> C[Hot Module Replacement]
C --> D[localhost:8080]
end
subgraph "Build Process"
E[npm run build] --> F[TypeScript Compilation]
F --> G[Vite Build]
G --> H[Minification]
H --> I[dist/]
end
subgraph "Deployment"
I --> J[GitHub Push]
J --> K[GitHub Actions]
K --> L[Azure Deploy]
end
style A fill:#9f9,stroke:#333,stroke-width:2px
style E fill:#f99,stroke:#333,stroke-width:2px
style L fill:#99f,stroke:#333,stroke-width:2px
- Hot Module Replacement: Instant updates without page reload
- TypeScript Support: Full type safety and IntelliSense
-
Path Aliases:
@/
maps tosrc/
directory - Component Tagging: Development-only component inspection
- CSS Processing: PostCSS with Tailwind CSS
- Code Splitting: Automatic route-based splitting
- Tree Shaking: Removes unused code
- Minification: JavaScript and CSS optimization
- Asset Optimization: Image and font optimization
- Source Maps: Debug support in production
- Content Security Policy: Configured in Azure Static Web Apps
- HTTPS Only: Enforced by Azure
- No Server-Side Code: Static site reduces attack surface
- Environment Variables: Managed through Azure configuration
- Lazy Loading: Routes loaded on demand
- CDN Distribution: Global edge caching
- Optimized Bundle Size: ~250KB gzipped
- Efficient Re-renders: React Context optimization
- Tailwind Purge: Removes unused CSS classes
- Subdomain Multi-tenancy: Infinite branded experiences
- Static Hosting: No server scaling required
- Edge Caching: Global performance
- Configuration-driven: Easy to add new subdomains
- Component Reusability: Shared UI components
- GitHub Actions: Build and deployment status
- Azure Portal: Traffic and performance metrics
- Application Insights: Optional detailed monitoring
- Browser DevTools: Client-side performance
- Page Load Time: Target < 2 seconds
- Time to Interactive: Target < 3 seconds
- Bundle Size: Monitor growth
- Error Rate: Track client-side errors
- Conversion Rate: Per subdomain tracking
- Progressive Web App: Add offline support
- Internationalization: Multi-language support
- A/B Testing: Built-in experimentation
- Analytics Integration: Google Analytics or similar
- API Integration: Backend services for dynamic content
- CMS Integration: Content management system
- Authentication: User accounts and personalization
- SEO Optimization: Server-side rendering consideration
The AI Consultant Toolkit Pro demonstrates a modern approach to building multi-tenant SaaS applications using React and TypeScript. The subdomain-based templating system provides flexibility while maintaining a single codebase, and the Azure Static Web Apps deployment ensures global performance and reliability. The architecture is well-suited for scaling to support additional verticals and use cases with minimal development effort.