-
-
Notifications
You must be signed in to change notification settings - Fork 0
Development
Truong Le Vinh Phuc edited this page Jun 21, 2025
·
1 revision
This page provides guidelines and information for developers working on the Cloud-Native E-commerce Platform.
- .NET Core SDK 8.0+
- Docker Desktop
- Node.js 18+ (for frontend)
- Git
- IDE (Visual Studio 2022 or VS Code recommended)
-
Clone the repository
git clone https://github.com/sloweyyy/cloud-native-ecommerce-platform.git cd cloud-native-ecommerce-platform
-
Start infrastructure services
docker-compose up -d mongodb redis postgres sqlserver rabbitmq elasticsearch kibana
-
Build the solution
dotnet build Ecommerce.sln
-
Run individual services
Each service can be run independently. Open separate terminal windows for each service:
# Catalog API cd Services/Catalog/Catalog.API dotnet run # Basket API cd Services/Basket/Basket.API dotnet run # Discount API cd Services/Discount/Discount.API dotnet run # Ordering API cd Services/Ordering/Ordering.API dotnet run # API Gateway cd ApiGateways/Ocelot.ApiGateway dotnet run
-
Run the frontend
cd client npm install --legacy-peer-deps npm start
The project follows a clean architecture pattern with microservices:
├── src/
│ ├── ApiGateways/ # API gateway layer
│ ├── Infrastructure/ # Shared infrastructure components
│ ├── Services/ # Microservices implementations
│ │ ├── Basket/ # Shopping cart service
│ │ ├── Catalog/ # Product catalog service
│ │ ├── Discount/ # Discount management service
│ │ └── Ordering/ # Order processing service
│ ├── client/ # Angular frontend application
│ └── images/ # Documentation images
├── docker-compose.yml # Docker Compose configuration
├── Deployments/ # Kubernetes and Helm deployment files
└── PostmanCollection/ # API testing collections
Each microservice follows Clean Architecture with these layers:
- API Layer: Controllers and external interfaces
- Application Layer: Business workflows and application logic
- Core/Domain Layer: Business entities and rules
- Infrastructure Layer: Technical implementations and external concerns
- Follow Microsoft's C# Coding Conventions
- Use meaningful variable and method names
- Write XML documentation for public APIs
- Follow SOLID principles
- Use dependency injection appropriately
- Follow Angular Style Guide
- Use TypeScript strictly
- Write unit tests for components and services
- Follow reactive patterns with RxJS
- Clean Architecture: Maintain separation of concerns
- SOLID Principles: Write maintainable, extensible code
- DRY: Don't repeat yourself
- YAGNI: You ain't gonna need it
- Testing: Write tests for new functionality
# Run all tests
dotnet test
# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"
# Frontend tests
cd client
npm test
Integration tests are located in each service's test project.
# Run integration tests
dotnet test --filter "Category=Integration"
Use the Postman collections in the PostmanCollection/
directory for testing APIs.
-
Visual Studio:
- Open
Ecommerce.sln
- Set startup project to the service you want to debug
- Press F5 to start debugging
- Open
-
VS Code:
- Open the service folder
- Use the
.vscode/launch.json
configuration - Press F5 to start debugging
-
Angular DevTools:
- Install the Angular DevTools browser extension
- Use Chrome DevTools for debugging
-
VS Code:
- Use the Debugger for Chrome extension
- Configure
launch.json
for Angular debugging
# Build all images
docker-compose build
# Build specific service
docker-compose build catalog.api
# Run all services
docker-compose up -d
# Run specific service
docker-compose up -d catalog.api
# View logs
docker-compose logs -f
- Define the request/response models in the Application layer
- Create a command/query in the Application layer
- Implement the handler in the Application layer
- Add the controller endpoint in the API layer
- Update the API Gateway configuration if needed
- Define the entity in the Core layer
- Add repository interface in the Core layer
- Implement repository in the Infrastructure layer
- Configure entity mapping in the Infrastructure layer
- Create DTOs and mappers in the Application layer
- Add API endpoints in the API layer
- Define the event in the EventBus.Messages project
- Implement the publisher in the source service
- Implement the consumer in the target service
- Register the consumer in the target service's Program.cs
We follow the GitFlow branching model:
-
main
: Production-ready code -
develop
: Latest development changes -
feature/*
: New features -
bugfix/*
: Bug fixes -
release/*
: Release preparation -
hotfix/*
: Production hotfixes
- Create a branch from
develop
for your feature/fix - Make your changes following the coding standards
- Write tests for your changes
- Update documentation as needed
- Submit a pull request to
develop
- Ensure CI passes
- Get approval from at least one reviewer
Our GitHub Actions workflows automate:
- Building the solution
- Running tests
- Linting code
- Building Docker images
- Validating Kubernetes manifests and Helm charts
See .github/workflows/
for the CI configuration.