A comprehensive payroll management system similar to Gusto, built with Java and Spring Boot. This system provides complete payroll processing, tax calculations, employee management, and payment history tracking.
-
Company Management
- Create and manage multiple companies
- Track company information (EIN, address, contact details)
- Active/inactive company status management
-
Employee Management
- Complete employee lifecycle management (hire, update, terminate)
- Support for multiple employment types (Full-time, Part-time, Contractor, Temporary, Intern)
- Flexible pay frequencies (Weekly, Bi-weekly, Semi-monthly, Monthly)
- Department and job title tracking
- Tax withholding configuration (federal and state allowances)
-
Payroll Processing
- Automated payroll creation for pay periods
- Support for salary-based and hourly employees
- Overtime calculation (1.5x rate)
- Bonus and commission handling
- Comprehensive tax calculations:
- Federal income tax (2024 tax brackets)
- State income tax (state-specific rates)
- FICA taxes (Social Security and Medicare)
- Additional Medicare tax for high earners
- Year-to-date tracking for gross pay and taxes
- Payroll status workflow (Draft → Pending → Processing → Processed → Completed)
-
Deductions Management
- Health insurance deductions
- 401(k) retirement contributions
- Custom deductions
-
Reporting & Analytics
- Employee payroll history
- Year-to-date totals
- Payroll summaries by period
- Tax withholding reports
- Java 17 - Programming language
- Spring Boot 3.2.0 - Application framework
- Spring Data JPA - Data persistence
- H2 Database - In-memory database (development)
- PostgreSQL - Production database (configurable)
- Spring Security - Authentication and authorization
- Maven - Dependency management
- Lombok - Boilerplate reduction
- ModelMapper - DTO mapping
- OpenAPI/Swagger - API documentation
src/
├── main/
│ ├── java/com/payrollcheck/
│ │ ├── config/ # Configuration classes
│ │ │ ├── ModelMapperConfig.java
│ │ │ ├── OpenApiConfig.java
│ │ │ └── SecurityConfig.java
│ │ ├── controller/ # REST API controllers
│ │ │ ├── CompanyController.java
│ │ │ ├── EmployeeController.java
│ │ │ ├── PayrollController.java
│ │ │ └── PayrollItemController.java
│ │ ├── dto/ # Data Transfer Objects
│ │ │ ├── CompanyDTO.java
│ │ │ ├── EmployeeDTO.java
│ │ │ ├── PayrollDTO.java
│ │ │ ├── PayrollItemDTO.java
│ │ │ ├── CreatePayrollRequest.java
│ │ │ └── UpdatePayrollItemRequest.java
│ │ ├── exception/ # Exception handling
│ │ │ ├── BusinessException.java
│ │ │ ├── DuplicateResourceException.java
│ │ │ ├── ResourceNotFoundException.java
│ │ │ ├── GlobalExceptionHandler.java
│ │ │ ├── ErrorResponse.java
│ │ │ └── ValidationErrorResponse.java
│ │ ├── model/ # Domain entities
│ │ │ ├── BaseEntity.java
│ │ │ ├── Company.java
│ │ │ ├── Employee.java
│ │ │ ├── Payroll.java
│ │ │ ├── PayrollItem.java
│ │ │ └── enums/
│ │ │ ├── EmploymentType.java
│ │ │ ├── PayFrequency.java
│ │ │ └── PayrollStatus.java
│ │ ├── repository/ # Data access layer
│ │ │ ├── CompanyRepository.java
│ │ │ ├── EmployeeRepository.java
│ │ │ ├── PayrollRepository.java
│ │ │ └── PayrollItemRepository.java
│ │ ├── service/ # Business logic layer
│ │ │ ├── CompanyService.java
│ │ │ ├── EmployeeService.java
│ │ │ ├── PayrollService.java
│ │ │ └── TaxCalculationService.java
│ │ └── PayrollCheckApplication.java
│ └── resources/
│ ├── application.yml
│ └── application-prod.yml
└── test/
- Java 17 or higher
- Maven 3.6 or higher
- PostgreSQL (for production) - optional
- Clone the repository:
git clone <repository-url>
cd Payroll-Check- Build the project:
mvn clean install- Run the application:
mvn spring-boot:runThe application will start on http://localhost:8080
The application uses H2 database by default. Access the H2 console at:
- URL:
http://localhost:8080/h2-console - JDBC URL:
jdbc:h2:mem:payrolldb - Username:
sa - Password: (leave blank)
To use PostgreSQL in production:
- Create a PostgreSQL database:
CREATE DATABASE payrolldb;- Run with production profile:
mvn spring-boot:run -Dspring-boot.run.profiles=prod- Set environment variables:
export DB_USERNAME=your_username
export DB_PASSWORD=your_password
export SERVER_PORT=8080Access the interactive API documentation at:
http://localhost:8080/swagger-ui.html
The API uses Basic Authentication. Default credentials:
- Username:
admin - Password:
admin123
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/companies |
Create a new company |
| GET | /api/companies/{id} |
Get company by ID |
| GET | /api/companies/ein/{ein} |
Get company by EIN |
| GET | /api/companies |
Get all companies |
| GET | /api/companies/active |
Get active companies |
| GET | /api/companies/search?name={name} |
Search companies by name |
| PUT | /api/companies/{id} |
Update company |
| PATCH | /api/companies/{id}/deactivate |
Deactivate company |
| PATCH | /api/companies/{id}/activate |
Activate company |
| DELETE | /api/companies/{id} |
Delete company |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/companies/{companyId}/employees |
Create a new employee |
| GET | /api/companies/{companyId}/employees/{id} |
Get employee by ID |
| GET | /api/companies/{companyId}/employees |
Get all employees |
| GET | /api/companies/{companyId}/employees/active |
Get active employees |
| GET | /api/companies/{companyId}/employees/type/{type} |
Get employees by type |
| GET | /api/companies/{companyId}/employees/department/{dept} |
Get employees by department |
| GET | /api/companies/{companyId}/employees/search?name={name} |
Search employees |
| PUT | /api/companies/{companyId}/employees/{id} |
Update employee |
| PATCH | /api/companies/{companyId}/employees/{id}/terminate |
Terminate employee |
| PATCH | /api/companies/{companyId}/employees/{id}/reactivate |
Reactivate employee |
| DELETE | /api/companies/{companyId}/employees/{id} |
Delete employee |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/companies/{companyId}/payrolls |
Create a new payroll |
| POST | /api/companies/{companyId}/payrolls/{id}/generate-items |
Generate payroll items |
| GET | /api/companies/{companyId}/payrolls/{id} |
Get payroll by ID |
| GET | /api/companies/{companyId}/payrolls |
Get all payrolls |
| GET | /api/companies/{companyId}/payrolls/date-range |
Get payrolls by date range |
| POST | /api/companies/{companyId}/payrolls/{id}/process |
Process payroll |
| DELETE | /api/companies/{companyId}/payrolls/{id} |
Delete draft payroll |
| Method | Endpoint | Description |
|---|---|---|
| PUT | /api/payroll-items/{id} |
Update payroll item |
| GET | /api/payroll-items/employee/{employeeId} |
Get payroll items by employee |
curl -X POST http://localhost:8080/api/companies \
-u admin:admin123 \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Corporation",
"ein": "12-3456789",
"address": "123 Main Street",
"city": "San Francisco",
"state": "CA",
"zipCode": "94105",
"email": "[email protected]",
"phone": "4155551234"
}'curl -X POST http://localhost:8080/api/companies/1/employees \
-u admin:admin123 \
-H "Content-Type: application/json" \
-d '{
"firstName": "John",
"lastName": "Doe",
"ssn": "123-45-6789",
"email": "[email protected]",
"phone": "4155555678",
"address": "456 Oak Avenue",
"city": "San Francisco",
"state": "CA",
"zipCode": "94102",
"dateOfBirth": "1990-05-15",
"hireDate": "2024-01-01",
"employmentType": "FULL_TIME",
"jobTitle": "Software Engineer",
"department": "Engineering",
"payFrequency": "BI_WEEKLY",
"salary": 120000,
"federalAllowances": 2,
"stateAllowances": 2,
"additionalFederalWithholding": 0,
"additionalStateWithholding": 0
}'curl -X POST http://localhost:8080/api/companies/1/payrolls \
-u admin:admin123 \
-H "Content-Type: application/json" \
-d '{
"periodStartDate": "2024-01-01",
"periodEndDate": "2024-01-15",
"payDate": "2024-01-19",
"notes": "First payroll of 2024"
}'curl -X POST http://localhost:8080/api/companies/1/payrolls/1/generate-items \
-u admin:admin123curl -X PUT http://localhost:8080/api/payroll-items/1 \
-u admin:admin123 \
-H "Content-Type: application/json" \
-d '{
"bonus": 1000,
"healthInsurance": 200,
"retirement401k": 500
}'curl -X POST 'http://localhost:8080/api/companies/1/payrolls/1/process?processedBy=admin' \
-u admin:admin123- Uses 2024 federal tax brackets for single filers
- Supports standard deduction ($13,850 for 2024)
- Accounts for federal allowances
- Supports additional withholding
- Rate: 6.2%
- Wage base limit: $160,200 (2024)
- Automatically stops withholding when limit is reached
- Regular rate: 1.45%
- Additional Medicare tax: 0.9% on earnings over $200,000
- No wage base limit
- Configurable state-specific rates
- Pre-configured rates for major states (CA, NY, TX, FL, etc.)
- Supports state allowances
- Supports additional withholding
- Basic information (name, EIN, address)
- Contact details
- Active/inactive status
- One-to-many relationship with employees and payrolls
- Personal information (name, SSN, contact)
- Employment details (hire date, job title, department)
- Compensation (salary, hourly rate, pay frequency)
- Tax withholding preferences
- One-to-many relationship with payroll items
- Pay period dates
- Payment date
- Status tracking
- Totals (gross pay, net pay, taxes, deductions)
- Processing information
- One-to-many relationship with payroll items
- Individual employee payment record
- Hours worked (regular and overtime)
- Additional compensation (bonus, commission)
- Tax withholdings
- Deductions
- Year-to-date tracking
- Always use the termination endpoint instead of deleting employees to maintain payroll history
- Generate payroll items immediately after creating a payroll to see calculated amounts
- Review payroll items before processing to ensure accuracy
- Process payrolls on or before the pay date to ensure timely payments
- Track year-to-date totals for tax reporting and compliance
- Use appropriate pay frequencies that match your company's payroll schedule
- Update tax allowances when employees submit new W-4 forms
- Change default credentials in production
- Use HTTPS in production environments
- Implement proper authentication (JWT or OAuth2) for production
- Secure sensitive data (SSN, salary information)
- Implement role-based access control (RBAC)
- Regular security audits and updates
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
For issues, questions, or contributions, please open an issue in the GitHub repository.
Future enhancements:
- Direct deposit integration
- W-2 form generation
- 1099 form generation for contractors
- Benefits management
- Time tracking integration
- Multi-currency support
- Advanced reporting and analytics
- Mobile application
- Email notifications
- Audit trail and compliance reporting
Built with Java and Spring Boot | Version 1.0.0