{"id":15043108,"url":"https://github.com/mostafacs/ecommerce-microservices-spring-reactive-webflux","last_synced_at":"2025-04-09T13:06:26.153Z","repository":{"id":36537893,"uuid":"187557395","full_name":"mostafacs/ecommerce-microservices-spring-reactive-webflux","owner":"mostafacs","description":"E-commerce demo with spring reactive webflux and spring cloud microservice","archived":false,"fork":false,"pushed_at":"2023-07-08T21:09:32.000Z","size":109,"stargazers_count":201,"open_issues_count":4,"forks_count":101,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-02T11:05:55.416Z","etag":null,"topics":["docker","docker-compose","flyway","java","java-8","maven","microservices","microservices-architecture","postgresql","r2dbc","r2dbc-postgresql","reactive-streams","spring-boot","spring-cloud","spring-data-r2dbc","spring-security","spring-webflux"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mostafacs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-20T02:51:43.000Z","updated_at":"2025-03-24T15:19:51.000Z","dependencies_parsed_at":"2024-12-26T22:31:34.382Z","dependency_job_id":null,"html_url":"https://github.com/mostafacs/ecommerce-microservices-spring-reactive-webflux","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafacs%2Fecommerce-microservices-spring-reactive-webflux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafacs%2Fecommerce-microservices-spring-reactive-webflux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafacs%2Fecommerce-microservices-spring-reactive-webflux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostafacs%2Fecommerce-microservices-spring-reactive-webflux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mostafacs","download_url":"https://codeload.github.com/mostafacs/ecommerce-microservices-spring-reactive-webflux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045231,"owners_count":21038553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","flyway","java","java-8","maven","microservices","microservices-architecture","postgresql","r2dbc","r2dbc-postgresql","reactive-streams","spring-boot","spring-cloud","spring-data-r2dbc","spring-security","spring-webflux"],"created_at":"2024-09-24T20:48:35.124Z","updated_at":"2025-04-09T13:06:26.128Z","avatar_url":"https://github.com/mostafacs.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ecommerce Microservices Architecture\n\n**A complete ecommerce demo\nImplement based on [Microservice Architecture Pattern](http://martinfowler.com/microservices/) using Spring Boot, Spring Cloud, Spring WebFlux, Postgresdb and Docker.**\n\n\n## Abstract\nIn this project I didn't built independent microservices But i implemented microservices share the same database Why?\nBecause I want to use database tools like `ACID transactions, joins, bulk files imports, ...`\ninstead of network overhead for interprocess communication between microservices.\nI worked in a large project implemented based on microservices architecture we have a set of independent services and \nI used [Spring Cloud Open Feign](https://spring.io/projects/spring-cloud-openfeign) \nfor inter-process communication (Which uses client side load balancer ribbon) \n\n\nI'm planning to implement another version from project with independent microservices and communicate via feign.\n\nI have split services into two types system and logical services.\n\n## Features\n\nSecured, Authorized and Paginated endpoints.\n\n## Functional services\n\n### Authentication Service\nAuthorization Server for all other services which grants [OAuth2 tokens](https://tools.ietf.org/html/rfc6749) for the backend resource services.\nAll other secured services must set jwk uri for endpoint implemented on this service.\n```spring:\n   security:\n     oauth2:\n       resourceserver:\n         jwt:\n           jwk-set-uri: ${JWKS_URL}\n```\nEndpoints\n\nMethod\t| Path\t| Description\t| User authenticated\t\n------------- | ------------------------- | ------------- |:-------------:|\nGET\t| /.well-known/jwks\t| System endpoint to get JSON Web Key Set (JWKS) is a set of keys containing the public keys that should be used to verify JWT token\t|  \nPOST\t| /user/merchant\t| Register new merchant account (with merchant role)\t|  \nPOST\t| /user/client\t| Register new client account\t(with client role)|   | \nGET\t| /user\t| Get current login user information | × \n\n### Product Service\nManage products information and inventory\nEndpoints\n\nMethod\t| Path\t| Description\t| User authenticated\t| Role\n------------- | ------------------------- | ------------- |:-------------:| :-------------:|\nGET\t| /list?page={page}\u0026pageSize={pageSize}\t| Get all products\t|  x | any |\nGET\t| /list/merchant?page={page}\u0026pageSize={pageSize}\t\t| Get products created by merchant\t|  x | merchant,admin |\nPOST| /save\t| Create new product| x  | merchant |\nPUT\t| /save\t| Update existing product| x  | merchant |\nGET\t| /list/available?page={page}\u0026pageSize={pageSize}\t\t| Get available products with inventory \u003e 0 | × | any\nGET\t| /list/not-available?page={page}\u0026pageSize={pageSize}\t\t| Get available products with inventory = 0 | × | any\n\n### Order Service\nManage products information and inventory\nEndpoints\n\nMethod\t| Path\t| Description\t| User authenticated\t| Role\n------------- | ------------------------- | ------------- |:-------------:| :-------------:|\nGET\t| /list/user?page={page}\u0026pageSize={pageSize}\t\t| Get login user orders\t|  x | any |\nGET\t| /{orderId}\t| Get order by id\t|  x | any |\nPOST| /save\t| Create new order| x  | client |\nPUT\t| /save\t| Update existing order| x  | client |\n\n\n##  System Services\nCore service to implement Netflix OSS design architecture and Services token security \n\n### Config Service\n  Provides configuration for all other services (centralize configuration for all services).   \u003cbr\u003e\nDetails: [Spring Cloud Config](http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html)\n\n### Discovery Service\nIt allows automatic detection of network locations for service instances, which could have dynamically assigned addresses because of auto-scaling, \nfailures and upgrades (Every service register in this service after running).   \u003cbr\u003e\nDetails: [Spring Cloud Netflix](https://spring.io/projects/spring-cloud-netflix) \u003cbr\u003e\nEureka server url: http://localhost:2222/\n\n\n### Gateway Service\n\nProvide a proxy (routing) and client side load balancing via ribbon\nYou can deploy multiple services for the same service and gateway will load balancing between them ( Simple scalability )\nDetails: [Spring Cloud Gateway](https://spring.io/projects/spring-cloud-gateway)\n\n### Migration Service\nMigrations service handle changes on database tables using [flyway](https://flywaydb.org/) \u003cbr\u003e\nTo apply change on database please create file in this folder `ecommerce-microservices/storage/migration/src/main/resources/flyway/migrations`\nin this structure  `*__*.sql` then apply this command\n\n```\ncd ecommerce-microservices/storage/migration # change it to your path\nmvn clean package\ndocker-compose build\ndocker-compose up migration\n```\n\n### Monitoring\nNot completed require implement turbine service and any broker service (rabbitmq) But you can access \nstart page from http://localhost:8000/hystrix\n\n# Run Project\nInstall [maven](https://maven.apache.org/) and [docker](https://docs.docker.com/compose/)  \u003cbr\u003e\n``` \nmvn clean install \ndocker-compse build\ndocker-compse up\n\n# on the first run or after update sql migration on migration service\ndocker-compose up migration\n```\n\nProbably you got issues because docker caching refresh docker images by:\n```\ndocker rm $(docker ps -a -q) -f\ndocker volume prune\n```\n\n# Endpoints Documentations\n[Endpoints Docs](/endpoints.md)\n\n\n## Contributions are welcome!\ngreatly appreciate your help. Feel free to suggest and implement improvements.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostafacs%2Fecommerce-microservices-spring-reactive-webflux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmostafacs%2Fecommerce-microservices-spring-reactive-webflux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostafacs%2Fecommerce-microservices-spring-reactive-webflux/lists"}