![Logo](/screenshots/img.png)
Web App for Product and Customer Management
Explore the docs »
View Demo (Under Construction)
·
Report Bug
·
Request Feature
Note This Project is still under construction and continuous improvement, nothing is final.
Table of Contents
This Project was made as a synthesis for the Microservices Module during my studies.
Contrary to the Monolithic Architecture, Microservices allows us to build Scalable and well Maintainable Software.
Please find below the Technologies used for this Project.
Later the Microservices were secured using Keycloak v20.0.3
This Project is composed of 5 Microservices + The Frontend :
- Gateway-Service
- Discovery-Service
- Customer-Service
- Inventory-Service
- Billing-Service
- Frontend
Screenshots from the Web Application :
At startup the Backend will generate 4 customers, 40 Products and bills for each customer that have been populated with the given products for demonstration purposes, so no need to access the Database to add or modify anything.
The Frontend was made with Angular. NodeJS and Angular installation is needed as well as Keycloak for Angular.
npm install keycloak-angular keycloak-js
Keycloak on the other hand, was deployed on a docker container and port bound to the Host Machine at port 8080. Then I've configured it with a New Realm named pm-realm and a new client pm-client
docker run -p 8080:8080 \
-e KEYCLOAK_ADMIN=admin \
-e KEYCLOAK_ADMIN_PASSWORD=admin \
quay.io/keycloak/keycloak:20.0.3 start-dev
The KEYCLOAK_ADMIN and KEYCLOAK_ADMIN_PASSWORD are Keycloak native parameters for the admin console, they can be changed later.
As per the users, 3 were made, one Admin and two Users. Admin has access to all the Data on the application, as for users, only limited access is given. This difference of authorization can be seen on the backend, in the CustomerController Class as an example, as per picture below :
Code Snippet example of the authorization :
@PostMapping("/customers/addCustomer")
@PreAuthorize("hasAuthority('Admin')")
public Customer addCustomer(@RequestBody Customer customer) throws CustomerException {
return customerService.addCustomer(customer);
}
Only Admins have the possibility to add a customer, as can be seen with annotation @PreAuthorize("hasAuthority('Admin')").
On the other hand, a simple user can only check the customers list :
@GetMapping("/customers")
@PreAuthorize("hasAuthority('User')")
public List<Customer> getCustomerList() {
return customerService.listCustomers();
}
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Hamza Ouggadi - [email protected]
Project Link: https://github.com/HamzaOuggadi/ProductManagement-synthese-microservice