vietnam-devs / coolstore-microservices

A full-stack .NET microservices build on Dapr and Tye
https://vietnam-devs.github.io/coolstore-microservices
MIT License
2.48k stars 579 forks source link
aks clean-architecture cloud-native dapr ddd ddd-example docker dotnet-core grpc kubernetes microservices microservices-architecture postgresql reactjs redis rest-api service-mesh tye typescript

CoolStore Web Application - :ferris_wheel: Modern Application on Dapr and Tye :sailboat:

Travis (.org) Gitpod ready-to-code Price

CoolStore Website is a containerised microservices application consisting of services based on .NET Core running on Dapr. It demonstrates how to wire up small microservices into a larger application using microservice architectural principals.

This repository based on some of the old libraries. So be careful if you use it in your production environment!!!

We are working on practical-clean-ddd for the new version of building the .NET apps with domain-driven design, clean architecture with Docker, Kubernetes, Tye, and Dapr in a practical way 👍

Read documentation for more information.

The business domain is inspired from CoolStore project by JBoss Demo Central and Red Hat Demo Central.

Check out my medium, or my dev.to or say hi on Twitter!

Table of contents

Dapr Building Blocks

Name Usecase Apps Participants
Service-to-service invocation - User clicks to the detail product
- Populate product information for shopping cart items
- Order gets detail information of buyer
productcatalogapp, inventoryapp, shoppingcartapp, identityapp
State management Items in the shopping cart shoppingcartapp
Publish and subscribe User clicks checkout button, and the checkout process happens. It triggers the pub/sub flow in the system shoppingcartapp, saleapp, identityapp
Resource bindings Every 30 seconds and 1 minutes the validation process happens. It will change the status of order from Received to Process and Complete via Cron binding productcatalogapp, inventoryapp
Observability All apps in the application are injected by daprd so that it's tracked and observed by dapr identityapp, webapigatewayapp, inventoryapp, productcatalogapp, shoppingcartapp, saleapp, web
Secrets Bind with local secret file to hide password of redis inventoryapp, productcatalogapp, shoppingcartapp, saleapp
Actors N/A N/A

Screenshots

Home page

home-page

Shopping Cart page

cart-page

Order page

order-page

Try it

Make sure you have dapr and tye installed on your machine!

Only wanna see wth is it?

$ tye run

Go to http://localhost:8000, and you're able to access to several endpoints whenevever it's ready as below:

Wanna go deeply to see how can we built it!

  1. Start core components
$ tye run tye.slim.yaml
  1. Start dapr apps locally via dapr cli
$ dapr run --app-port 5001 --app-id identityapp dotnet run -- -p src\Services\Identity\IdentityService\IdentityService.csproj
$ dapr run --app-port 5002 --app-id inventoryapp dotnet run -- -p src\Services\Inventory\InventoryService.Api\InventoryService.Api.csproj
$ dapr run --app-port 5003 --app-id productcatalogapp dotnet run -- -p src\Services\ProductCatalog\ProductCatalogService.Api\ProductCatalogService.Api.csproj
$ dapr run --app-port 5004 --app-id shoppingcartapp dotnet run -- -p src\Services\ShoppingCart\ShoppingCartService.Api\ShoppingCartService.Api.csproj

Now, you can start to develop, debug or explore more about dapr with tye via Coolstore Apps.

Enable vm.max_map_count for ElasticSearch via run sysctl -w vm.max_map_count=262144

OS, SDK, library, tooling and prerequisites

Infrastructure

Back-end

Front-end

µService development

Guidance for developing µService can be found at Clean Domain-Driven Design in 10 minutes

µService Screenshot

Open API

OpenAPI Screenshot

https://documenter.getpostman.com/view/4847807/SVmvUeZv?version=latest#9f5ed7e4-e855-46e5-a42d-64edb31bc1cb

CI/CD

Lift and Shift

Debug and Tracing Apps

Then, you can find the exception happend in code via Kibana dashboard with settings above. Grab the TraceId, then paste it to Zipkin dashboard, then you can see the tracing of this request as the following picture

Public presentation

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :p

Contributors ✨

Thanks goes to these wonderful people (emoji key)


Thang Chung

💻 💬 📖 👀 🚇 🚧


Phuong Le

💻 📦 🚇


Phi Huynh

🤔 🚇


Thinh Nguyen

💻 🚧


Stuart Leeks

📖

Licence

Code released under the MIT license.