Note: This project is an AI-assisted software engineering experiment led by Carlos Arturo Rojas BolaΓ±os, exploring autonomous development capabilities while maintaining strict quality patterns and hexagonal architecture.
A professional service to convert Markdown and Text documents to styled PDF files.
Distributed under the MIT License. Copyright (c) 2026 Carlos Arturo Rojas BolaΓ±os. See LICENSE for details.
- Clean Architecture: Strictly follows Hexagonal Architecture (Ports & Adapters) pattern
- Multiple Interfaces: REST API (FastAPI) and CLI (Typer)
- Format Support: Markdown (with tables, code blocks) and Plain Text
- Professional Styling: Clean, readable PDF output with proper typography
- Multi-file Upload: Upload multiple files and get a ZIP with all PDFs
- Bulk Processing: Process local files via API endpoint
- Docker Ready: Fully containerized with Docker Compose
- Comprehensive Logging: Color-coded console + file rotation in
logs/service.log - Observability: Integrated request tracing (
X-Request-ID) and performance monitoring (X-Process-Time) - Auto-generated Documentation: Interactive Swagger UI at
/docs
This project follows a professional branching model for continuous evolution:
main: Production-ready code. Only contains stable, tagged releases (v1.x.x).develop: Integration branch for the next release. IMPORTANT: All Pull Requests from the community must target this branch.workspace/v1-next: Reserved for project owner. Active development branch for upcoming version prototyping and internal evolution.
text-to-pdf-service/
βββ src/
β βββ domain/ # Core business logic (models, ports, exceptions)
β βββ application/ # Use cases (Conversion Service)
β βββ adapters/
β β βββ driving/ # API and CLI
β β βββ driven/ # PDF and FileSystem implementations
β βββ infrastructure/ # Cross-cutting concerns (logger)
βββ tests/ # Unit and integration tests
β βββ unit/
β βββ integration/
βββ scripts/ # Development scripts
βββ data/ # Working directories
β βββ input/ # Place source files for bulk processing
β βββ output/ # Generated PDFs appear here
βββ logs/ # Application logs
βββ docs/ # Documentation (with docs/es/ for Spanish)
docker-compose up --buildThe API will be available at http://localhost:8000.
If you want to perform a clean-wipe and start fresh:
# 1. Stop and remove everything related to the project
docker-compose down --rmi all --volumes --remove-orphans
# 2. Build and start from scratch
docker-compose up -d --buildDocker Management Commands:
# Run in background
docker-compose up -d
# View logs
docker-compose logs -f
# Stop and remove containers
docker-compose downPrerequisites: Python 3.11.9 (Recommended), Poetry
# Install dependencies
poetry install
# Run API server
poetry run uvicorn src.adapters.driving.api:app --reload
# Or use CLI
poetry run python -m src.adapters.driving.cli convert input.md output.pdfInteractive Documentation: Open http://localhost:8000/docs in your browser.
curl -X POST "http://localhost:8000/convert/" \
-F "file=@document.md" \
--output result.pdfUpload multiple files and receive a ZIP with all PDFs:
curl -X POST "http://localhost:8000/convert/multiple" \
-F "files=@doc1.md" \
-F "files=@doc2.md" \
-F "files=@doc3.txt" \
--output results.zipLimits: Max 20 files, 10MB/file, 50MB total.
Process all files in data/input/:
curl -X POST "http://localhost:8000/bulk-convert"Check data/output/ for generated PDFs.
poetry run python -m src.adapters.driving.cli convert input.md output.pdf# Process all files from data/input to data/output
poetry run python scripts/process_local.pyThis project includes standardized workflows in .agent/workflows/ to simplify common tasks:
- Setup:
setup.md- Complete environment initialization. - Serve:
serve.md- Start the API server with correct paths.
If using an Agentic IDE (like Antigravity), you can run these directly via slash commands (e.g., /setup, /serve).
| Topic | English | EspaΓ±ol |
|---|---|---|
| Architecture | architecture.md | architecture.md |
| API Reference | api.md | api.md |
| Testing | tests.md | tests.md |
| Contributing | CONTRIBUTING.md | CONTRIBUTING.md |
| Code of Conduct | CODE_OF_CONDUCT.md | CODE_OF_CONDUCT.md |
| Commit Conventions | COMMIT_CONVENTIONS.md | COMMIT_CONVENTIONS.md |
| AI Development | AI_DEVELOPMENT.md | AI_DEVELOPMENT.md |
# Run all tests with coverage
poetry run pytest --cov=src --cov-report=term-missing
# Run specific test file
poetry run pytest tests/unit/test_service.py -vCurrent Coverage: 62%
Target Coverage: 70%+
The service includes professional observability features out-of-the-box:
- Request Tracing: Every API request is assigned a unique
X-Request-ID. This ID is returned in the response headers and included in all logs related to that request, enabling precise end-to-end tracing. - Performance Headers: The
X-Process-Timeresponse header reports the exact time (in seconds) the server took to process the conversion. - Structured Logs: Application logs are stored in
logs/service.logwith a rotating strategy. Console output is color-coded for fast visual debugging.
Log colors:
- π’ INFO (Green)
- π‘ WARNING (Yellow)
- π΄ ERROR (Red)
- π£ CRITICAL (Magenta)
- All code, comments, and docstrings: English
- User-facing output/reports: Spanish
- Follow PEP 8 and Hexagonal Architecture principles
This project uses Conventional Commits with required scopes. See COMMIT_CONVENTIONS.md.
- Define domain model in
src/domain/ - Create port (interface) if needed
- Implement adapter in
src/adapters/driven/ - Update service in
src/application/ - Expose via API or CLI in
src/adapters/driving/ - Write tests
See CONTRIBUTING.md for detailed guidelines.
Quick checklist:
- Tests pass (
poetry run pytest) - Code follows project architecture
- Commit messages follow conventions
- Public documentation has Spanish version
- β V1.0: Core conversion, API, CLI, Docker
- β V1.0: Multi-file upload endpoint
- β V1.0: Advanced observability and tracing
- β V1.0: Professional documentation (EN/ES)
The service is designed to run seamlessly on Windows, Linux, and macOS.
| Feature | Windows (PowerShell/CMD) | Linux / macOS (Bash/Zsh) |
|---|---|---|
| Paths | data\input, .\.venv |
data/input, ./.venv |
| Env Activation | .venv\Scripts\Activate.ps1 |
source .venv/bin/activate |
| Python Command | python or py |
python3 |
| Docker | Docker Desktop (Hyper-V/WSL2) | Docker Engine (Native) |
Tip
Why Docker? Using Docker is the highly recommended way to run the service in non-Windows environments or production, as it eliminates "it works on my machine" issues by packaging all OS dependencies (like PDF libraries) into a consistent container.
Maintainer: Carlos Arturo Rojas BolaΓ±os
Repository: text-to-pdf-service
Version: 1.0.0