Skip to content

Repository files navigation

CongoCart

CongoCart is a microservices-based e-commerce platform built with .NET 10. The project demonstrates a distributed architecture with multiple independent services, an API Gateway, and asynchronous communication via a message bus.

Project Structure

  • CongoCart.Web: The frontend web application (ASP.NET Core MVC).
  • CongoCart.GatewaySolution: API Gateway using Ocelot to route requests to backend services.
  • CongoCart.Services.AuthAPI: Handles user authentication, registration, and JWT token issuance.
  • CongoCart.Services.CouponAPI: Manages discount coupons.
  • CongoCart.Services.ProductAPI: Manages product catalog and images.
  • CongoCart.Services.ShoppingCartAPI: Handles shopping cart operations.
  • CongoCart.Services.OrderAPI: Manages order placement and processing.
  • CongoCart.Services.EmailAPI: Consumes messages from the service bus to send emails.
  • CongoCart.Services.RewardAPI: Manages rewards and loyalty points.
  • CongoCart.MessageBus: A shared library for message bus communication.

Tech Stack

  • Language: C# 14.0
  • Framework: .NET 10.0 (ASP.NET Core)
  • API Gateway: Ocelot
  • Database: SQL Server (LocalDB)
  • ORM: Entity Framework Core
  • Messaging: Azure Service Bus
  • Authentication: JWT Bearer, ASP.NET Core Identity
  • Other: AutoMapper, Newtonsoft.Json, Swashbuckle (Swagger)

Requirements

Setup & Run

1. Clone the repository

git clone <repository-url>
cd CongoCart

2. Update Configuration

Each service has an appsettings.json file. Ensure you update the following:

  • ConnectionStrings: Update DefaultConnection to point to your SQL Server instance.
  • ServiceBusConnectionString: Provide your Azure Service Bus connection string in CongoCart.Services.EmailAPI, CongoCart.Services.OrderAPI, etc.
  • JwtOptions: Update the Secret in AuthAPI and GatewaySolution.

3. Apply Migrations

For services using a database (Auth, Coupon, Product, Order, ShoppingCart, Email, Reward), run the following command in their respective directories:

dotnet ef database update

4. Run the application

You can run all projects using your IDE (like JetBrains Rider or Visual Studio) or via terminal.

To run the Web frontend:

cd CongoCart.Web
dotnet run

To run the Gateway:

cd CongoCart.GatewaySolution
dotnet run

To run a specific service:

cd CongoCart.Services.AuthAPI
dotnet run

Note: For the full system to work, all services, the gateway, and the web app must be running.

Scripts

  • dotnet restore: Restore dependencies.
  • dotnet build: Build the solution.
  • dotnet ef migrations add <Name>: Add a new EF migration.
  • dotnet ef database update: Update the database to the latest migration.

Environment Variables

While the project primarily uses appsettings.json, you can override settings using environment variables:

  • ConnectionStrings__DefaultConnection
  • ApiSettings__JwtOptions__Secret
  • ServiceBusConnectionString

Tests

TODO: Add unit and integration tests. No test projects currently exist in the solution.

License

TODO: Add license information.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages