A full-stack e-commerce learning project with Vue.js frontend and .NET microservices backend.
YCode.eShop is a comprehensive e-commerce application built using modern web technologies. The project demonstrates a microservices architecture with separate services for different business domains, providing a practical example of building scalable e-commerce systems.
YCode.eShop/
├── frontend/ # Vue.js 3 SPA application
└── backend/ # .NET 8 microservices
├── Product.WebAPI # Product catalog management
├── User.WebAPI # User authentication and management
├── Cart.WebAPI # Shopping cart functionality
├── Order.WebAPI # Order processing and management
├── Payment.WebAPI # Payment integration (Alipay)
├── Common.Jwt # JWT authentication shared library
├── Common.RabbitMQ # Message queue integration
└── Common.Alipay # Alipay SDK integration
- Framework: Vue.js 3
- Build Tool: Vue CLI
- State Management: Pinia
- Routing: Vue Router 4
- UI Library: Element Plus
- HTTP Client: Axios
- Authentication: JWT (jwt-decode)
- Framework: .NET 8 / ASP.NET Core Web API
- Architecture: Microservices with Domain-Driven Design (DDD)
- Authentication: JWT Bearer
- Message Queue: RabbitMQ
- Payment: Alipay SDK
- Database: Entity Framework Core (SQL Server)
- API Documentation: Swagger/OpenAPI
- User registration with phone number and SMS verification
- User login with JWT token authentication
- User profile management
- Access control and login history tracking
- Product catalog with categories and types
- Product variants support
- Product search functionality
- Featured products display
- Add/remove items from cart
- Update item quantities
- Cart persistence
- Create orders from cart
- Order history and tracking
- Order status management
- Alipay payment integration
- Payment callback handling
- Payment status tracking
- Node.js 16+ and npm
- Vue CLI 5.0+
- .NET 8 SDK
- SQL Server
- RabbitMQ Server
- Alipay Developer Account (for payment integration)
- Aliyun SMS Account (for phone verification)
-
Clone the repository
git clone https://github.com/lyq-lin/YCode.eShop.git cd YCode.eShop/backend -
Configure Aliyun SMS
- Open
User.WebAPI/appsettings.json(orappsettings.Development.json) - Add your Aliyun SMS access credentials:
{ "SmsSettings": { "AccessKey": "your-access-key", "AccessKeySecret": "your-secret-key", "SignName": "your-sign-name", "TemplateCode": "your-template-code" } } - Open
-
Configure Alipay
- Open
Payment.WebAPI/appsettings.json(orappsettings.Development.json) - Add your Alipay application credentials:
{ "AlipaySettings": { "AppId": "your-app-id", "PrivateKey": "your-private-key", "PublicKey": "your-public-key", "ServerUrl": "https://openapi.alipay.com/gateway.do" } } - Open
-
Configure RabbitMQ
- Ensure RabbitMQ server is running
- Configure connection string in
appsettings.json:
{ "RabbitMQSettings": { "HostName": "localhost", "Port": 5672, "UserName": "guest", "Password": "guest" } } -
Configure Database Connections
- Update connection strings for each service in their respective
appsettings.json:
{ "ConnectionStrings": { "DefaultConnection": "Server=localhost;Database=YCodeShop;Trusted_Connection=True;TrustServerCertificate=True;" } } - Update connection strings for each service in their respective
-
Run Database Migrations
# Navigate to each Infrastructure project and run migrations cd Product.Infrastructure dotnet ef database update cd ../User.Infrastructure dotnet ef database update cd ../Cart.Infrastructure dotnet ef database update cd ../Order.Infrastructure dotnet ef database update
-
Start the Services
# Start each WebAPI project cd ../Product.WebAPI && dotnet run # In a new terminal: cd ../User.WebAPI && dotnet run # Repeat for Cart, Order, and Payment services
-
Navigate to frontend directory
cd ../frontend -
Install dependencies
npm install
-
Configure API Base URL
- Locate the API base URL configuration in the stores files (e.g.,
src/stores/useProduct.js) - Update the IP address to match your backend server
- Example: Change
http://43.143.170.48:8080to your server address
- Locate the API base URL configuration in the stores files (e.g.,
-
Run development server
npm run serve
The application will be available at
http://localhost:8080 -
Build for production
npm run build
Each microservice includes Swagger/OpenAPI documentation. Access the documentation at:
- Product API:
http://localhost:5000/swagger - User API:
http://localhost:5001/swagger - Cart API:
http://localhost:5002/swagger - Order API:
http://localhost:5003/swagger - Payment API:
http://localhost:5004/swagger
Note: Ports may vary based on your configuration.
frontend/
├── public/ # Static assets
├── src/
│ ├── assets/ # Images, logos, etc.
│ ├── components/ # Vue components
│ │ ├── CartCounter.vue
│ │ ├── FeaturedProduct.vue
│ │ ├── LogoButton.vue
│ │ ├── Nav.vue
│ │ ├── ProductList.vue
│ │ ├── Search.vue
│ │ └── UserButton.vue
│ ├── pages/ # Page components
│ │ ├── Cart/
│ │ ├── Home/
│ │ ├── Login/
│ │ ├── Order/
│ │ ├── OrderDetail/
│ │ ├── PaymentSuccess/
│ │ ├── ProductDetail/
│ │ ├── Profile/
│ │ └── Register/
│ ├── stores/ # Pinia stores
│ │ ├── useCart.js
│ │ ├── useCategory.js
│ │ ├── useOrder.js
│ │ ├── usePayment.js
│ │ ├── useProductList.js
│ │ └── useUser.js
│ ├── router/ # Vue Router configuration
│ ├── hook/ # Custom hooks
│ ├── App.vue # Root component
│ └── main.js # Application entry point
├── package.json
└── vue.config.js
Each microservice follows Domain-Driven Design (DDD) principles:
backend/
├── [Domain].WebAPI/ # API layer
│ ├── Controllers/ # REST API controllers
│ ├── Program.cs # Application entry point
│ └── Dockerfile
├── [Domain].Domain/ # Domain layer
│ ├── Entity/ # Domain entities
│ ├── I[Entity]Repository.cs # Repository interfaces
│ └── [Domain]DomainService.cs
└── [Domain].Infrastructure/ # Infrastructure layer
├── DbContexts/ # EF Core DbContext
├── Migrations/ # Database migrations
├── Configs/ # Entity configurations
└── [Entity]Repository.cs # Repository implementations
The project uses separate databases for each bounded context:
- ProductDB: Products, categories, product types, product variants
- UserDB: Users, user access failures, login history
- CartDB: Cart items
- OrderDB: Orders, order items
Seed data is provided in backend/SeedData.sql.
- JWT-based authentication with version tracking
- Phone number verification via SMS
- Access failure tracking for security
- API rate limiting (implementation recommended)
Each microservice includes a Dockerfile for containerized deployment:
# Build Docker images
docker build -t ycodeshop-product-api backend/Product.WebAPI
docker build -t ycodeshop-user-api backend/User.WebAPI
# ... etc.
# Run containers
docker run -p 5000:8080 ycodeshop-product-api
# ... etc.This is a learning project. Feel free to fork and experiment!
This project is for educational purposes only.
- Built with Vue.js and ASP.NET Core
- Inspired by modern e-commerce systems
- Thanks to the open-source community
Note: This is a learning project. For production use, additional security measures, error handling, and performance optimizations should be implemented.