How romainenoir/file-converter_flask works
FLIPMYFILE is a single-service Flask web app (monolithic backend) that serves:
• Server-rendered HTML (Jinja2 templates) for pages
• Static assets (CSS/fonts/images)
• File upload + in-memory conversion pipeline (PDF/TXT/CSV/DOC conversions) returning a downloadable file
There is no database indicated in the tree/README; the core “system” is an HTTP web app whose main value is the conversion workflow and its in-memory (BytesIO) security posture.
Runtime entry / deployment
• run.py — entry point to start the server (dev/local)
• Procfile — deployment process definition (commonly PaaS like Heroku); reflect a production runtime wrapper (WSGI server) even if it’s not explicitly shown in code
• requirements.txt — dependency boundary (Flask, Flask-WTF, PyPDF2, fpdf, textcase, etc.)
Domain / application logic
• components/
• components/forms.py — Flask-WTF forms: upload + format selection; contains validation constraints (file type, required fields)
• components/functions.py — conversion functions (the “conversion engine”)
• components/utils.py — shared helpers (e.g., snake_case naming via textcase, BytesIO handling, common IO utilities)
• components/data.py — likely constants / mapping tables (e.g., supported conversions, MIME types, allowed extensions)
Actors + system boundary
• User (Browser): uploads file, selects target format, downloads output
• FLIPMYFILE Web App (Flask): the system
Optional but recommended (because Procfile exists):
• Hosting/Runtime platform: e.g., “PaaS dyno / container” running the Flask app
• Browser ⇄ Flask App over HTTPS
• Output file returned as HTTP response attachment (download)
Within the “FLIPMYFILE” boundary:
• Flask Application (WSGI) (container)
• Serves HTML (Jinja2 templates)
• Serves static assets
• Exposes HTTP endpoints for upload/convert
• Executes in-memory conversion
• In-memory storage only (BytesIO) — represent explicitly as a “Memory buffer” component (important architectural claim in README)
• No persistent storage — explicitly annotate: “No DB / no temp files written”
• “Python runtime”
Inside the Flask app container, split into as many components as possible based on the tree:
Routes/Controllers (app.py)
• Renders pages (index, about)
• Handles upload form submission
• Calls conversion engine
• Returns send_file/response with correct filename + MIME
Forms (components/forms.py)
• Upload field + target format selection
• Validation (file present, allowed type)
Conversion Engine (components/functions.py)
• Functions per conversion path (PDF→TXT, CSV→PDF, etc.)
• Delegates parsing/formatting to libraries
Conversion Configuration (components/data.py)
• Supported formats matrix
• Extension/MIME mappings
Utilities (components/utils.py)
• snake_case naming (textcase)
• BytesIO helpers
• Common file handling helpers
Templates (templates/*.html)
• UI rendering; show them as a “Template Views” subcomponent used by app.py
Static Assets (static/…)
• CSS/fonts/images, served by Flask/static middleware (or upstream proxy in production)
External libraries to show as dependencies (not owned by you)
• Flask / Jinja2
• Flask-WTF (WTForms)
• PyPDF2 (PDF reading)
• fpdf (PDF creation)
• textcase (filename formatting)
• Python io.BytesIO
Primary request flow (conversion)
Sequence (recommended):
components/functions.py → Libraries
• PDF read via PyPDF2
• PDF write via fpdf
• Other conversions as implemented (TXT/CSV/DOC logic)
app.py → Browser: HTTP response with attachment (download)
• “multipart upload”
• “in-memory BytesIO”
• “no server-side file persistence”
• “Content-Disposition: attachment; filename=…”
Static/UI asset flow
• Browser → Flask static handler: GET /static/style.css, /static/fonts/..., /static/images/...
Architectural patterns/principles to highlight (specific to this project)
• Monolithic Flask app (single deployable unit)
• Layered separation:
• routing/orchestration (app.py)
• validation (forms.py)
• domain logic (functions.py)
• configuration/constants (data.py)
• helpers (utils.py)
• Security/performance posture: in-memory processing (BytesIO) and no temp files
• Server-side rendering (templates) rather than SPA/API split
Explicitly call out what is *not* present:
• No DB
• No message queue
• No background jobs (conversion happens in request/response lifecycle)
• No external APIs (only local libraries)
Labeling conventions (make it unambiguous)
• “Flask Routes (app.py)”
• “Forms (components/forms.py)”
• “Conversion Engine (components/functions.py)”
• tech in the subtitle:
• “Flask 2.x / Jinja2”
• “Flask-WTF”
• “PyPDF2 / fpdf”
• “textcase”
• [ ] Browser actor and upload/download flows
• [ ] Flask app boundary + routes in app.py
• [ ] Templates + static asset serving
• [ ] Forms/validation (Flask-WTF)
• [ ] Conversion engine functions + supported formats mapping
• [ ] External libraries (PyPDF2, fpdf, textcase)
• [ ] BytesIO in-memory processing explicitly (and “no disk persistence” note)