Spring E-commerce Project is a simple microservice project with spring cloud and various other technologies
- Architecture Diagram
- Events Diagram
- Infrastructure Services
- Application Services
- Development
- Testing
- Java 22 spring boot 3.5
- Spring cloud eureka server
- Java 22 spring boot 3.5
- Spring cloud config server
- Encrypt a value using config server
curl <CONFIG_SERVICE_URL>/encrypt -s -d <VALUE>
- Encrypt a value using config server
- Spring actuator
- Refresh variables
curl -X POST <APPLICATION_SERVICE_URL>/actuator/refresh
- Refresh variables
- Java 22 spring boot 3.5
- Spring cloud gateway
- Spring cache
- Caffeine
- Central swagger for services
<GATEWAY_SERVICE_URL>/swagger
- Eureka dashboard through gateway
<GATEWAY_SERVICE_URL>/eureka-dashboard
- Jwt filter for authentication
- Java 22 spring boot 3.5
- Spring web
- Classical controllers
- Relational db
- Mysql
- Flyway migrations
- Specification pattern
- Spring cache
- Redis
- Event sourcing
- Kafka
- Retry and dlt topics
- Circuit breaker pattern
- Resilience4j
- Structured logging
- Logback
- Elk stack
- Authentication
- Keycloak
- Helpers
- Feign client
- Tests
- Unit tests
- Without starting spring container
- Integration tests
- H2 db
- Embedded kafka
- Coverage
- Jacoco
mvn clean verify
,mvn jacoco:report
- Jacoco
- Unit tests
- Java 22 spring boot 3.5
- Spring webflux
- Handlers
- Functional api
- No-sql db
- Mongodb
- Event sourcing
- Kafka
- Retry and dlt topics
- Circuit breaker pattern
- Resilience4j
- Structured logging
- Logback
- Elk stack
- Authentication
- Keycloak
- Tests
- Unit tests
- Without starting spring container
- Integration tests
- Test containers mongo
- Embedded kafka
- Coverage
- Jacoco
mvn clean verify
,mvn jacoco:report
- Jacoco
- Unit tests
- Java 22 spring boot 3.5
- Kotlin 2.0.0
- Kotlin for pojo classes
- Spring web
- Classical controllers
- No-sql db
- Elasticsearch
- Event sourcing
- Kafka
- Retry and dlt topics
- Circuit breaker pattern
- Resilience4j
- Structured logging
- Logback
- Elk stack
- Authentication
- Keycloak
- Helpers
- Feign client
- Tests
- Unit tests
- Without starting spring container
- Integration tests
- Test containers elasticsearch
- Coverage
- Jacoco
mvn clean verify
,mvn jacoco:report
- Jacoco
- Unit tests
mvn spring-boot:run
You need to run many infrastructure services before starting the actual applications, to have a better dev experience I suggest running infrastructure related applications on a cloud vps.
- Preliminary steps
- Have
Java >22
,Maven >3
andKotlin >2
on your path - Move to project's root folder
- Commands are adjusted for project's root
- Have
- Run infrastructure in docker
- Check Infrastructure Setup for more details
- Create internal network
docker network create sep-bridge-network
- Run containers
docker compose -f sep-infra/docker-compose-mysql.yaml up -d
docker compose -f sep-infra/docker-compose-mongo.yaml up -d
docker compose -f sep-infra/docker-compose-redis.yaml up -d
docker compose -f sep-infra/docker-compose-elk.yaml up -d
docker compose -f sep-infra/docker-compose-kafka.yaml up -d
docker compose -f sep-infra/docker-compose-keycloak.yaml up -d
- Populate config files under
/sep-config
- Global config
<KEYCLOAK-REALM-PUBLIC-KEY> <KEYCLOAK-HOST> <REDIS-HOST> <KAFKA-HOST> <LOGSTASH-HOST> <ELASTIC-HOST>
- Product service
<MYSQL-HOST> <MYSQL-PASSWORD> <KEYCLOAK-CLIENT-SECRET>
- Payment service
<MONGO-HOST> <MONGO-PASSWORD> <KEYCLOAK-CLIENT-SECRET>
- Search service
<KEYCLOAK-CLIENT-SECRET>
- Init a local git repo for config files under
/sep-config
- Config service uses git repo fo dynamic config values
git -C sep-config init
- Global config
- Run Spring cloud services
mvn -f sep-discovery-service/pom.xml spring-boot:run
mvn -f sep-config-service/pom.xml spring-boot:run
mvn -f sep-gateway-service/pom.xml spring-boot:run
(optional)- eureka-dashboard from gateway http://localhost:8093/eureka-dashboard
- Swagger ui for all services within gateway http://localhost:8093/swagger
- Run application services for development with your ide
- Go to service directory
mvn clean verify
mvn jacoco:report