$ show totumonline/totum-mit
Totum is a self-hosted, low-code/no-code application framework built on PHP 8.3 and PostgreSQL. It functions as a dynamic database and spreadsheet hybrid, allowing users to define data structures (tables, fields) via JSON configuration and implement business logic using a proprietary DSL ('Totum-code'). The system features a modular architecture with a CLI management tool (`bin/totum`), a web-based UI (`http/index.php`), and extensive role-based access control (RBAC). It supports multi-tenancy via schema mapping, external service integration (PDF, Excel, AI), and automated installation via Ansible playbooks for Ubuntu environments. The core logic relies heavily on traits for shared functionality and abstract base classes for table and field handling, creating a flexible but complex codebase. The application is designed for rapid business application construction (CRM, ERP, custom tools) without requiring traditional coding. It stores schema definitions and field configurations in PostgreSQL JSONB columns, enabling runtime structure modification. The calculation engine (`Calculate.php`) parses and executes custom code strings for data validation, formatting, and cross-table logic. While the architecture is robust for its intended purpose, it exhibits signs of technical debt including monolithic frontend JavaScript (`main.js`), hardcoded paths in installation scripts, and reliance on legacy libraries (Chart.js v2, jQuery). The codebase demonstrates significant craftsmanship in its dynamic table engine and calculation DSL, but maintenance requires careful handling of the custom parsing logic and schema migrations.
The LLM identified 4 files worth highlighting for reuse:
Implements a proprietary expression language parser and execution engine. It handles variable resolution, function calls, control structures, and error handling for the 'Totum-code' DSL. This component is reusable for any system requiring a custom scripting layer for business logic, demonstrating non-obvious skill in parsing and dynamic code execution without eval() where possible.
Abstract base class defining the contract for all table types (Real, JSON, Calcs). It enforces implementation of core behaviors like filtering, sorting, and recalculation. The heavy use of traits (WebInterfaceTrait, ActionsTrait) allows for flexible composition without deep inheritance, making it a strong example of the Strategy and Composition patterns in PHP.
Core abstraction for field types with dynamic instantiation based on configuration. It handles validation, calculation, and formatting logic for diverse data types (Select, File, Tree, etc.). The pattern of using traits for specific field behaviors (e.g., FuncNumbersTrait) allows for extensibility without bloating the base class.
Automated provisioning script for Ubuntu environments. It handles OS setup, package installation (PostgreSQL, Nginx, PHP-FPM), SSL certificate generation, and service configuration. While specific to Totum, the pattern of using Ansible for reproducible server setup is a reusable DevOps practice.