Skip to content

KacperKotecki/Market

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

97 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

.NET 8 ASP.NET Core OpenAI Stripe PostgreSQL Docker NUnit

πŸ›’ Market.AI - Next-Gen E-commerce Platform

A smart C2C/B2C e-commerce platform that solves the problem of tedious listing creation using Generative AI. The system automatically generates deep technical specifications, descriptions, and pricing based on product photos. It features a robust monolithic architecture, a secure internal wallet (Escrow model) integrated with Stripe, and an advanced administration panel.


🌐 Live Demo

The application is available at: market.kacperkotecki.me


πŸš€ Enterprise-Level Architecture & Features

🧠 1. AI Module (Generative Deep Specs)

The core of the app is the integration with a multimodal LLM (GPT-4o Vision) via OpenRouter API.

  • Image Analysis: Photos are converted to Base64. AI recognizes the product and generates detailed technical specifications (Deep Specs) in JSON format.
  • Structured Outputs & Fallbacks: The model's response is strictly enforced as JSON and safely deserialized into strongly-typed C# DTOs, eliminating text parsing errors and handling AI hallucinations.

πŸ’³ 2. Hybrid Payment System (Internal Ledger & Escrow)

Transaction safety is built around an Escrow model, ensuring financial consistency.

  • Stripe Webhooks: Payment status is updated asynchronously via Webhooks, preventing client-side manipulation.
  • Atomic Transactions: The system maintains a funds register (WalletBalance). Withdrawals and balance updates are executed as atomic database transactions using the Unit of Work pattern to prevent "double spending".

πŸ›‘οΈ 3. Security & Aspect-Oriented Programming (AOP)

  • Custom Action Filters: Instead of cluttering controllers with imperative if statements, custom authorization attributes (e.g., [SellerFilter]) intercept requests to ensure users have provided mandatory data (like an IBAN) before accessing specific actions.
  • Soft Delete: Blocking users or banning auctions changes their state (IsBlocked, IsBanned) rather than physically deleting records, preserving historical financial and order integrity.

⚑ 4. Performance & Media Pipeline

  • On-the-fly Image Processing: Uploaded photos are intercepted by ImageSharp, scaled to Full HD, and converted to the modern WebP format, reducing bandwidth usage by ~60-70%.

πŸ“Ί System Preview

1. AI-First Listing ("Snap & Sell")

The user uploads photos, and the GPT-4o (Vision) model analyzes the product (recognizing the model, damage, and specs) and fills out the form in a fraction of a second.

418shots_so 806shots_so

2. Wallet and Auctions

A financial dashboard with transaction history and an auction list with filtering.

407shots_so 878shots_so

3. Admin Panel (Moderation) & Checkout

User management, content blocking, and a seamless checkout flow with real-time Stripe validation.

822shots_so 560shots_so

πŸ› οΈ Tech Stack

Backend & Architecture:

  • .NET 8.0 (ASP.NET Core MVC)
  • Clean Architecture Principles (Repository Pattern, Unit of Work, Dependency Injection)
  • Entity Framework Core 8 (Code-First, PostgreSQL)
  • Identity (Extended ASP.NET Core Identity for B2B/B2C profiles)

Frontend:

  • Razor Views (.cshtml), Bootstrap 5 (Dark Mode)
  • Vanilla JavaScript (ES6+), Fetch API, Swiper.js

Testing:

  • NUnit (Test Framework)
  • Moq (Mocking dependencies like IUnitOfWork)
  • FluentAssertions (Readable test assertions)

Integrations & Infrastructure:

  • OpenRouter API (GPT-4o Vision)
  • Stripe API & Webhooks
  • Docker & Docker Compose
  • ImageSharp

πŸ§ͺ Testing

The project includes a comprehensive suite of Unit Tests located in the Market.Tests project. It focuses on testing core business logic, such as the ProfileService and OrderService, ensuring that financial operations (like withdrawing funds or calculating pending balances) behave correctly under various scenarios.

To run the tests:

dotnet test Market.Tests/Market.Tests.csproj

βš™οΈ Getting Started (Local Development)

Prerequisites

  • .NET 8 SDK
  • Docker Desktop (for PostgreSQL database)
  • Stripe Account (for API Keys)
  • OpenRouter Account (for AI API Keys)

Installation Steps

  1. Clone the repository:

    git clone https://github.com/KacperKotecki/Market.git
    cd Market
  2. Set up the Database (Docker): Run the provided docker-compose.yml to spin up the PostgreSQL instance:

    docker-compose up -d
  3. Configure Environment Variables: Update the appsettings.json or use .NET User Secrets to configure your API keys and Database connection string:

    "ConnectionStrings": {
      "DefaultConnection": "Host=localhost;Port=5432;Database=MarketDb;Username=postgres;Password=YourPassword"
    },
    "Stripe": {
      "SecretKey": "sk_test_...",
      "PublishableKey": "pk_test_...",
      "WebhookSecret": "whsec_..."
    },
    "OpenRouter": {
      "ApiKey": "sk-or-v1-...",
      "Model": "openai/gpt-4o"
    }
  4. Apply Migrations & Run: The application is configured to automatically apply pending migrations and seed default Admin roles on startup.

    cd Market.Web
    dotnet run

πŸ“¬ Contact

Kacper Kotecki πŸ“§ kacperkotecki@protonmail.com
πŸ”— LinkedIn Profile

About

A modern C2C e-commerce platform built with .NET 8 and Clean Architecture. It uses Generative AI (GPT-4o Vision) for automatic item specifications and Stripe webhooks for secure escrow payments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors