{"id":26353547,"url":"https://github.com/khachatur/ecommerceapp","last_synced_at":"2026-05-20T09:05:51.278Z","repository":{"id":282248637,"uuid":"946881600","full_name":"khachatur/ECommerceApp","owner":"khachatur","description":"ECommerceApp is a full-stack web application built using .NET 6, demonstrating clean architecture principles.","archived":false,"fork":false,"pushed_at":"2025-03-13T14:27:59.000Z","size":916,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T15:30:52.261Z","etag":null,"topics":["clean-architecture","cqrs","csharp","dependency-injection","dotnet-core","entity-framework-core","jwt-authentication","restapi","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khachatur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-11T20:26:02.000Z","updated_at":"2025-03-13T14:28:02.000Z","dependencies_parsed_at":"2025-03-13T15:42:48.879Z","dependency_job_id":null,"html_url":"https://github.com/khachatur/ECommerceApp","commit_stats":null,"previous_names":["khachatur/ecommerceapp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khachatur%2FECommerceApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khachatur%2FECommerceApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khachatur%2FECommerceApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khachatur%2FECommerceApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khachatur","download_url":"https://codeload.github.com/khachatur/ECommerceApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243857957,"owners_count":20359269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clean-architecture","cqrs","csharp","dependency-injection","dotnet-core","entity-framework-core","jwt-authentication","restapi","unit-testing"],"created_at":"2025-03-16T11:18:38.386Z","updated_at":"2026-05-20T09:05:46.219Z","avatar_url":"https://github.com/khachatur.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ECommerceApp\n\nA simple e-commerce application built with ASP.NET Core, featuring a Razor Pages frontend and a Web API backend. Users can browse products, create orders, and view order history, with admin capabilities for managing products and orders.\n\n## Features\n\n- **Frontend**: Razor Pages with Bootstrap 5 for a responsive UI.\n- **Backend**: RESTful Web API with JWT authentication.\n- **Order Processing**: Transactional order creation with stock updates via a stored procedure.\n- **Admin Area**: Role-based dropdown for managing products and orders.\n- **Data Access**: EF Core with a repository pattern and CQRS (MediatR).\n\n## Architecture\n\n- **WebApp**: Client-side rendering with Razor Pages, communicates with WebApi via HTTP.\n- **WebApi**: Handles business logic, persistence, and authentication.\n- **Application**: CQRS commands/queries with MediatR.\n- **Domain**: Entities and interfaces.\n- **Infrastructure**: EF Core and repository implementations.\n\n## Setup\n\n### Prerequisites\n\n- .NET 8 SDK\n- SQL Server (LocalDB or full instance)\n- Git\n\n### Steps\n\n1. **Clone the Repo**\n   ```bash\n   git clone https://github.com/khachatur/ECommerceApp\n   cd ECommerceApp\n   ```\n2. **Configure Database**\n   Update ECommerceApp.WebApi/appsettings.json with your connection string.\n   Apply migrations:\n\n```bash\nApply migrations:\ndotnet ef migrations add InitialCreate -p src/ECommerceApp.Infrastructure -s src/ECommerceApp.WebApi -o Data/Migrations\ndotnet ef database update -p src\\ECommerceApp.Infrastructure -s src\\ECommerceApp.WebApi\n```\n\n3. **Add Stored Procedure**\n   Run in SQL Server:\n\n```sql\nCREATE PROCEDURE UpdateProductStock\n    @ProductId INT,\n    @Quantity INT\nAS\nBEGIN\n    SET NOCOUNT ON;\n    BEGIN TRY\n        UPDATE Products\n        SET Quantity = Quantity - @Quantity\n        WHERE Id = @ProductId AND Quantity \u003e= @Quantity;\n        IF @@ROWCOUNT = 0\n            THROW 50001, 'Insufficient stock or product not found.', 1;\n    END TRY\n    BEGIN CATCH\n        THROW;\n    END CATCH\nEND\nGO\n```\n\n4. **Set JWT Config**\n   In ECommerceApp.WebApi/appsettings.json:\n\n```json\n\"Jwt\": {\n    \"Secret\": \"MySecretKeyHere1234567890MySecretKeyHere1234567890\",\n    \"Issuer\": \"ECommerceApp\",\n    \"Audience\": \"ECommerceApp\",\n    \"ExpirationInMinutes\": \"60\"\n  }\n```\n\n5. **Run Locally**\n\n- WebApi:\n\n```bash\ncd ECommerceApp.WebApi \u0026\u0026 dotnet run\n```\n\n- WebApp:\n\n```bash\ncd ECommerceApp.WebApp \u0026\u0026 dotnet run\n```\n\n- Visit WebApi at https://localhost:7051 and WebApp at https://localhost:7041.\n\n**Docker Setup**\n\n1. Docker Compose\n\n- Run:\n\n```\ndocker-compose up --build\n```\n\n- Apply migrations in webapi container\n\n```\ndocker exec -it \u003cwebapi-container-id\u003e dotnet ef database update\n```\n\n**_CI/CD Setup_**\n\n1. **GitHub Actions**\n\n- Workflow: .github/workflows/ci-cd.yml builds, publishes, and pushes Docker images to Docker Hub.\n- Add secrets in GitHub:\n  - DOCKER_USERNAME\n  - DOCKER_PASSWORD (access token)\n\n2. Trigger: Pushes/PRs to main branch.\n\n**_API Endpoints_**\n\n- **POST** /api/auth/login: { \"username\": \"string\", \"password\": \"string\" } → { \"token\": \"jwt\" }\n- **GET** /api/products: Returns product list.\n- **POST** /api/orders: { \"orderItems\": [{ \"productId\": int, \"quantity\": int }] } → Order ID (requires JWT).\n- **GET** /api/orders: Returns user’s orders (requires JWT).\n\n**License**\n\n- MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhachatur%2Fecommerceapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhachatur%2Fecommerceapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhachatur%2Fecommerceapp/lists"}