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.
- Java: 21
- Spring Boot: 4.0.1
- MongoDB:Local MongoDB
- Spring Data MongoDB
- OpenPDF: PDF generation
- Maven: Build tool
- Docker
- GitHub Actions (CI/CD)
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.
Trigger:
- Push to the
mainbranch
Actions Performed:
- Checkout source code
- Build Docker image
- Push Docker image to Docker Hub
alfinakash/invoice-generator
docker login
docker push alfinakash/invoice-generator:latestdocker 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
docker build --no-cache -t alfinakash/invoice-generator:latest .
docker push alfinakash/invoice-generator:latest
| Property | Value |
|---|---|
| Environment | Production |
| Status | Live |
| Base URL | https://invoice-generator-backend-service.onrender.com |
Replace
http://localhost:8080with the production base URL when accessing APIs.
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
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
- Java 21 installed
- MongoDB Atlas account or local MongoDB running
./mvnw clean spring-boot:runApplication will start at:
http://localhost:8080