1 What is LedgerSMB

1.5 Application architecture

Due to its heritage from SQL Ledger and the on-going process of rewriting the inherited code, the architecture differs between parts of the application: the old parts and the ones which have already been rewritten.

Overall, the application consists of five layers:

  • The web browser (as the user interface)

  • The web server (as a network traffic handler)

  • The Perl (web)server process (as an application - Perl Web Server Gateway Interface (PSGI))

  • The database (as an application - PL/SQL)

  • The database (as storage)

In version 1.10 the user interface is a Single Page Application using a mixture of new (e.g. Vue 3, webpack 5 and Web Components) and old (e.g. Dojo Toolkit) technology.

The web server is an optional component that’s highly recommended for TLS termination and protecting the back end Perl HTTP server from malicious traffic11 1 This setup is an industry-wide accepted best practice for deploying web applications; web servers like Apache or Nginx have been and continue to be extensively security-reviewed. No other implementations can achieve the same level of scrutiny.. It may also be used for serving static page components such as images, style sheets and JavaScript component as an efficiency measure.

Recent releases add separation between business logic and process state with the latter being stored in the database and managed at the Perl layer. Other than that, it’s the Perl layer’s responsibility to forward web requests to the database and presenting the resulting data in response to the user interface. The original goal to reduce the Perl layer to be a “glue” layer between the web server and the database has been abandoned with the introduction of this additional (business process) layer.

At the “database as an application” layer, PL/SQL functions implement business functionality, such as creating cost of goods sold (COGS) accounting entries.

The “database as storage” layer is responsible for storing data with consistency and integrity; to that extent (and much more than in SL) constraints and triggers have been implemented. An additional role for the storage layer is to enforce data access rules; i.e. to protect data from being accessed by unauthorized users.

The main difference between old and new coding paradigms is at the Perl application layer: older code generates HTML fragments while newer code delivers data through web services. As part of the on-going code restructuring, there’s a major effort to create a Representational State Transfer (REST) web service based APIs. The intent here is to facilitate integration with other applications used by businesses (both in the business itself or as provided by customers and vendors).