LogicPaper is a high-performance document generation engine designed to automate complex reporting and contract workflows. It merges structured data (Excel/JSON) with Microsoft Office templates (.docx, .pptx) or text-based files (.md, .txt) using an advanced Jinja2-based strategy system.
The application follows an Enterprise Architecture (Hexagonal Architecture), utilizing FastAPI for high-concurrency requests, Redis for state management, and LibreOffice Headless for reliable PDF conversion.
Drag & Drop interface with real-time process logs.
Built-in guide for templating syntax.
- Asynchronous Batch Processing: Handles large datasets via background workers to prevent request timeouts.
- Multi-Format Support: Native rendering for Word, PowerPoint, Markdown, and Plain Text.
- Enterprise Integration API: Dedicated headless endpoints with X-API-Key authentication for ERP/CRM integration.
- State Persistence: Job tracking and session management powered by Redis.
- Complex Formatting Strategies: Custom filters for text manipulation, date arithmetic, localized currency, and conditional logic.
- Dynamic Asset Management: Automatic extraction, insertion, and resizing of images from ZIP archives.
- PDF Engine: Integrated LibreOffice for high-fidelity conversion of Office documents to PDF.
See how LogicPaper transforms raw data into professional documents instantly.
This is the mock data feeding the system:
{
"id": "CORP-001",
"company": "Acme Solutions Inc.",
"founded_date": "1998-05-12",
"revenue_q4": "1500000.00",
"is_public": "TRUE",
"compliance_check": "FALSE",
"auth_sig": "sig_valid.png"
}| Template (Input) | Generated Document (Output) |
|---|---|
| Model with Jinja2 Tags | Rendered PDF with Data |
![]() |
![]() |
| π View Template PDF | π View Result PDF |
graph TD
API[Client / API Key] -->|JSON/Multipart| FastAPI[FastAPI Web Server]
FastAPI -->|Enqueue Job| Worker[Background Worker]
Worker -->|Read/Write State| Redis[(Redis State Store)]
Worker -->|Templates| Core[Processing Core]
Core -->|Formatting| Strategies[Strategy Modules]
Core -->|Conversion| LibreOffice[LibreOffice Headless]
Worker -->|Output| Storage[/Persistent Storage/]
LogicPaper/
βββ app/
β βββ core/ # Core Business Logic
β β βββ engine.py # Document Rendering Engine
β β βββ formatter.py # Strategy Dispatcher
β β βββ batch.py # Batch Execution Logic
β β βββ strategies/ # Formatting Logic (Date, Number, String, etc.)
β βββ integration/ # Headless API Layer
β β βββ router.py # API Endpoints
β β βββ state.py # Redis Persistence Layer
β β βββ worker.py # Background Job Execution
β βββ main.py # FastAPI Main Application & UI Routes
β βββ utils.py # Shared Utilities & Schedulers
βββ static/ # Frontend UI (HTML/CSS/JS)
βββ persistent_templates/ # Storage for API Template Library
βββ data/ # Docker Volume for Temp Files
βββ Dockerfile # Image definition
βββ docker-compose.yml # Container orchestration
- Docker Desktop (20.10+)
- Docker Compose
-
Clone the Repository
git clone https://github.com/rubensbraz/LogicPaper.git cd LogicPaper -
Configure Environment Create a
.envfile based on the provided configuration (ensureLOGICPAPER_API_KEYis set). -
Start Services
docker-compose up --build
-
Access
- UI Dashboard:
http://localhost:8000 - API Documentation:
http://localhost:8000/docs
- UI Dashboard:
LogicPaper provides a dedicated integration layer for external systems.
- Endpoint:
POST /api/v1/integration/generate - Authentication:
X-API-Keyheader. - Workflow: Submit a JSON payload with data and template path; receive a
job_idto poll for status and download the result.
LogicPaper uses the pipe character (|) to apply formatting filters to variables.
For a complete list of filters, refer to the "How to Use" section in the application (Documentation in Github Pages).
{{ client_name | format_string('upper') }} -> "ACME CORP"
{{ client_id | format_string('prefix', 'ID: ') }} -> "ID: 12345"{{ contract_value | format_number('currency', 'USD') }} -> "$ 1,500.00"
{{ tax_rate | format_number('percent') }} -> "12.50%"
{{ total | format_number('spell_out', 'en') }} -> "one thousand five hundred"{{ start_date | format_date('long', 'en') }} -> "January 12, 2024"
{{ start_date | format_date('add_days', '30') }} -> "2024-02-11"Map status codes or values directly in the document:
{{ status_code | format_logic(
'10=Approved',
'20=Pending',
'default', 'Unknown'
) }}{{ email | format_mask('email') }} -> "j***@domain.com"{{ photo_filename | format_image('3', '4') }} -> (Resizes image to 3x4cm)LogicPaper is an open-source project and we love community contributions!
Whether you want to implement a new feature from our Roadmap, fix a bug, or improve documentation, please check our Contributing Guidelines before getting started.
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.
- Share: Copy and redistribute the material in any medium or format.
- Adapt: Remix, transform, and build upon the material.
- Attribution: You must give appropriate credit to Rubens Braz, provide a link to the license, and indicate if changes were made.
- NonCommercial: You may NOT use the material for commercial purposes (selling the software, using it for paid services, or integrating it into commercial products).
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/
"Automation is not about laziness; it's about precision."


