This repository contains a full-stack web application built with Angular and Spring Boot.
The project demonstrates the integration of an Angular frontend with a Spring Boot backend. It utilizes a unified Maven-based build process that orchestrates both frontend and backend compilation, making deployment and packaging straightforward.
- Framework: Spring Boot 3.2.3
- Language: Java 17
- Data Access: Spring Data JPA, Hibernate ORM
- Database: H2 Database (In-Memory for development/runtime)
- Object Mapping: MapStruct 1.5.5.Final
- Build Tool: Maven
- Framework: Angular 8 (Angular CLI 8.3.19)
- UI Components: Angular Material
- Language: TypeScript
- Package Manager: npm (Node.js v12.13.1)
/src: Contains the backend Java source code (Spring Boot application)./angular: Contains the frontend Angular source code.pom.xml: The root Maven build configuration that manages both backend dependencies and frontend build execution (viafrontend-maven-plugin).install-backend-deps.ps1: A PowerShell script to automatically install required backend development dependencies (JDK and Maven) on Windows.install-backend-deps.sh: A Bash script to automatically install required backend development dependencies (JDK and Maven) on macOS and Linux (Debian/Ubuntu, Fedora/RHEL).
You need the following installed on your system to run the application:
- Java 17 (or use the provided
install-backend-deps.ps1script) - Node.js (v12.13.1 recommended) and npm
- Maven (or use the provided
mvnwwrapper)
Windows Users: You can run .\install-backend-deps.ps1 as Administrator to automatically install the JDK and Maven.
macOS Users: You can run ./install-backend-deps.sh (do not use sudo) to automatically install the JDK and Maven via Homebrew.
Linux Users: You can run sudo ./install-backend-deps.sh to automatically install the JDK and Maven.
This project uses the frontend-maven-plugin to download Node/npm and build the Angular application during the Maven build process. You do not need to build the frontend separately for production packaging.
To build the complete application (both backend and frontend), run:
./mvnw clean installNote: On Windows, use mvnw.cmd clean install or simply mvn clean install if Maven is in your PATH.
Once built, you can run the application directly via Spring Boot. The Spring Boot application will serve the built Angular static files.
./mvnw spring-boot:runThe application will be available at http://localhost:8080.
For active development, it's recommended to run the frontend and backend servers separately to take advantage of Angular's live reload.
-
Start the Backend:
./mvnw spring-boot:run
The API will be available at
http://localhost:8080. -
Start the Frontend: Open a new terminal window and navigate to the
angulardirectory:cd angular npm install npm startThe Angular application will be available at
http://localhost:4200and will automatically proxy API requests tohttp://localhost:8080.
The project includes a Dockerfile and is configured with the dockerfile-maven-plugin. You can package the application into a Docker container.
To build the Docker image:
./mvnw dockerfile:build