# poolborges/unicenta-pos architecture

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

- Interactive diagram: https://gitdiagram.com/poolborges/unicenta-pos
- Repository: https://github.com/poolborges/unicenta-pos

## Overview

##### Project type and purpose
- This is a full-stack, desktop Point-Of-Sales (POS) application written in Java (Swing UI), organized as a multi-module Maven project.
- The README (“Kriol Open Source Point Of Sales”) confirms it’s a fork of Unicenta/OpenbravoPOS, with modules for the core app, domain model, data access, hardware abstraction, internationalization, templates, and third-party libraries.

##### File structure
- Top-level pom.xml defines the multi-module build.
- Modules under the root:
- kriolos-opos-app: the Swing application (UI, forms, StartPOS)
- kriolos-opos-base: foundational utilities (beans, data loader/persistence, GUI helpers)
- kriolos-opos-domain: business-domain entities and DataLogic classes (catalog, customers, sales, suppliers, etc.)
- kriolos-opos-hardware: hardware SPI for printers, displays, scales, scanners
- kriolos-opos-i18n / i18n_pt: resource bundles (locales)
- kriolos-opos-template: XML/Velocity templates for printing tickets, reports
- kriolos-opos-thirdparty: embedded JARs (OneWire, WebLaF)
- docker-compose.yml and README describe spinning up a MySQL/MariaDB container for development.
- CI/CD workflows (.github/workflows/ci.yml, Travis, crowdin.yml) and docs under docs/ confirm build and publication pipelines.

##### Key insights from README
- Launch path: mvnw exec:java -pl kriolos-opos-app com.openbravo.pos.forms.StartPOS
- Dependencies: MySQL/MariaDB (JDBC), Liquibase for schema migrations, no heavyweight framework—custom DataLogic + JDBC loader.

##### Main components & interactions
a. User Interface (kriolos-opos-app)
- Swing panels & forms (com.openbravo.pos.forms, com.openbravo.pos.panels, …)
- Starts in StartPOS → AppViewConnection → JRootApp → various JPanels
- Renders menus, catalog, ticketing, reports
b. Business Domain (kriolos-opos-domain)
- DataLogic* classes handle business rules and queries (DataLogicSales, DataLogicCustomers, etc.)
- Domain entities (CustomerInfo, TicketInfo, ProductInfo, etc.)
- BeanFactory and script engines (BeanFactoryScript, ScriptEngineVelocity, etc.)
c. Persistence Layer (kriolos-opos-base)
- JDBC-based Data Loader (SessionDBMySQL, PreparedSentence, SerializerRead/Write)
- DataParams, SentenceExec, Transaction abstractions
- Liquibase XML changelogs (src/main/resources/pos_liquidbase)
d. Hardware Abstraction (kriolos-opos-hardware)
- SPI interfaces (DevicePrinter, DeviceFiscalPrinter, DeviceDisplay, DeviceScale, DeviceScanner)
- ESC/POS, JavaPOS, screen‐simulator implementations
- CommStream abstraction for serial/USB communication
e. Templates & Reports (kriolos-opos-app & crisolos-opos-template)
- Velocity/XML templates in resources/com/openbravo/pos/templates
- JasperReports jrxml files under resources/com/openbravo/reports
f. Internationalization (kriolos-opos-i18n, kriolos-opos-i18n_pt)
- Resource bundles for UI and reports (Bundle.properties, *_pt.properties)
g. Third-Party Libraries (kriolos-opos-thirdparty)
- OneWireAPI.jar, WebLaF for look-and-feel

##### Architectural patterns & design principles
- Layered architecture:
- Presentation(UI) → Service/Business (DataLogic) → Persistence (JDBC/Data Loader) → Database
- Hardware layer accessed via SPI (inversion of control, factory patterns)
- Modularization via Maven multi-module: clear separation of concerns
- Factory & Strategy patterns:
- BeanFactory for entity creation
- PaymentPanelFactory, MagCardReaderFac
- ScriptEngineFactory
- Extensibility points:
- SPI for plugging hardware devices
- Script templates for custom business logic

