# brokernlamp/testing1 architecture

> Architecture diagram of the GitHub repository brokernlamp/testing1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brokernlamp/testing1
- Repository: https://github.com/brokernlamp/testing1

## Overview

##### Project Type and Purpose
- This is a monorepo containing two main subsystems:
a. A Windows desktop administration application (“SKS Admin Desktop”) built with .NET 8, WPF, Entity Framework Core, SQLite, following the MVVM pattern.
b. A customer-facing Next.js web application (TypeScript, React, Tailwind) with serverless API routes for e-commerce functions (cart, enquiries, uploads), backed by Supabase, ImageKit, and email services.

##### File Structure Analysis
- Top-level directories:
- Models/, Services/, App.xaml(.cs), MainWindow.xaml(.cs), appsettings.json → WPF app source
- SKS-Admin-Desktop/… → Visual Studio solution, build artifacts, bin/obj folders
- app/, components/, lib/, public/, etc. → Next.js frontend and API routes
- vagabonds-travel-blog-template-kit/… → static template kit (assets, JSON templates)
- Configuration files: appsettings.json (desktop), next.config.js, netlify.toml, env.example, tsconfig.json (web).
- Build scripts & manifests: .next/, package.json, nuget caches.

##### README Insights
- Desktop app features: dashboard, product/order/customer/inventory management, local SQLite DB, DI, MVVM.
- Technology stack for desktop: .NET 8, WPF, EF Core, SQLite.

