# netinova/spomap architecture

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

- Interactive diagram: https://gitdiagram.com/netinova/spomap
- Repository: https://github.com/netinova/spomap

## Overview

SPOMAP is a Swing desktop point-of-sale and marketplace application. Users authenticate, browse a product catalog, manage a cart, and check out; checkout verifies wallet funds, adjusts stock and balance, then records an invoice. Separate workflows cover invoice history/refunds, profile and wallet management, product administration, shop analytics, and settings and themes. The architecture is documented as MVC, with controllers coordinating UI actions and services handling JSON persistence. Some controller and service implementations were not sampled, so uncertain wiring is omitted.

Main entry points: [`src/Main.java`](https://github.com/netinova/spomap/blob/main/src/Main.java) (Application startup), [`src/Controller/ShoppingCartController.java`](https://github.com/netinova/spomap/blob/main/src/Controller/ShoppingCartController.java) (Cart and checkout), [`src/Service/InvoiceService.java`](https://github.com/netinova/spomap/blob/main/src/Service/InvoiceService.java) (Invoice service), [`src/Service/UserService.java`](https://github.com/netinova/spomap/blob/main/src/Service/UserService.java) (User service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Swing interface"]
  node_authview["Authentication UI"]
  node_shopview["Shop UI<br/>[ShopView.java]"]
  node_cartview["Cart UI"]
  node_invoiceview["Invoice UI<br/>[InvoiceView.java]"]
  node_settingview["Settings UI<br/>[SettingView.java]"]
end

subgraph group_control["Application control"]
  node_main["Application startup<br/>[Main.java]"]
  node_app["App orchestrator<br/>[AppController.java]"]
  node_auth["Authentication"]
  node_cartctrl["Cart and checkout"]
  node_invoicectrl["Invoice workflow"]
  node_userprofile["Profile management"]
end

subgraph group_commerce["Commerce services"]
  node_productsvc["Product persistence"]
  node_invoicesvc["Invoice service"]
  node_usersvc["User service<br/>[UserService.java]"]
end

subgraph group_data["Domain and persistence"]
  node_catalog["Product catalog"]
  node_productdb[("Product records<br/>[products.json]")]
  node_invoicedb[("Invoice records<br/>[invoices.json]")]
  node_userdb[("Role user records<br/>[normal_users.json]")]
  node_analyticsdb[("Analytics records")]
  node_settingsdb[("App settings<br/>[settings.json]")]
  node_themedb[("Theme definitions<br/>[themes.json]")]
end

subgraph group_custom["Preferences and analytics"]
  node_analytics["Shop analytics"]
  node_settingssvc["Settings service"]
  node_themesvc["Theme service<br/>[ThemeService.java]"]
end

node_user(("Shop user"))

node_user -->|"enters credentials"| node_authview
node_authview -->|"sends input"| node_auth
node_auth -->|"authenticates/registers"| node_usersvc
node_usersvc -->|"reads/writes users"| node_userdb
node_main -->|"creates controllers"| node_app
node_main -->|"loads products"| node_productsvc
node_productsvc -->|"reads/writes catalog"| node_productdb
node_app -->|"creates controller"| node_cartctrl
node_app -->|"creates controller"| node_invoicectrl
node_user -->|"browses products"| node_shopview
node_user -->|"manages cart"| node_cartview
node_cartctrl -->|"checks products and stock"| node_catalog
node_cartctrl -->|"records checkout"| node_invoicesvc
node_cartctrl -->|"persists wallet"| node_usersvc
node_invoicectrl -->|"loads invoices"| node_invoicesvc
node_invoicectrl -->|"updates invoice UI"| node_invoiceview
node_invoicesvc -->|"reads/writes invoices"| node_invoicedb
node_user -->|"manages profile"| node_userprofile
node_userprofile -->|"updates account"| node_usersvc
node_userprofile -->|"requests sales metrics"| node_analytics
node_analytics -->|"queries invoice data"| node_invoicesvc
node_analytics -->|"persists metrics"| node_analyticsdb
node_user -->|"changes preferences"| node_settingview
node_main -->|"loads settings"| node_settingssvc
node_main -->|"loads active theme"| node_themesvc
node_settingssvc -->|"reads/writes settings"| node_settingsdb
node_themesvc -->|"reads/writes themes"| node_themedb

click node_main "https://github.com/netinova/spomap/blob/main/src/Main.java"
click node_app "https://github.com/netinova/spomap/blob/main/src/Controller/AppController.java"
click node_authview "https://github.com/netinova/spomap/blob/main/src/View/AuthenticationView.java"
click node_auth "https://github.com/netinova/spomap/blob/main/src/Controller/AuthenticationController.java"
click node_shopview "https://github.com/netinova/spomap/blob/main/src/View/ShopView.java"
click node_cartview "https://github.com/netinova/spomap/blob/main/src/View/ShoppingCartView.java"
click node_cartctrl "https://github.com/netinova/spomap/blob/main/src/Controller/ShoppingCartController.java"
click node_catalog "https://github.com/netinova/spomap/blob/main/src/Model/ProductCatalog.java"
click node_productsvc "https://github.com/netinova/spomap/blob/main/src/Service/ProductService.java"
click node_productdb "https://github.com/netinova/spomap/blob/main/database/products.json"
click node_invoicectrl "https://github.com/netinova/spomap/blob/main/src/Controller/InvoiceController.java"
click node_invoiceview "https://github.com/netinova/spomap/blob/main/src/View/InvoiceView.java"
click node_invoicesvc "https://github.com/netinova/spomap/blob/main/src/Service/InvoiceService.java"
click node_invoicedb "https://github.com/netinova/spomap/blob/main/database/invoices.json"
click node_userprofile "https://github.com/netinova/spomap/blob/main/src/Controller/UserProfileController.java"
click node_usersvc "https://github.com/netinova/spomap/blob/main/src/Service/UserService.java"
click node_userdb "https://github.com/netinova/spomap/blob/main/database/normal_users.json"
click node_analytics "https://github.com/netinova/spomap/blob/main/src/Service/AnalyticsService.java"
click node_analyticsdb "https://github.com/netinova/spomap/blob/main/database/shop_analytics.json"
click node_settingview "https://github.com/netinova/spomap/blob/main/src/View/SettingView.java"
click node_settingssvc "https://github.com/netinova/spomap/blob/main/src/Service/SettingsService.java"
click node_settingsdb "https://github.com/netinova/spomap/blob/main/database/settings.json"
click node_themesvc "https://github.com/netinova/spomap/blob/main/src/Service/ThemeService.java"
click node_themedb "https://github.com/netinova/spomap/blob/main/database/themes.json"

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_authview,node_shopview,node_cartview,node_invoiceview,node_settingview,node_user toneBlue
class node_main,node_app,node_auth,node_cartctrl,node_invoicectrl,node_userprofile toneAmber
class node_productsvc,node_invoicesvc,node_usersvc toneMint
class node_catalog,node_productdb,node_invoicedb,node_userdb,node_analyticsdb,node_settingsdb,node_themedb toneRose
class node_analytics,node_settingssvc,node_themesvc toneIndigo
```

## Components

### Swing interface

- [Authentication UI](https://github.com/netinova/spomap/blob/main/src/View/AuthenticationView.java): `src/View/AuthenticationView.java`
- [Shop UI](https://github.com/netinova/spomap/blob/main/src/View/ShopView.java): `src/View/ShopView.java`
- [Cart UI](https://github.com/netinova/spomap/blob/main/src/View/ShoppingCartView.java): `src/View/ShoppingCartView.java`
- [Invoice UI](https://github.com/netinova/spomap/blob/main/src/View/InvoiceView.java): `src/View/InvoiceView.java`
- [Settings UI](https://github.com/netinova/spomap/blob/main/src/View/SettingView.java): `src/View/SettingView.java`

### Application control

- [Application startup](https://github.com/netinova/spomap/blob/main/src/Main.java): `src/Main.java`
- [App orchestrator](https://github.com/netinova/spomap/blob/main/src/Controller/AppController.java): `src/Controller/AppController.java`
- [Authentication](https://github.com/netinova/spomap/blob/main/src/Controller/AuthenticationController.java): `src/Controller/AuthenticationController.java`
- [Cart and checkout](https://github.com/netinova/spomap/blob/main/src/Controller/ShoppingCartController.java): `src/Controller/ShoppingCartController.java`
- [Invoice workflow](https://github.com/netinova/spomap/blob/main/src/Controller/InvoiceController.java): `src/Controller/InvoiceController.java`
- [Profile management](https://github.com/netinova/spomap/blob/main/src/Controller/UserProfileController.java): `src/Controller/UserProfileController.java`

### Commerce services

- [Product persistence](https://github.com/netinova/spomap/blob/main/src/Service/ProductService.java): `src/Service/ProductService.java`
- [Invoice service](https://github.com/netinova/spomap/blob/main/src/Service/InvoiceService.java): `src/Service/InvoiceService.java`
- [User service](https://github.com/netinova/spomap/blob/main/src/Service/UserService.java): `src/Service/UserService.java`

### Domain and persistence

- [Product catalog](https://github.com/netinova/spomap/blob/main/src/Model/ProductCatalog.java): `src/Model/ProductCatalog.java`
- [Product records](https://github.com/netinova/spomap/blob/main/database/products.json): `database/products.json`
- [Invoice records](https://github.com/netinova/spomap/blob/main/database/invoices.json): `database/invoices.json`
- [Role user records](https://github.com/netinova/spomap/blob/main/database/normal_users.json): `database/normal_users.json`
- [Analytics records](https://github.com/netinova/spomap/blob/main/database/shop_analytics.json): `database/shop_analytics.json`
- [App settings](https://github.com/netinova/spomap/blob/main/database/settings.json): `database/settings.json`
- [Theme definitions](https://github.com/netinova/spomap/blob/main/database/themes.json): `database/themes.json`

### Preferences and analytics

- [Shop analytics](https://github.com/netinova/spomap/blob/main/src/Service/AnalyticsService.java): `src/Service/AnalyticsService.java`
- [Settings service](https://github.com/netinova/spomap/blob/main/src/Service/SettingsService.java): `src/Service/SettingsService.java`
- [Theme service](https://github.com/netinova/spomap/blob/main/src/Service/ThemeService.java): `src/Service/ThemeService.java`

### Other components

- **Shop user**

## Connections

- Shop user → Authentication UI: enters credentials
- Authentication UI → Authentication: sends input
- Authentication → User service: authenticates/registers
- User service → Role user records: reads/writes users
- Application startup → App orchestrator: creates controllers
- Application startup → Product persistence: loads products
- Product persistence → Product records: reads/writes catalog
- App orchestrator → Cart and checkout: creates controller
- App orchestrator → Invoice workflow: creates controller
- Shop user → Shop UI: browses products
- Shop user → Cart UI: manages cart
- Cart and checkout → Product catalog: checks products and stock
- Cart and checkout → Invoice service: records checkout
- Cart and checkout → User service: persists wallet
- Invoice workflow → Invoice service: loads invoices
- Invoice workflow → Invoice UI: updates invoice UI
- Invoice service → Invoice records: reads/writes invoices
- Shop user → Profile management: manages profile
- Profile management → User service: updates account
- Profile management → Shop analytics: requests sales metrics
- Shop analytics → Invoice service: queries invoice data
- Shop analytics → Analytics records: persists metrics
- Shop user → Settings UI: changes preferences
- Application startup → Settings service: loads settings
- Application startup → Theme service: loads active theme
- Settings service → App settings: reads/writes settings
- Theme service → Theme definitions: reads/writes themes
