Mono-repo cho hệ thống microservice gồm AuthService, APIGateway, FileService, TransactionService, FileManagement frontend, và Shared library.
AuthService: xác thực, user, role, permission, JWT, JWKS.APIGateway: reverse proxy entry point cho các API backend.FileService: upload file, lưu storage local, outbox, consume kết quả import.TransactionService: xử lý transaction, import CSV, outbox, consume file import event.FileManagement: frontend Vite/React.Shared: các base class, constants, messaging, result, pagination dùng chung.
Chạy theo thứ tự này để tránh lỗi dependency:
- RabbitMQ.
- SQL Server.
- AuthService.
- FileService.
- TransactionService.
- APIGateway.
- FileManagement frontend.
- AuthService:
http://localhost:5172 - FileService:
http://localhost:5222 - TransactionService:
http://localhost:5139 - APIGateway:
http://localhost:5201 - Frontend:
http://localhost:5173
- Người dùng đăng nhập qua AuthService hoặc qua
/api/auth/*trên APIGateway. - AuthService phát hành JWT và expose JWKS tại
/.well-known/jwks.json. - Frontend dùng JWT để gọi API qua APIGateway.
- APIGateway kiểm tra JWT rồi forward request sang service đích.
- FileService xử lý upload file và ghi dữ liệu cần thiết vào DB/queue.
- TransactionService nhận dữ liệu import và xử lý transaction/import flow.
- Hai service backend dùng RabbitMQ cho outbox/consumer để đồng bộ event giữa các service.
dotnet restore
dotnet run --project AuthService/AuthService/AuthService.csproj --launch-profile http
dotnet run --project FileService/FileService/FileService.csproj --launch-profile http
dotnet run --project TransactionService/TransactionService/TransactionService.csproj --launch-profile http
dotnet run --project APIGateway/APIGateway/APIGateway.csproj --launch-profile httpNếu chạy frontend:
cd FileManagement/FileManagement
npm install
npm run dev- Swagger đã được bật ở các service backend trong môi trường Development.
- Khi test local, nhớ cập nhật connection string, RabbitMQ credentials, và JWT/JWKS URL trong
appsettings.jsonhoặcappsettings.Development.json. - Local file storage hiện đang dùng
Storage/UploadstrongFileService.