A powerful Java Spring Boot invoice and receipt generator application for professional billing needs.
Billgen Pro is a comprehensive server-side billing application built with Spring Boot and Thymeleaf. It provides professional invoice and receipt generation with modern web application architecture and robust data persistence.
- User Authentication: Secure user registration and login with Spring Security
- Email-based authentication with password validation
- BCrypt password hashing for secure password storage
- User-specific data isolation (users can only access their own invoices and receipts)
- Protected routes requiring authentication
- Invoice Generation: Create and customize professional invoices with company info, items, taxes, and notes
- Receipt Generation: Generate receipts with multiple template options
- PDF Export: Export invoices and receipts as professional PDFs using iText
- Data Persistence: Store invoices and receipts in a database with full CRUD operations
- Tax Calculations: Automatic tax calculations with configurable tax rates
- Responsive Design: Bootstrap-based responsive web interface
- Item Management: Dynamic item addition/removal with real-time total calculations
- Backend: Spring Boot 3.2.0
- Security: Spring Security with form-based authentication
- Database: MySQL (production) / H2 (development)
- Template Engine: Thymeleaf
- PDF Generation: iText 7
- Frontend: HTML5, CSS, Bootstrap 5
- Build Tool: Maven
- Java Version: 17+
- Containerization: Docker & Docker Compose
- Java 17 or higher
- Maven 3.6+ (for local development)
- Docker and Docker Compose (for containerized deployment)
- MySQL database (for production)
Option A: Using Docker Compose (Recommended - No MySQL setup needed)
# Make sure Docker Desktop is running, then:
./deploy.sh startOption B: Local MySQL Setup
-
Set up MySQL database (see MYSQL_SETUP.md):
mysql -u root -p CREATE DATABASE billgenpro; -
Run with helper script:
./run-local.sh
Or manually set environment variables:
export SPRING_DATASOURCE_PASSWORD=your_mysql_password mvn spring-boot:run -
Access the application:
- Main application: http://localhost:5000
- Login page: http://localhost:5000/login
- Registration page: http://localhost:5000/register
Having MySQL connection issues? See LOCAL_SETUP.md for detailed troubleshooting.
-
Clone the repository:
git clone <repository-url> cd billgen-pro-main
-
Deploy with Docker Compose:
./deploy.sh start
Or manually:
docker-compose up -d
-
Access the application:
- Application: http://localhost:3000 (default port, change HOST_PORT in docker-compose.yml if needed)
For more deployment options, see QUICKSTART.md or DEPLOYMENT.md
-
Register a new account:
- Navigate to http://localhost:5000/register
- Enter your name, email, and password (minimum 6 characters)
- Click "Register" to create your account
-
Login:
- Use your registered email and password to login at http://localhost:5000/login
- After successful login, you'll be redirected to the home page
Registration:
- Navigate to
/registeror click "Register here" on the login page - Fill in your name, email, and password
- Password must be at least 6 characters long
- Email must be unique (not already registered)
- Upon successful registration, you'll be redirected to the login page
Login:
- Navigate to
/loginor access any protected route - Enter your registered email and password
- After successful authentication, you'll be redirected to the home page
- All invoices and receipts are user-specific - you'll only see your own data
Logout:
- Click the logout button in the navigation menu
- You'll be logged out and redirected to the login page
Security Features:
- Passwords are securely hashed using BCrypt before storage
- All application routes except
/register,/login, and static resources require authentication - Session-based authentication maintains your login state
- User data isolation ensures each user only accesses their own invoices and receipts
- Login to your account (required)
- Navigate to the home page or click "Create Invoice"
- Fill in company information, invoice details, and items
- The invoice will be automatically associated with your user account
- Save the invoice
- Download as PDF or view/edit later
- Login to your account (required)
- Click "Create Receipt" or go to
/receipts/new - Enter company details, receipt information, and items
- Add notes and footer message
- The receipt will be automatically associated with your user account
- Save and download as PDF
- View your invoices:
/invoices- Shows only invoices created by the logged-in user - View your receipts:
/receipts- Shows only receipts created by the logged-in user - Edit existing documents by clicking the edit button
- Delete documents with confirmation
- Download PDFs directly from the list view
- All data is isolated per user account
src/
โโโ main/
โ โโโ java/com/billgenpro/
โ โ โโโ BillgenProApplication.java # Main application class
โ โ โโโ controller/ # Web controllers
โ โ โ โโโ AuthController.java # Authentication endpoints
โ โ โ โโโ HomeController.java
โ โ โ โโโ InvoiceController.java
โ โ โ โโโ ReceiptController.java
โ โ โโโ config/ # Configuration classes
โ โ โ โโโ SecurityConfiguration.java # Spring Security config
โ โ โ โโโ CustomUserDetailsService.java # User authentication service
โ โ โโโ model/ # JPA entities
โ โ โ โโโ User.java # User entity
โ โ โ โโโ Invoice.java
โ โ โ โโโ InvoiceItem.java
โ โ โ โโโ Receipt.java
โ โ โ โโโ ReceiptItem.java
โ โ โ โโโ Company.java
โ โ โ โโโ BillTo.java
โ โ โโโ repository/ # Data repositories
โ โ โ โโโ UserRepository.java # User data access
โ โ โ โโโ InvoiceRepository.java
โ โ โ โโโ ReceiptRepository.java
โ โ โโโ service/ # Business logic
โ โ โโโ UserService.java # User registration and management
โ โ โโโ InvoiceService.java
โ โ โโโ ReceiptService.java
โ โ โโโ PdfService.java
โ โโโ resources/
โ โโโ templates/ # Thymeleaf templates
โ โ โโโ index.html
โ โ โโโ login.html # Login page
โ โ โโโ register.html # Registration page
โ โ โโโ invoices/
โ โ โโโ receipts/
โ โโโ application.properties # Configuration
The application is configured to use MySQL database. Configuration can be done via:
-
Environment variables (recommended for production):
SPRING_DATASOURCE_URLSPRING_DATASOURCE_USERNAMESPRING_DATASOURCE_PASSWORD
-
application.properties (for local development):
spring.datasource.url=jdbc:mysql://localhost:3306/billgenpro spring.datasource.username=your_username spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update
See application.properties for all configuration options.
GET /login- Display login pagePOST /login- Process login form submissionGET /register- Display registration pagePOST /register- Process user registrationPOST /logout- Logout user (redirects to login)
GET /- Home page (dashboard)GET /invoices- List all invoices for logged-in userGET /invoices/new- Create new invoice formPOST /invoices/save- Save invoice (associated with current user)GET /invoices/{id}- View invoice (only if owned by user)GET /invoices/{id}/edit- Edit invoice form (only if owned by user)GET /invoices/{id}/pdf- Download invoice PDF (only if owned by user)GET /invoices/{id}/delete- Delete invoice (only if owned by user)GET /receipts- List all receipts for logged-in userGET /receipts/new- Create new receipt formPOST /receipts/save- Save receipt (associated with current user)GET /receipts/{id}- View receipt (only if owned by user)GET /receipts/{id}/edit- Edit receipt form (only if owned by user)GET /receipts/{id}/pdf- Download receipt PDF (only if owned by user)GET /receipts/{id}/delete- Delete receipt (only if owned by user)
| Feature | Status |
|---|---|
| User Authentication & Registration | โ |
| Secure Password Hashing (BCrypt) | โ |
| User Data Isolation | โ |
| Invoice Generation | โ |
| Receipt Generation | โ |
| PDF Export | โ |
| Multiple Templates | โ |
| Database Persistence | โ |
| Real-time Calculations | โ |
| Responsive Design | โ |
| Professional UI | โ |
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Multiple PDF template designs
- Password reset functionality
- Email verification for new registrations
- REST API for mobile apps
- Email integration for sending invoices
- Payment tracking and reminders
- Advanced reporting and analytics
- Import/Export functionality
- Custom branding and themes
- Role-based access control (Admin/User roles)
- Docker Compose (Self-hosted): See QUICKSTART.md
- Railway (Cloud): See QUICKSTART.md
- Heroku (Cloud): See QUICKSTART.md
- Render (Cloud): See QUICKSTART.md
- AWS/Google Cloud/DigitalOcean: See DEPLOYMENT.md
For detailed deployment instructions, see:
- QUICKSTART.md - Quick deployment guide
- DEPLOYMENT.md - Comprehensive deployment guide
For issues and questions:
- Check the existing issues in the repository
- Create a new issue with detailed description
- Include steps to reproduce any bugs
Built with โค๏ธ using Spring Boot and Java