loiane/crud-angular-spring
์๊ฐ
๐ฅ CRUD Angular + Spring demonstrating Has-Many relationship, including tests for the back-end and front-end
์น ๋ฐ ์ฑ ๊ฐ๋ฐ์ธก์ ๋ ์คํ ์ฆ๊ฐ
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- ๊ธฐ๋ก ์์ง ์ค
์๋ก ๊ฒน์น๋ ๊ธฐ๊ฐ์ ์์ฆ๊ฐ๋์ด๋ฉฐ ์ผ๋ณ ํฉ๊ณ๊ฐ ์๋๋๋ค. ์ธก์ ๊ฐ์ด ์์ผ๋ฉด ๋น์ ๋ก๋๋ค. ์คํ๋ ๊ด์ฌ๋๋ฅผ ๋ํ๋ด๋ฉฐ ํ์ง์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
README.md
OriginalREST API with Spring Boot and Angular
CRUD Angular + Spring demonstrating Has-Many relationship, with tests.
This API is to showcase, especially for beginners, what a basic CRUD API that's close to being Production-ready looks like.
๐ป Tecnologies
- Java 25
- Spring Boot 4 (Spring 7)
- Maven
- JPA + Hibernate
- MySQL
- JUnit 5 + Mockito (back-end tests)
- Testcontainers (back-end integration tests)
- Angular v22
- Angular Material
- Karma + Jasmine (front-end tests)
โจ๏ธ Editor / IDE
Some functionalities available in the API
- โ Java model class with validation
- โ JPA repository
- โ JPA Pagination
- โ MySQL database (you can use any database of your preference)
- โ Controller, Service, and Repository layers
- โ Has-Many relationships (Course-Lessons)
- โ Java Records as DTO (Data Transfer Object)
- โ Hibernate / Jakarta Validation, including custom validators
- โ Unique course name enforcement (service check + database constraint)
- โ Soft delete (deleted courses are marked inactive, not removed)
- โ Transactional service layer (Open Session in View disabled)
- โ Consistent error responses with RFC 7807 Problem Details
- โ Unit tests for all layers (repository, service, controller)
- โ Integration tests with Testcontainers (real MySQL in Docker)
- โ Test coverage reports with JaCoCo
- โ Spring Docs - Swagger UI (springdoc.org)
Not implemented (maybe in a future version)
- Security (Authorization and Authentication)
- Caching
- Data Compression
- Throttling e Rate-limiting
- Profiling the app
- Docker Build
Some functionalities available in the front end
- โ Angular Standalone components
- โ
Angular Signals (
signal,computed,httpResource) - โ Zoneless change detection (Angular v22 default)
- โ
Built-in control flow (
@if,@for) - โ
Lazy loading with
loadComponentroutes - โ Angular Material components
- โ List of all courses with pagination
- โ Form to update/create courses with lessons (has-many)
- โ View only screen
- โ
Signal Forms (
form,FormField- stable in Angular v22) - โ Presentational x Smart Components
- โ Unit and Integration tests for components, services, pipes, guards
Screenshots
Main Page with Pagination
Form with One to Many (Course-Lessons)
View Page with YouTube Player
โ๏ธExecuting the code locally
Executing the back-end
You need to have Java and Maven installed and configured locally.
Open the crud-spring project in your favorite IDE as a Maven project and execute it as Spring Boot application.
Once running, the API docs are available at http://localhost:8080/swagger-ui.html.
Using MySQL (dev profile)
To run against MySQL instead, start the database with Docker (also starts phpMyAdmin on port 8081):
cd crud-spring
docker compose up -d
Then run the app with the dev profile. The connection can be customized with the MYSQL_HOST, MYSQL_USER and MYSQL_PASSWORD environment variables (in the prod profile, the credentials are required). The dev profile preserves data between restarts; to seed a fresh database, run src/main/resources/schema.sql manually.
Back-end tests
cd crud-spring
./mvnw test
Unit tests run in-memory; the integration tests use Testcontainers and require Docker to be running.
Executing the front-end
You need to have Node.js / NPM installed locally.
- Install all the required dependencies:
npm install
- Execute the project:
npm run start
This command will run the Angular project with a proxy to the Java server, without requiring CORS.
Open your browser and access http://localhost:4200 (Angular default port).
Upgrading Angular
ng update
Then
ng update @angular/cli @angular/core @angular/cdk @angular/material @angular/youtube-player --force
๊ด๋ จ ํ๋ก์ ํธ ์ดํด๋ณด๊ธฐ
๋ถ๋ฌ์ค๋ ์คโฆ