Skip to content

A web application to generate PDF invoices from CSV file contents using Python Flask and Firebase Docker (GCP)

License

Notifications You must be signed in to change notification settings

jomanozgml/invoice-generator

Repository files navigation

invoice-generator

A web application to generate PDF invoices from CSV or XLSX file contents using Python Flask, Docker, Google Cloud Platform and Firebase.

Features

  • 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.

Preview

URL : https://invoice.moonstar.com.np

Technologies Used

  • Python and Flask for the main application logic and web server.
  • Docker for containerization.
  • Google Cloud Platform for deployment.
  • Firebase for web hosting.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/invoice-generator.git
  2. Change to the project directory:

    cd invoice-generator
  3. 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.

  4. 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
  5. 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 and us-central1 with your preferred region (optional).

  6. 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: Replace us-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.

Contact

Email : [email protected]

License

This project is licensed under GNU General Public License.

About

A web application to generate PDF invoices from CSV file contents using Python Flask and Firebase Docker (GCP)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published