A complete full-stack application built with Spring Boot, Angular 17, H2 Database, and JasperReports for employee and department management.
├── server/ # Spring Boot REST API
│ ├── src/main/java/com/assessment/hrapp/
│ │ ├── controller/ # REST Controllers
│ │ ├── service/ # Business Logic Layer
│ │ ├── repository/ # Data Access Layer
│ │ ├── domain/ # JPA Entities
│ │ ├── dto/ # Data Transfer Objects
│ │ ├── mapper/ # Entity-DTO Mappers
│ │ ├── config/ # Configuration Classes
│ │ └── exception/ # Exception Handling
│ └── src/main/resources/
│ ├── static/ # Static HTML/CSS Cards
│ └── reports/ # JasperReports Templates
└── client/ # Angular 17 Frontend
├── src/app/
│ ├── components/ # UI Components
│ └── services/ # HTTP Services
└── proxy.conf.json # Development Proxy
- ✅ RESTful APIs with proper HTTP status codes
- ✅ H2 in-memory database with sample data
- ✅ JPA entities with relationships
- ✅ DTO pattern with validation
- ✅ Service layer with @Transactional support
- ✅ Global exception handling with @ControllerAdvice
- ✅ CORS configuration for Angular development
- ✅ JasperReports PDF generation (one page per department)
- ✅ Maven wrapper for reproducible builds
- ✅ Department search with employee listing
- ✅ Employee detail view with edit/delete functionality
- ✅ Responsive design with Bootstrap 5
- ✅ Form validation with user feedback
- ✅ State management with BehaviorSubject
- ✅ HTTP proxy configuration for API calls
- ✅ Static cards showcase page
- ✅ HTML/CSS cards page matching provided design
- ✅ Responsive layout with hover effects
- ✅ Available at both server and client locations
- Backend: Spring Boot 3.2.1, Java 17, Maven, H2 Database
- Frontend: Angular 17, Bootstrap 5, TypeScript
- Reports: JasperReports 6.20.6
- Testing: JUnit 5, MockMvc, Angular Testing Utilities
- Department: id (String), name, location, employees (OneToMany)
- Employee: id (String), name, email, position, salary (BigDecimal), department (ManyToOne)
- 4 Departments: Engineering, Marketing, HR, Finance
- 12 Employees across all departments
- Realistic salary ranges and positions
GET /api/departments # All departments
GET /api/departments/{deptId}/employees # Employees by department
POST /api/departments/{deptId}/employees # Add employee to department
DELETE /api/departments/{deptId}/employees/{empId} # Delete employeeGET /api/employees # All employees
GET /api/employees/{id} # Employee by IDGET /api/reports/department-employees-map # JSON map of dept->employees
GET /api/reports/employees-by-department.pdf # PDF report
GET /api/reports/test-rollback # Transaction rollback demoGET /cards.html # Static cards pageDetected Environment:
- Java: OpenJDK 17.0.16 (Microsoft Build)
- Node.js: v22.16.0
- npm: 10.9.2
- Maven: 3.9.6 (via wrapper)
- Angular CLI: 17.3.17 (via npx)
- OS: Windows 11
- Windows: PowerShell 5.0+ (included in Windows 10/11)
- macOS/Linux: Bash shell
- Node.js 18+ and npm (for Angular) - Download here
- Java 17 - Download here or use scripts to auto-download
- Open project in VS Code
- Press
Ctrl+Shift+P→ "Tasks: Run Task" → "Run All" - Wait for both servers to start automatically
- Browser opens to http://localhost:4200
# Simple version (recommended)
.\run-simple.ps1
# Advanced version with auto-download
.\run.ps1# Terminal 1 - Backend
cd server
.\mvnw.cmd spring-boot:run # Windows
./mvnw spring-boot:run # macOS/Linux
# Terminal 2 - Frontend
cd client
npm ci
npx ng serve --proxy-config proxy.conf.json --open# Run complete system verification
.\verify.ps1This script automatically tests:
- ✅ All API endpoints (departments, employees, reports)
- ✅ PDF report generation and size validation
- ✅ CRUD operations (create, read, delete)
- ✅ Transaction rollback functionality
- ✅ Static content serving
- ✅ Frontend accessibility
Once both servers are running, test these URLs:
Backend APIs:
- http://localhost:8080/api/departments
- http://localhost:8080/api/employees
- http://localhost:8080/api/departments/dept01/employees
- http://localhost:8080/api/reports/employees-by-department.pdf
- http://localhost:8080/cards.html
- http://localhost:8080/h2-console (JDBC:
jdbc:h2:mem:hrdb, User:sa)
Frontend App:
- http://localhost:4200 (Main application)
- http://localhost:4200/cards (Cards showcase)
# Test departments API
Invoke-RestMethod http://localhost:8080/api/departments
# Test employees API
Invoke-RestMethod http://localhost:8080/api/employees
# Create test employee
$employee = @{id="emp999"; name="Test"; email="test@test.com"; position="Tester"; salary=50000} | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:8080/api/departments/dept01/employees -Method POST -Body $employee -ContentType "application/json"
# Delete test employee
Invoke-RestMethod -Uri http://localhost:8080/api/departments/dept01/employees/emp999 -Method DELETEcd server
./mvnw test # Run all tests
./mvnw test -Dtest=EmployeeControllerTest # Run specific test class- Open http://localhost:4200
- Type
dept01in the search box and click "Search" - Verify employee table appears with 4 employees
- Click "View" on any employee to see details
- Click "Edit" to modify employee information
- Click "Delete" to remove an employee
- Navigate to "Cards Showcase" to see static cards
- Start both server (port 8080) and client (port 4200)
- Open http://localhost:4200
- Search for department
dept01 - View employee
emp001(John Doe) - Edit and save employee details
- Download PDF report from navigation
- Visit http://localhost:4200/cards for cards showcase
- H2 Console showing populated tables
- Department search page with results
- Employee detail page in view mode
- Employee detail page in edit mode
- PDF report downloaded and opened
- Static cards page in browser
- Angular app running on localhost:4200
- API responses in browser network tab
application.yaml: Database, JPA, and server settingspom.xml: Maven dependencies and build configurationproxy.conf.json: Angular development proxy settings
angular.json: Angular CLI configurationpackage.json: Node.js dependenciestsconfig.json: TypeScript compiler settings
-
Java not found / JAVA_HOME not set
# Option A: Install Java 17 from https://adoptium.net/temurin/releases/?version=17 # Option B: Use auto-download script .\run.ps1 # This will download portable JDK automatically
-
Port 8080 or 4200 already in use
# Kill processes using the ports Get-Process | Where-Object {$_.ProcessName -match "java|node"} | Stop-Process -Force # Or use netstat to find specific process netstat -ano | findstr :8080 taskkill /PID <PID> /F
-
Maven wrapper fails
# Ensure JAVA_HOME is set $env:JAVA_HOME = "C:\path\to\jdk-17" $env:PATH = "$env:JAVA_HOME\bin;$env:PATH" cd server .\mvnw.cmd --version
-
Angular CLI not found
# Use npx instead of global install cd client npx ng serve --proxy-config proxy.conf.json
-
CORS errors in browser
- Ensure Angular dev server uses proxy configuration
- Verify CORS configuration in Spring Boot
- Check that both servers are running
-
PDF download fails
- Check JasperReports template compilation
- Verify sample data is loaded in H2 database
- Ensure server has been running for at least 30 seconds
If scripts won't run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser- Use H2 console to inspect database state
- Check browser network tab for API call details
- Use Angular DevTools for component debugging
- Monitor server logs for transaction rollback tests
- Use
.\verify.ps1to test all functionality automatically
- H2 database runs in-memory for fast development
- JasperReports compiles templates at runtime
- Angular serves static assets through development proxy
- Bootstrap CSS loaded from node_modules for optimal caching
This implementation satisfies all requirements:
- ✅ Spring Boot 3.x with Java 17 and Maven
- ✅ H2 embedded database with sample data
- ✅ JPA entities with proper relationships
- ✅ DTO pattern with validation
- ✅ Service layer with transaction management
- ✅ REST APIs returning DTOs (not entities)
- ✅ JasperReports PDF with one page per department
- ✅ Angular 17 with Bootstrap 5
- ✅ Responsive UI with CRUD operations
- ✅ Static HTML/CSS cards page
- ✅ Comprehensive error handling
- ✅ Zero lint errors
- ✅ Working unit tests
- ✅ Complete documentation
For questions or issues:
- Check the troubleshooting section above
- Verify all commands run successfully
- Ensure prerequisites are installed correctly
- Review server and client logs for error details
Demo Ready! 🎉 Start with the department search page, try dept01, and explore the full functionality.