A web application to generate PDF invoices from CSV or XLSX file contents using Python Flask, Docker, Google Cloud Platform and Firebase.
- Upload CSV or XLSX files containing invoice data.
- Generate PDF invoices from the uploaded data.
- Deploy easily with Docker on Google Cloud Platform.
- Host the web application on Firebase.
URL : https://invoice.moonstar.com.np
- Python and Flask for the main application logic and web server.
- Docker for containerization.
- Google Cloud Platform for deployment.
- Firebase for web hosting.
-
Clone the repository:
git clone https://github.com/yourusername/invoice-generator.git
-
Change to the project directory:
cd invoice-generator
-
Add secrets:
Create a
.env
file in the project root directory and add the following secrets:Flask_SECRET_KEY=your_secret_key
Replace
your_secret_key
with a secret key of your choice. -
Initialize Firebase:
-
Create a Firebase project from the Firebase Console.
-
Change the project plan to Blaze (Pay as you go).
-
Install Firebase CLI:
npm install -g firebase-tools
-
Login to Firebase and initialize Firebase:
firebase login
firebase init
-
Select your newly created Firebase project (Use an existing project).
-
During feature selection, choose Hosting.
- Hosting Setup: Public directory:
public
, Single-page app:No
- Hosting Setup: Public directory:
-
-
Setup Google Cloud Platform:
-
Install Google Cloud SDK : https://cloud.google.com/sdk/docs/install
-
Initialize GCP and set project:
gcloud init
gcloud config set project <your-project-id>
Note:
Replace<your-project-id>
with your firebase project id. -
Build and submit Docker image:
gcloud builds submit --tag gcr.io/<your-project-id>/invoice-generator
-
Deploy to Cloud Run:
gcloud run deploy invoice-generator \ --image gcr.io/<your-project-id>/invoice-generator \ --platform managed \ --region us-central1 \ --allow-unauthenticated
Note:
Replace<your-project-id>
with your firebase project id andus-central1
with your preferred region (optional).
-
-
Configure Firebase Hosting and Run the App:
-
Edit
firebase.json
file to include the rewrite configuration:{ "hosting": { "public": "public", "rewrites": [ { "source": "**", "run": { "serviceId": "invoice-generator", "region": "us-central1" } } ] } }
Note:
Replaceus-central1
with your preferred region (optional). -
Deploy to Firebase Hosting:
firebase deploy --only hosting
-
Your app will be available at:
https://<your-project-id>.web.app
Note:
You can also use a custom domain by connecting a domain to Firebase Hosting. For that go to Firebase Console > Hosting > Connect Custom Domain.
-
Email : [email protected]
This project is licensed under GNU General Public License.