Billgen Pro is a secure billing application built with Spring Boot and Thymeleaf for generating professional invoices and receipts. It features user authentication, data isolation, and BCrypt password protection. Users can easily create, manage, and export invoices or receipts as PDFs, with automatic tax calculations and real-time total updates. The Bootstrap-based responsive UI ensures a smooth and professional billing experience.
- 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 customise 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)|
- 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.
- 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 a detailed description
- Include steps to reproduce any bugs
Built with β€οΈ by Abhiraj