- Clear labels on all modules and packages
- Related packages (e.g., com.openbravo.pos.sales → Domain → DataLogicSales)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Modules
    subgraph "Maven Multi-Module Project"
        direction TB
        UI["Swing UI<br>(kriolos-opos-app)"]:::ui
        Domain["Business Domain<br>(kriolos-opos-domain)"]:::domain
        Persist["Persistence Layer<br>(kriolos-opos-base)"]:::persist
        Hardware["Hardware Abstraction<br>(kriolos-opos-hardware)"]:::hardware
        Templates["Templates & Reports<br>(kriolos-opos-template & resources)"]:::templates
        I18n["Internationalization<br>(kriolos-opos-i18n)"]:::i18n
        ThirdParty["Third-Party Libraries<br>(kriolos-opos-thirdparty)"]:::thirdparty
    end

    %% External Services and Tools
    subgraph "External Services & Tools"
        direction TB
        Docker["Docker Compose"]:::external
        DB[(MySQL/<br>MariaDB)]:::db
        CICD["CI/CD Pipelines"]:::external
    end

    %% Interactions
    UI -->|"calls DataLogic"| Domain
    Domain -->|"invokes JDBC loader"| Persist
    Persist -->|"JDBC"| DB
    UI -->|"SPI Interface"| Hardware
    Domain -->|"SPI Interface"| Hardware
    UI -->|"Velocity/JRXML"| Templates
    Domain -->|"Velocity/JRXML"| Templates
    UI -->|"loads ResourceBundles"| I18n

    %% Deployment and Build
    Docker -->|"spins up"| DB
    CICD -->|builds modules| UI
    CICD -->|builds modules| Domain
    CICD -->|builds modules| Persist
    CICD -->|builds modules| Hardware
    CICD -->|builds modules| Templates
    CICD -->|builds modules| I18n
    CICD -->|builds modules| ThirdParty

    %% Click Events
    click UI "https://github.com/poolborges/unicenta-pos/tree/main/kriolos-opos-app/src/main/java/com/openbravo/pos/forms"
    click Domain "https://github.com/poolborges/unicenta-pos/tree/main/kriolos-opos-domain/src/main/java/com/openbravo/pos"
    click Persist "https://github.com/poolborges/unicenta-pos/tree/main/kriolos-opos-base/src/main/java/com/openbravo/data/loader"
    click Hardware "https://github.com/poolborges/unicenta-pos/tree/main/kriolos-opos-hardware/src/main/java/com/openbravo/pos/comm"
    click Templates "https://github.com/poolborges/unicenta-pos/tree/main/kriolos-opos-app/src/main/resources/com/openbravo/pos/templates"
    click I18n "https://github.com/poolborges/unicenta-pos/tree/main/kriolos-opos-i18n/src/main/resources/com/openbravo/pos"
    click ThirdParty "https://github.com/poolborges/unicenta-pos/blob/main/kriolos-opos-thirdparty/onewire/OneWireAPI.jar"
    click Docker "https://github.com/poolborges/unicenta-pos/blob/main/docker-compose.yml"
    click CICD "https://github.com/poolborges/unicenta-pos/blob/main/.github/workflows/ci.yml"

    %% Styles
    classDef ui fill:#b2f2bb,stroke:#2f9e44,stroke-width:2px
    classDef domain fill:#cff4fc,stroke:#0891b2,stroke-width:2px
    classDef persist fill:#fff3bf,stroke:#f08c00,stroke-width:2px
    classDef hardware fill:#ffe3e3,stroke:#c92a2a,stroke-width:2px
    classDef templates fill:#e5dbff,stroke:#5f3dc4,stroke-width:2px
    classDef i18n fill:#d0ebff,stroke:#339af0,stroke-width:2px
    classDef thirdparty fill:#f1f3f5,stroke:#868e96,stroke-width:2px
    classDef db fill:#495057,stroke:#212529,stroke-width:2px,stroke-dasharray: 5 5
    classDef external fill:#dee2e6,stroke:#495057,stroke-width:2px,stroke-dasharray: 5 5
```