a. Main Components
1. Desktop Subsystem
- UI Layer: WPF Views (XAML)
- ViewModels: MVVM binding layer
- Services Layer: business logic, AppDbContext (EF Core)
- Data Storage: local SQLite database (`SKSAdmin.db`)
2. Web Subsystem
- Frontend: Next.js pages under app/ + shared UI components
- API Layer: serverless routes (app/api/…/route.ts)
- Business Logic & Utilities: lib/auth.ts, lib/supabase.ts, lib/imagekit.ts, utils
- Data Storage: Supabase (PostgreSQL)
- External Services: ImageKit (media storage), Email SMTP provider
b. Relationships and Interactions
- Desktop UI → ViewModel → Services → EF Core → SQLite
- Web UI ↔ Next.js Server (SSR/CSR)
- Web UI → fetch()/Axios → API routes
- API routes → Supabase client for CRUD
- API routes → ImageKit SDK for file uploads
- API routes → Email service for quotations
c. Architectural Patterns & Principles
- Desktop: MVVM pattern, Dependency Injection for services, layered architecture (UI / VM / Services / Data)
- Web: Full-stack Next.js (React + serverless functions), modular UI components, API-as-backend
- Reuse of environment configs (.env), code-splitting via Next.js app directory
d. Key Technologies & Frameworks
- Desktop: .NET 8, WPF, Entity Framework Core, SQLite, MVVM, Microsoft DI
- Web: Next.js 14+, React, TypeScript, Tailwind CSS, Netlify deploy, Supabase SDK, ImageKit SDK

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Desktop Subsystem
    subgraph "Desktop Subsystem"
        direction TB
        EntryPoint["Entry Point\n(SKSAdminDesktop.App.csproj)"]:::external
        Views["WPF Views\n(MainWindow.xaml, App.xaml)"]:::ui
        VM["ViewModels"]:::logic
        Services["Services Layer\n(AppDbContext.cs)"]:::logic
        Data["SQLite DB\nSKSAdmin.db"]:::db
        ConfigDesktop["appsettings.json"]:::external

        EntryPoint -->|"startup"| Views
        Views -->|"DataBinding"| VM
        VM -->|"DI"| Services
        Services -->|"EF Core ORM"| Data
        ConfigDesktop -.->|"configuration"| Services
    end

    %% Web Subsystem
    subgraph "Web Subsystem"
        direction TB
        WebConfig["Config & Build Scripts\n(next.config.js, netlify.toml,\ntsconfig.json, env.example,\npostcss.config.js, tailwind.config.js)"]:::external
        Shared["Shared UI Components"]:::ui
        WebUI["Next.js Pages\n(layout.tsx, page.tsx,\nproducts/[id], cart, contact,\ncustom-order, admin/*)"]:::ui
        APILayer["API Routes\n(admin-login, admin-logout,\nadmin-send-reply,\nadmin-update-status,\ncart-enquiries, upload,\nimagekit-upload,\nsend-quotation-email)"]:::logic
        BL["Business Logic & Utilities\n(lib/auth.ts, lib/supabase.ts,\nlib/imagekit.ts, lib/utils.ts)"]:::logic
        Supabase["Supabase\n(PostgreSQL)"]:::db
        ImageKit["ImageKit"]:::external
        Email["Email Service"]:::external
        StaticTemplates["Static Template Kit\n(vagabonds-travel-blog-template-kit)"]:::external
        PublicAssets["Public Static Assets\n(public/clients, public/services,\npublic/uploads)"]:::external

        WebConfig -.->|"env/config"| WebUI
        WebConfig -.->|"env/config"| APILayer

        WebUI -->|"imports"| Shared
        WebUI -->|"fetch()/Axios"| APILayer
        WebUI -->|"imports"| BL

        APILayer -->|"uses"| BL
        APILayer -->|"Supabase JS client"| Supabase
        APILayer -->|"ImageKit SDK"| ImageKit
        APILayer -->|"SMTP"| Email

        StaticTemplates -.->|"fallback assets"| WebUI
        PublicAssets -.->|"served assets"| WebUI
    end

    %% Click Events Desktop
    click Views "https://github.com/brokernlamp/testing1/blob/main/SKS-Admin-Desktop/SKSAdminDesktop.App/MainWindow.xaml"
    click Views "https://github.com/brokernlamp/testing1/blob/main/SKS-Admin-Desktop/SKSAdminDesktop.App/App.xaml"
    click EntryPoint "https://github.com/brokernlamp/testing1/blob/main/SKS-Admin-Desktop/SKSAdminDesktop.App/SKSAdminDesktop.App.csproj"
    click Services "https://github.com/brokernlamp/testing1/blob/main/Services/AppDbContext.cs"
    click ConfigDesktop "https://github.com/brokernlamp/testing1/blob/main/appsettings.json"

    %% Click Events Web
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/layout.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/products/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/products/[id]/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/cart/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/contact/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/custom-order/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/admin/dashboard/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/admin/products/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/admin/customers/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/admin/enquiries/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/admin/inventory/page.tsx"
    click WebUI "https://github.com/brokernlamp/testing1/blob/main/app/admin/templates/page.tsx"

    click Shared "https://github.com/brokernlamp/testing1/blob/main/components/Header.tsx"
    click Shared "https://github.com/brokernlamp/testing1/blob/main/components/Footer.tsx"
    click Shared "https://github.com/brokernlamp/testing1/blob/main/components/CartButton.tsx"
    click Shared "https://github.com/brokernlamp/testing1/blob/main/components/GetQuotationButton.tsx"
    click Shared "https://github.com/brokernlamp/testing1/blob/main/components/ImageUpload.tsx"
    click Shared "https://github.com/brokernlamp/testing1/blob/main/components/SiteChrome.tsx"
    click Shared "https://github.com/brokernlamp/testing1/blob/main/components/ClientRoot.tsx"

    click APILayer "https://github.com/brokernlamp/testing1/blob/main/app/api/admin-login/route.ts"
    click APILayer "https://github.com/brokernlamp/testing1/blob/main/app/api/admin-logout/route.ts"
    click APILayer "https://github.com/brokernlamp/testing1/blob/main/app/api/admin-send-reply/route.ts"
    click APILayer "https://github.com/brokernlamp/testing1/blob/main/app/api/admin-update-status/route.ts"
    click APILayer "https://github.com/brokernlamp/testing1/blob/main/app/api/cart-enquiries/route.ts"
    click APILayer "https://github.com/brokernlamp/testing1/blob/main/app/api/upload/route.ts"
    click APILayer "https://github.com/brokernlamp/testing1/blob/main/app/api/imagekit-upload/route.ts"
    click APILayer "https://github.com/brokernlamp/testing1/blob/main/app/api/send-quotation-email/route.ts"

    click BL "https://github.com/brokernlamp/testing1/blob/main/lib/auth.ts"
    click BL "https://github.com/brokernlamp/testing1/blob/main/lib/supabase.ts"
    click BL "https://github.com/brokernlamp/testing1/blob/main/lib/imagekit.ts"
    click BL "https://github.com/brokernlamp/testing1/blob/main/lib/utils.ts"

    click WebConfig "https://github.com/brokernlamp/testing1/blob/main/next.config.js"
    click WebConfig "https://github.com/brokernlamp/testing1/blob/main/netlify.toml"
    click WebConfig "https://github.com/brokernlamp/testing1/blob/main/tsconfig.json"
    click WebConfig "https://github.com/brokernlamp/testing1/blob/main/env.example"
    click WebConfig "https://github.com/brokernlamp/testing1/blob/main/postcss.config.js"
    click WebConfig "https://github.com/brokernlamp/testing1/blob/main/tailwind.config.js"

    click StaticTemplates "https://github.com/brokernlamp/testing1/tree/main/vagabonds-travel-blog-template-kit/templates"
    click PublicAssets "https://github.com/brokernlamp/testing1/tree/main/public/clients"
    click PublicAssets "https://github.com/brokernlamp/testing1/tree/main/public/services"
    click PublicAssets "https://github.com/brokernlamp/testing1/tree/main/public/uploads"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef logic fill:#d4edda,stroke:#333,stroke-width:1px
    classDef db fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px
```
