This project is an Invoice Generator web application built with FastAPI and FastHX. It allows users to create, duplicate, and download customized invoices as PDF files.
- Generate invoices with custom fields
- Duplicate existing invoices for quick editing
- Download invoices as PDF files
- Responsive web interface
- Python 3.12
- FastAPI
- FastHX
- Jinja2
- ReportLab
- PyPDF2
-
Clone the repository:
git clone https://github.com/zengjie/invoice-generator.git cd invoice-generator
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Start the FastAPI server:
uvicorn main:app --reload
-
Open your web browser and navigate to
http://localhost:8000
-
Fill in the invoice details in the form and click "Generate Invoice" to create and download your PDF invoice.
-
To duplicate an existing invoice, click the "Duplicate" button next to the invoice you want to copy. This will create a new invoice with the same details, which you can then edit as needed.
main.py
: Main application file containing FastAPI routes and logicgen_invoice.py
: Module for generating PDF invoices using ReportLabmodels.py
: Data models for the applicationtemplates/
: Directory containing HTML templatesstatic/
: Directory for static files (CSS, JavaScript, images)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.