# Microservice **Repository Path**: cplmlm/microservice ## Basic Information - **Project Name**: Microservice - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-08 - **Last Updated**: 2026-09-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Microservice Project A microservices architecture demonstration project based on .NET 8, including a shopping cart service, authentication center, and management dashboard. ## Project Overview Microservice is a complete microservices architecture demonstration system built with modern technology stacks to showcase best practices in microservices design. The project includes the following core services: - **Cart.API** - Shopping cart service providing CRUD operations for shopping carts - **IDS4.AuthCenter** - Authentication and authorization center based on IdentityServer4 - **Microservice.Web** - Frontend management dashboard application - **Microservice.AppHost** - Application host/gateway entry point ## Technology Stack - **Backend Framework**: .NET 8 / ASP.NET Core - **Database**: SQL Server (using Entity Framework Core) - **Caching**: Redis (distributed cache) - **Authentication**: IdentityServer4 - **Frontend Framework**: ASP.NET Core MVC + Bootstrap 5 - **Logging**: Serilog - **Containerization**: Docker ## Project Structure ``` ├── Cart.API/ # Shopping Cart API Service │ ├── Controllers/ # API Controllers │ ├── Data/ # Database context and migrations │ ├── Helper/ # Utility classes │ ├── Models/ # Data models │ └── Services/ # Business service layer │ ├── IDS4.AuthCenter/ # Authentication & Authorization Center │ ├── Controllers/ # Account controllers │ ├── Data/ # Database and migrations │ ├── Models/ # View models │ ├── Views/ # Login page views │ └── wwwroot/ # Static resources │ ├── Microservice.AppHost/ # Application Host │ └── Microservice.Web/ # Management Dashboard Frontend ├── Controllers/ # MVC Controllers ├── Helper/ # Service helper classes ├── Models/ # View models └── Views/ # Frontend views ``` ## Features ### Shopping Cart Service (Cart.API) - Retrieve cart contents - Add products to cart - Update product quantity in cart - Remove products from cart - Clear entire cart - Checkout and place order ### Authentication Service (IDS4.AuthCenter) - User login/logout - OAuth 2.0 / OpenID Connect protocol support - JWT token issuance - Multiple client support (MVC, Web API) ### Management Dashboard (Microservice.Web) - Product browsing and search - Cart management - Order viewing and payment - User dashboard ## Quick Start ### Prerequisites - .NET 8 SDK - SQL Server - Redis - Docker (optional) ### Configuration Configure database connection strings and Redis connections in each project's `appsettings.json`: ```json { "ConnectionStrings": { "DefaultConnection": "Server=localhost;Database=Microservice;User Id=sa;Password=YourPassword;TrustServerCertificate=True" }, "Redis": { "ConnectionString": "localhost:6379" } } ``` ### Running the Project 1. After cloning the project, execute in the solution root directory: ```bash dotnet restore dotnet build ``` 2. Start services as needed: ```bash # Start authentication center cd IDS4.AuthCenter dotnet run # Start shopping cart service cd Cart.API dotnet run # Start management dashboard cd Microservice.Web dotnet run ``` ### Docker Deployment The project includes Dockerfiles for containerized deployment: ```bash # Build images docker build -t microservice/web -f Microservice.Web/Dockerfile . docker build -t microservice/auth -f IDS4.AuthCenter/Dockerfile . ``` ## API Endpoints ### Shopping Cart API | Method | Path | Description | |--------|------|-------------| | GET | `/cart` | Retrieve cart contents | | POST | `/cart/add` | Add product to cart | | PUT | `/cart/update` | Update product quantity | | DELETE | `/cart/remove/{productId}` | Remove product from cart | | DELETE | `/cart/clear` | Clear entire cart | | POST | `/cart/checkout` | Checkout and place order | ## Architecture Overview The project follows a classic microservices architecture pattern: 1. **Authentication Service** - Centralized user authentication and authorization 2. **Business Services** - Independent microservices deployed separately, each providing dedicated business capabilities 3. **Gateway/Frontend** - Unified entry point routing requests to corresponding services Redis is used for distributed caching to enhance performance of cart operations, while database persistence ensures data reliability. ## License MIT License