Skip to content

SirNoob97/OnlineStore

Repository files navigation

Online Store

This project consists of the REST api for an online store using microservices architecture.

My goal whit this project is to use all knowledge that i have acquired over the course of 8 months in a self-taught way to create a rest-full amateur application for an online store.

app-diagram

Microservices

  • Product-Service microservice in charge of products management. Commands and Endpoints
  • Auth-Service microservice in charge of user authentication and authorization, as well as acting as the application gateway. Commands and Endpoints
  • Shopping-Service microservice in charge of invoice management, to generate invoices it is necessary for this microservice to make requests to products-services, so it is also a client. Commands and Endpoints

These will obtain their configuration from this repository through a centralized configuration service that will use the Spring Cloud Config Server dependency.

Eureka dependencies will be used for the discovery of all services.

Hystrix's will be used for monitoring thaks to Actuator and Admin Starter, which will provide the information generated by Actuator in a separate and more readable endpoint.

Cloud Gateway to have a single acces endpoint.

Spring Security and JWT for the users authentication and authorization.

Prerequisites

Gettin Started

Spring-boot Maven Plugin

To run config-service and registration-service, you just need to use this command:

mvn clean compile spring-boot:run

The other microservices have their own README file that contains the commands to run the microservice using the spring-boot maven plugin.

Docker

To run the application with Docker(docker-compose), use the Makefile, this file will compile and package the jar files that will be used to build the images.

make run

If you use this method you should use the respective ip of the microservice.

  • PostgreSQL: 192.168.0.21:5432
  • Config-Service: 192.168.0.2:8081
  • Resgistry-Service: 192.168.0.3:8082
  • Auth-Service: localhost:8090 (Gateway)
  • Product-Service: 192.168.0.12:8091
  • Shopping-Service: 192.168.0.13:8092

Ideally, only the auth-service ip should be set as it also acts as the application gateway (this is the reason why only this service exposes its port to one of my host). In this way, with all the services with fixed ip, I can test the application in a faster way for me and more friendly for my pc (without having to use the gateway to test the other services).

Database

Dependencies

TODO

  • Add security to each microservice.
  • Implement Customer-Service, auth-service client microservice and with which customers can add/edit more information to their account.
  • Decrease repeating code as much as possible.
  • Add Admin-Service.
  • Add Zipkin server.

Due to the performance required by the application, the admin-server and zipkin-server will be omitted from the application :c