π¬π§ English | π«π· FranΓ§ais
Financial automation built for rigor, traceability, and longevity
This README documents design principles and system architecture.
It intentionally avoids operational procedures and sensitive details.
This repository presents a financial automation system designed to handle:
- invoice generation (single & batch)
- revenue tracking
- payment reconciliation
- client balances
- accounting-ready exports
The system is deterministic, auditable, and explicit by design.
It operates:
- without a database
- without a CMS
- without a SaaS dependency
- without any exposed web interface
All executions run server-side, via CLI scripts and cron, with a strict separation of responsibilities.
This project is not a product, not a SaaS, and not a plug-and-play tool.
It documents a production-grade approach to financial automation.
automation/
β
βββ engine/
β βββ run.php β Moteur principal dβautomatisation (cron / CLI) (FR)
β β β Main automation engine (cron / CLI) (EN)
β β
β βββ billing_rules.php β RΓ¨gles de facturation et de tarification dynamique (FR)
β β β Billing rules and dynamic pricing logic (EN)
β β
β βββ run_batch.php β Moteur dβautomatisation BATCH pour la facturation clients (FR)
β β β Batch automation engine for client invoicing (EN)
β β
β βββ vendor/ β DΓ©pendances PHP (ex: DomPDF) (FR)
β β β PHP dependencies (e.g. DomPDF) (EN)
β β
β βββ alerts.php β Gestion des alertes et notifications dβexΓ©cution (FR)
β β β Execution alerts and notifications handling (EN)
β β
β βββ import_csv.php β Import et validation des fichiers CSV clients (FR)
β β β Client CSV import and validation handler (EN)
β β
β βββ mailer.php β Envoi des emails avec facture en piΓ¨ce jointe (FR)
β β β Email sender with invoice attachment (EN)
β βββ templates/
β βββ invoice.html.php β Template PDF de facture (bilingue FR / EN) (FR)
β β β Invoice PDF template (bilingual FR / EN) (EN)
β β
β βββ invoices_batch.html.php β Facture CLIENTS (batch) (FR)
β β Client Invoices (Batch) (EN)
βββ clients/
β βββ client_xxx.php β Fiche client (seul fichier Γ modifier par client) (FR)
β β Client configuration file (only file to edit per client) (EN)
βββ batch_clients/
β βββ client_xxx.php β Configuration batch dβun client final (facturation mensuelle) (FR)
β β Batch configuration for an end client (monthly invoicing) (EN)
βββ data/
β βββ logs/
β β βββ xxx.log β Logs dβexΓ©cution par client (FR)
β β β Execution logs per client (EN)
β βββ archive_batch/
β β βββ xxx.csv β CSV client archivΓ© (FR)
β β β Archived client CSV (EN)
β βββ batch_sent/
β β βββ xxx.zip β Zip envoyΓ©s (FR)
β β β Zip sent (EN)
β βββ usage/
β β βββ xxx.json β Suivi dβusage mensuel par client (FR)
β β β Monthly client usage tracking (EN)
β βββ revenues/
β β βββ xxx.json β Recettes cumulΓ©es (source comptable interne) (FR)
β β β Cumulative revenues (internal accounting source) (EN)
β βββ payments/
β β βββ xxx.json β Paiements reΓ§us du client (virements, montants rΓ©ellement encaissΓ©s) (FR)
β β β Payments received from the client (bank transfers, actually received amounts) (EN)
β βββ balance/
β β βββ xxx.json β Solde comptable du client (facturΓ© vs payΓ©, statut payΓ© / impayΓ©) (FR)
β β β Client accounting balance (invoiced vs paid, paid / unpaid status) (EN)
β βββ invoices/
β β βββ client/ β Factures de lβactivitΓ© principale (facturation directe, usage interne) (FR)
β β β Invoices from the main activity (direct invoicing, internal use) (EN)
β βββ invoices_batch/
β β βββ client/ β Factures gΓ©nΓ©rΓ©es dans le cadre du service batch (clients finaux) (FR)
β β β Invoices generated as part of the batch service (end clients) (EN)
β βββ inbox_batch/
β β βββ batch.csv β Fichier CSV fourni par le client (source de facturation batch) (FR)
β β β Client-provided CSV file (batch invoicing source) (EN)
β βββ counters/
β β βββ xxx.json β Compteur annuel de factures par client (facturation directe) (FR)
β β β Annual invoice counter per client (direct invoicing) (EN)
β βββ counters_batch/
β βββ xxx.json β Compteur annuel de factures par client (facturation batch) (FR)
β β Annual invoice counter per client (batch invoicing) (EN)
βββ docs/
β βββ format_csv.md β SpΓ©cification officielle du format CSV attendu (FR)
β β Official specification of the expected CSV format (EN)
βββ tools/
β βββ balances.php β Met Γ jour les soldes clients Γ partir des recettes et des paiements (FR)
β β β Updates client balances based on revenues and payments (EN)
β β
β βββ purge_log.php β Script de nettoyage (FR)
β β β Cleanup Script (EN)
β β
β βββ recettes_year.php β Script PHP dβexport des recettes encaissΓ©es sur une annΓ©e complΓ¨te (FR)
β β β PHP script to export actually received revenues for a full year (EN)
β β
β βββ recettes_month.php β Script PHP dβexport des recettes encaissΓ©es sur un mois donnΓ© (FR)
β β β PHP script to export actually received revenues for a given month (EN)
β β
β βββ revenues_csv.php β Script PHP dβexport des recettes vers un fichier CSV (comptabilitΓ©) (FR)
β β PHP script to export revenues to a CSV file (accounting) (EN)
βββ exports/
β βββ recettes/
β β βββ recettes.csv β CSV mensuels / annuels gΓ©nΓ©rΓ©s Γ la demande (FR)
β β β Monthly CSV exports generated on demand / Yearly CSV exports generated on demand (EN)
β β
β βββ payments/ β CSV gΓ©nΓ©rΓ© Γ partir des fichiers JSON de paiements reΓ§us (FR)
β βββ payments.csv β CSV generated from the received payments JSON files (EN)
β
βββ downloads/
β βββ *.zip β Archives ZIP mensuelles par client, contenant les factures PDF gΓ©nΓ©rΓ©es automatiquement (FR)
β β Monthly ZIP archives per client, containing automatically generated PDF invoices (EN)
β
βββ LICENCE.md β Conditions dβutilisation et cadre lΓ©gal (FR)
βββ LICENSE.md β Terms of use and legal Framework (EN)
β
βββ README_FR.md β Documentation gΓ©nΓ©rale du systΓ¨me (FR)
βββ README.md β General system documentation (EN)
- a documented architecture for financial automation
- a system designed to be predictable and auditable
- an example of strict separation between billing, payments, and accounting
- a real-world system used in production
- a certified accounting software
- a ready-to-use invoicing tool
- a payment processing system
- a web application or API service
The outputs produced by this system are intended for internal operational use and for integration with standard accounting workflows.
This system follows a small set of non-negotiable principles:
-
No magic
Every operation is explicit and traceable. -
No silent processing
Errors stop execution. They are logged and surfaced. -
No implicit correction
Invalid inputs are rejected, not βfixedβ. -
Files are proofs
Generated artifacts are considered immutable evidence, not disposable outputs. -
Strict separation of responsibilities
Billing, payments, balances, receipts, and exports are handled independently. -
CLI-only execution
No web exposure, no background ambiguity.
These principles favor predictability over convenience and clarity over speed.
The system is composed of independent layers, each with a single responsibility:
-
Billing engines
- direct invoicing
- batch invoicing (CSV-driven)
-
Business rules
- centralized pricing and billing logic
- single source of truth
-
Alerting layer
- blocking vs informational alerts
- explicit execution feedback
-
Payment layer
- manual payment records
- deliberately decoupled from billing
-
Balance reconciliation
- computed state (invoiced vs paid)
- paid / unpaid detection
-
Export layer
- accounting-ready CSV outputs
- reproducible at any time
No layer mutates another implicitly.
The directory layout mirrors the systemβs responsibilities:
engine/ β execution engines & business logic clients/ β client configuration (one file per client) batch_clients/ β batch client definitions data/ β immutable operational data (logs, invoices, balances) docs/ β internal specifications (e.g. CSV format) tools/ β reconciliation and export utilities exports/ β generated accounting artifacts downloads/ β packaged invoice archives
Each directory exists for one reason only.
Cross-responsibility coupling is intentionally avoided.
The system runs on a closed, repeatable cycle:
-
Generation phase
Invoices are generated based on explicit rules and configurations. -
Payment phase
Payments are recorded independently, without automation or assumptions. -
Reconciliation phase
Invoiced amounts are compared against received payments. -
Consolidation phase
Client balances are computed and statuses updated. -
Export phase
Accounting-ready artifacts are produced on demand.
At no point does the system infer or guess missing information.
In batch mode:
- one client provides one CSV file
- one CSV line equals one invoice
- validation is strict and structural
- the entire batch stops on the first error
- raw inputs are archived before consumption
This model favors data integrity over partial success.
Several mechanisms are enforced across the system:
- anti-duplicate protections
- annual sequential counters
- immutable archives
- explicit execution flags
- categorized alerts
- exhaustive logging
A failed execution is considered safer than a partial one.
- CLI-only execution
- no exposed endpoints
- no browser access
- no external API dependency for core operations
- data stored locally on the server
Security is achieved through absence of surface, not complexity.
The system is designed to:
- be understandable without its original author
- be auditable months or years later
- degrade loudly rather than silently
- integrate cleanly with standard accounting processes
This repository documents an engineering approach, not a shortcut.
Status: Stable β used in real production conditions.
The system has been designed to operate autonomously,
with a strong emphasis on rigor, traceability, and long-term maintainability.
Β© Palks Studio β see LICENSE.md
https://palks-studio.com
