Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/loiane/crud-angular-spring

πŸ–₯ CRUD Angular + Spring demonstrating Has-Many relationship, including tests for the back-end and front-end
https://github.com/loiane/crud-angular-spring

angular angular-material angularv16 java javascript spring spring-boot spring-mvc springboot springboot3 springframework

Last synced: about 1 month ago
JSON representation

πŸ–₯ CRUD Angular + Spring demonstrating Has-Many relationship, including tests for the back-end and front-end

Awesome Lists containing this project

README

        

# REST API with Spring Boot and Angular

![Build](https://github.com/loiane/crud-angular-spring/actions/workflows/build.yml/badge.svg?branch=main)

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 21
- Spring Boot 3 (Spring 6)
- Maven
- JPA + Hibernate
- MySQL
- JUnit 5 + Mockito (back-end tests)
- Angular v18
- Angular Material
- Karma + Jasmine (front-end tests)

## ⌨️ Editor / IDE

- Visual Studio Code
- Java Extensions [link](https://marketplace.visualstudio.com/items?itemName=loiane.java-spring-extension-pack)
- Angular Extensions [link](https://marketplace.visualstudio.com/items?itemName=loiane.angular-extension-pack)

## 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 17 Records as DTO (Data Transfer Object)
- βœ… Hibernate / Jakarta Validation
- βœ… Unit tests for all layers (repository, service, controller)
- βœ… Test coverage for tests
- βœ… Spring Docs - Swagger (https://springdoc.org/v2/)

### Not implemented (maybe in a future version)

- Security (Authorization and Authentication)
- Caching
- Data Compression
- Throttling e Rate-limiting
- Profiling the app
- Test Containers
- Docker Build

## Some functionalities available in the front end

- βœ… Angular Standalone components (Angular v16+)
- βœ… Angular Material components
- βœ… List of all courses with pagination
- βœ… Form to update/create courses with lessons (has-many - FormArray)
- βœ… View only screen
- βœ… TypedForms (Angular v14+)
- βœ… Presentational x Smart Components
- 🚧 Unit and Integration tests for components, services, pipes, guards

## Screenshots

Main Page with Pagination


Main Page

Form with One to Many (Course-Lessons)


Form Page

View Page with YouTube Player


View Page

## ❗️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.

### Executing the front-end

You need to have Node.js / NPM installed locally.

1. Install all the required dependencies:

```
npm install
```

2. 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
```