Skip to content

Repository files navigation

Invoice Generator Application

Invoice Generator Microservice: A Spring Boot service providing REST APIs to create, retrieve, and manage invoices using MongoDB. Supports dynamic PDF invoice generation and is container-ready for microservices deployment.


Tech Stack

  • Java: 21
  • Spring Boot: 4.0.1
  • MongoDB:Local MongoDB
  • Spring Data MongoDB
  • OpenPDF: PDF generation
  • Maven: Build tool
  • Docker
  • GitHub Actions (CI/CD)

Docker & CI/CD Support

This project uses GitHub Actions to automatically build and push the Docker image to Docker Hub whenever new code is pushed to the main branch.

Automated Workflow

Trigger:

  • Push to the main branch

Actions Performed:

  1. Checkout source code
  2. Build Docker image
  3. Push Docker image to Docker Hub

Docker Image Repository

alfinakash/invoice-generator

Latest Tag

docker login
docker push alfinakash/invoice-generator:latest

Pull Docker Image from Docker Hub

docker pull alfinakash/invoice-generator:latest

Run Application Using Docker

docker run -p 8080:8080 \
  -e MONGODB_URI=<your_mongodb_uri> \
  alfinakash/invoice-generator:latest

Application will be available at:

http://localhost:8080

Manual command for Docker build and Push to hub

docker build --no-cache -t alfinakash/invoice-generator:latest .
docker push alfinakash/invoice-generator:latest

Deployment

Property Value
Environment Production
Status Live
Base URL https://invoice-generator-backend-service.onrender.com

Replace http://localhost:8080 with the production base URL when accessing APIs.


Invoice PDF

Invoice Pdf


API Endpoints

POST /api/v1/auth/register

Request Body:

{
  "username": " ",
  "password": " "
}

POST /api/v1/auth/login

Note: Use the returned token for all protected endpoints by adding it in the Authorization header as a Bearer token: Authorization: Bearer <JWT token here>

Request Body:

{
  "username": " ",
  "password": " "
}

POST /api/v1/invoices

GET /api/v1/invoices

GET /api/v1/invoices/{id}

PUT /api/v1/invoices/{id}

DELETE /api/v1/invoices/{id}

GET /api/v1/invoices/{id}/pdf


Configuration

Application Properties

spring.application.name=invoice-generator
server.port=8080
spring.data.mongodb.uri=mongodb://localhost:27017
spring.jackson.time-zone=UTC
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
springdoc.api-docs.path=/v3/api-docs
springdoc.swagger-ui.path=/swagger-ui.html
logging.level.org.springframework.web=INFO
logging.level.org.springframework.data.mongodb=INFO
invoice.pdf.title=INVOICE
invoice.pdf.author=Azyrex


Running the Application

Prerequisites

  • Java 21 installed
  • MongoDB Atlas account or local MongoDB running

Run Command

./mvnw clean spring-boot:run

Application will start at:

http://localhost:8080

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages