How phoenixcodergit/facturacion_electronica_bolivia_compra_venta works
Project type and purpose
• This is a full-stack web application for “Facturación Electrónica con firma digital” (electronic invoicing with digital signature), targeting the Compra-Venta sector in Bolivia and integrating with national tax authority systems.
• The backend is a PHP-based MVC app (controllers, models, views) and the frontend is a JavaScript SPA (built via Webpack).
File structure
• Top level:
• index.php (PHP entry point)
• dist/ (compiled PHP + assets ready for deployment)
• src/ (JS source code, webpack.config.js, package.json)
• Inside dist/App:
• ajax/ (AJAX endpoints for login & session)
• controladores/ (MVC controllers for Facturas, Clientes, Usuarios, etc.)
• modelos/ (database‐mapping models)
• lib/ (Database connection, routing, base Model/View classes)
• config/ (constants, access.json)
• Routing is handled by App/lib/routes.php and .htaccess in dist.
• The build tool (Webpack) bundles JS from src/index.js into a dist artifact served by the PHP app.
README
• Confirms electronic invoicing with digital signature, authorized by the national tax authority.
• Implies an external government signature API or web service and a local relational database (e.g., MySQL/PostgreSQL).
a. Main components:
• Browser (User Interface)
• Frontend JS App (Webpack bundle)
• Backend PHP MVC App
• Database (e.g., MySQL)
• External Tax Authority Signature API
• (Optional) File Storage for signed documents
b. Relationships & interactions:
1. User → Browser loads index.php → serves HTML/JS/CSS
2. Browser ↔ AJAX → PHP controllers (via App/ajax & routes)
3. PHP controllers → Models → Database (CRUD ops)
4. PHP controllers → Digital Signature API → handle signed payloads
5. PHP → View templates → HTML responses (where applicable)
c. Architectural patterns & principles:
• MVC (controllers/models/views)
• Single-page/partial-page front end with AJAX calls
• Layered architecture (Presentation → Business logic → Persistence)
• Build-time bundling (Webpack) separated from runtime PHP
d. Key technologies & libraries:
• PHP 7+ (App/lib/Database.php, PrincipalModelo, PrincipalVista)
• Apache + .htaccess for routing
• Webpack + npm (src/index.js, package.json)
• JSON config (App/config/access.json)
• Digital signature integration (government API)