Skip to content

InfinityZero3000/John-Henry-Fashion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

352 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home Interface

alt text

John Henry Fashion Web Platform

.NET ASP.NET Core PostgreSQL Docker Redis JWT

A comprehensive, enterprise-grade e-commerce platform built with modern web technologies for fashion retail business. This platform provides a complete solution for online fashion stores with advanced features including multi-vendor support, real-time analytics, payment processing, and robust security systems.

Table of Contents

Architecture Overview

This platform follows a modern Model-View-Controller (MVC) architecture with Domain-Driven Design (DDD) principles, implementing Clean Architecture patterns for maintainability and scalability.

System Architecture Diagram

┌─────────────────┐    ┌───────────────────┐    ┌─────────────────┐
│   Client Side   │    │   Server Side     │    │   Data Layer    │
│                 │    │                   │    │                 │
│ • React/jQuery  │◄──►│ • ASP.NET Core    │◄──►│ • PostgreSQL    │
│ • Bootstrap 5   │    │ • Entity Framework│    │ • Redis Cache   │
│ • Responsive UI │    │ • Identity System │    │ • File Storage  │
└─────────────────┘    └───────────────────┘    └─────────────────┘
         │                       │                       │
         ▼                       ▼                       ▼
┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  External APIs  │     │   Middleware    │     │   Monitoring    │
│                 │     │                 │     │                 │
│ • Google OAuth  │     │ • Authentication│     │ • Serilog       │
│ • Payment APIs  │     │ • Authorization │     │ • App Insights  │
│ • Email Service │     │ • Security      │     │ • Performance   │
└─────────────────┘     └─────────────────┘     └─────────────────┘

Technology Stack

Backend Technologies

ASP.NET Core ASP.NET Core 9.0

  • Modern web framework with high performance
  • Cross-platform compatibility
  • Built-in dependency injection

Entity Framework Entity Framework Core 9.0

  • Code-first database approach
  • Advanced query optimization
  • Migration management

PostgreSQL PostgreSQL 15

  • Advanced relational database
  • JSON support for complex data
  • High performance and reliability

Redis Redis Cache

  • In-memory data structure store
  • Session management
  • High-performance caching

Frontend Technologies

Bootstrap Bootstrap 5.3

  • Responsive design framework
  • Modern UI components
  • Mobile-first approach

jQuery jQuery 3.7

  • DOM manipulation
  • AJAX operations
  • Event handling

JavaScript Modern JavaScript

  • ES6+ features
  • Async/await patterns
  • Module system

Authentication & Security

Google Google OAuth 2.0

  • Social authentication
  • Secure user registration
  • Single sign-on capability

JWT JWT Authentication

  • Stateless authentication
  • API security
  • Token-based authorization

Identity ASP.NET Core Identity

  • User management
  • Role-based authorization
  • Two-factor authentication

DevOps & Deployment

Docker Docker

  • Application containerization
  • Multi-container orchestration
  • Development environment consistency

Azure Azure Cloud Services

  • Application hosting
  • Database management
  • CDN and storage

Monitoring & Analytics

Serilog Serilog

  • Structured logging
  • Multiple output targets
  • Performance monitoring

Application Insights Application Insights

  • Real-time monitoring
  • Performance analytics
  • Error tracking

Core Features

E-commerce Functionality

Product Management

  • Advanced Product Catalog: Comprehensive product information management with multiple categories, variants, and pricing tiers
  • Inventory Tracking: Real-time stock management with automated alerts and reorder points
  • Digital Asset Management: Image optimization, multiple product photos, and digital asset storage
  • Product Variants: Size, color, and style variations with individual SKU management
  • Pricing Engine: Dynamic pricing, promotional discounts, and tier-based pricing strategies

Shopping Experience

  • Advanced Search & Filtering: Full-text search with category, price, brand, and attribute filters
  • Shopping Cart: Persistent cart across sessions with saved items and wishlist functionality
  • Checkout Process: Streamlined multi-step checkout with guest and registered user options
  • Order Management: Complete order lifecycle management from placement to delivery
  • Review & Rating System: Customer reviews, ratings, and feedback management

Multi-Vendor Platform

Seller Dashboard

  • Vendor Registration: Complete seller onboarding with document verification
  • Product Listing Tools: Bulk product upload, inventory management, and pricing controls
  • Order Fulfillment: Order processing, shipping management, and tracking integration
  • Financial Dashboard: Sales analytics, commission tracking, and payout management
  • Performance Metrics: Seller performance tracking with KPIs and improvement suggestions

Commission Management

  • Flexible Commission Structure: Configurable commission rates by category, seller, or product
  • Automated Calculations: Real-time commission calculation and tracking
  • Payment Processing: Automated seller payouts with detailed reporting
  • Financial Reporting: Comprehensive financial reports for both platform and sellers

Advanced Admin Features

Analytics & Reporting

  • Sales Analytics: Real-time sales data, trend analysis, and forecasting
  • Customer Analytics: User behavior analysis, customer segmentation, and retention metrics
  • Performance Monitoring: System performance metrics, API response times, and error tracking
  • Business Intelligence: Custom reports, data visualization, and actionable insights

Content Management

  • Blog Management: SEO-optimized blog system with content scheduling and management
  • Static Page Management: Dynamic page creation and management for policies, about us, etc.
  • Email Templates: Customizable email templates for order confirmations, newsletters, etc.
  • SEO Management: Meta tags, structured data, and search engine optimization tools

System Administration

  • User Management: Complete user lifecycle management with role-based permissions
  • Security Monitoring: Real-time security monitoring with threat detection and response
  • System Configuration: Platform-wide settings, feature toggles, and configuration management
  • Audit Logging: Comprehensive audit trails for all system activities

Authentication & Authorization

Multi-Layer Security System

User Authentication

// Multiple authentication providers
services.AddAuthentication()
    .AddJwtBearer() // API authentication
    .AddGoogle()    // Social login
    .AddCookie();   // Web application

Role-Based Access Control

  • Customer Role: Product browsing, purchasing, order tracking, reviews
  • Seller Role: Product management, order fulfillment, sales analytics
  • Admin Role: Complete system access, user management, system configuration
  • Super Admin: Platform-wide controls, security settings, system maintenance

Security Features

  • Two-Factor Authentication: TOTP-based 2FA for enhanced security
  • Password Policy: Enforced strong password requirements with complexity rules
  • Account Lockout: Automated account protection against brute force attacks
  • Session Management: Secure session handling with automatic expiration
  • API Rate Limiting: Protection against API abuse and DoS attacks

Google OAuth Integration

Complete integration with Google OAuth 2.0 for seamless user authentication:

services.AddAuthentication()
    .AddGoogle(options =>
    {
        options.ClientId = configuration["Authentication:Google:ClientId"];
        options.ClientSecret = configuration["Authentication:Google:ClientSecret"];
        options.SaveTokens = true;
    });

Performance & Optimization

Caching Strategy

Multi-Level Caching

  • Redis Distributed Cache: Session data, user preferences, and frequently accessed data
  • Memory Cache: Application-level caching for static data and configuration
  • Response Caching: HTTP response caching for improved page load times
  • Database Query Caching: Entity Framework query result caching

Performance Optimizations

// Response compression
services.AddResponseCompression(options =>
{
    options.Providers.Add<BrotliCompressionProvider>();
    options.Providers.Add<GzipCompressionProvider>();
});

// Static file caching
app.UseStaticFiles(new StaticFileOptions
{
    OnPrepareResponse = ctx =>
    {
        ctx.Context.Response.Headers[HeaderNames.CacheControl] = 
            "public,max-age=" + (60 * 60 * 24 * 365); // 1 year cache
    }
});

Database Optimization

Query Optimization

  • Entity Framework Performance: Optimized LINQ queries with projection and filtering
  • Database Indexing: Strategic indexing for frequently queried columns
  • Connection Pooling: Efficient database connection management
  • Batch Operations: Bulk insert/update operations for improved performance

PostgreSQL Features

  • JSON Support: Storing and querying complex data structures
  • Full-Text Search: Advanced search capabilities with ranking
  • Partitioning: Large table partitioning for improved query performance
  • Extensions: PostGIS for location-based features, pg_stat_statements for monitoring

Security Features

Comprehensive Security Implementation

Data Protection

  • Encryption at Rest: Database encryption for sensitive data
  • Encryption in Transit: HTTPS/TLS for all communications
  • Data Masking: Sensitive data protection in logs and error messages
  • GDPR Compliance: Data privacy and user consent management

Application Security

// Security headers
app.Use((context, next) =>
{
    context.Response.Headers["X-Content-Type-Options"] = "nosniff";
    context.Response.Headers["X-Frame-Options"] = "DENY";
    context.Response.Headers["X-XSS-Protection"] = "1; mode=block";
    context.Response.Headers["Referrer-Policy"] = "strict-origin-when-cross-origin";
    return next();
});

Monitoring & Alerting

  • Security Event Logging: Comprehensive logging of security-related events
  • Intrusion Detection: Real-time monitoring for suspicious activities
  • Vulnerability Scanning: Regular security assessments and updates
  • Incident Response: Automated alerting and response procedures

API Documentation

RESTful API Design

The platform provides a comprehensive RESTful API for third-party integrations and mobile applications.

API Features

  • Swagger Documentation: Interactive API documentation with testing capabilities
  • Versioning: API versioning for backward compatibility
  • Rate Limiting: Request throttling to prevent abuse
  • Authentication: JWT-based API authentication

Swagger Integration

services.AddSwaggerGen(c =>
{
    c.SwaggerDoc("v1", new OpenApiInfo 
    { 
        Title = "John Henry Fashion API", 
        Version = "v1",
        Description = "Comprehensive e-commerce API"
    });
});

API Endpoints Overview

Product Management API

  • GET /api/products - Retrieve product catalog with filtering
  • POST /api/products - Create new product (Seller/Admin)
  • PUT /api/products/{id} - Update product information
  • DELETE /api/products/{id} - Remove product from catalog

Order Management API

  • GET /api/orders - Retrieve order history
  • POST /api/orders - Create new order
  • PUT /api/orders/{id}/status - Update order status
  • GET /api/orders/{id}/tracking - Get order tracking information

User Management API

  • POST /api/auth/login - User authentication
  • POST /api/auth/register - User registration
  • GET /api/users/profile - Get user profile
  • PUT /api/users/profile - Update user profile

Installation & Setup

Prerequisites

Ensure you have the following installed on your development machine:

  • .NET .NET 9.0 SDK
  • Docker Docker & Docker Compose
  • Git Git

🚀 Deploy to Production (Render)

Quick deploy in 15 minutes!

Deploy to Render

Step-by-step guides:

What you'll get:

  • ✅ Free PostgreSQL database
  • ✅ Auto SSL/HTTPS
  • ✅ Auto-deploy from GitHub
  • ✅ Docker containerized
  • ✅ Health monitoring
  • ✅ Persistent storage with Cloudinary

Quick Start (Local Development)

  1. Clone the Repository
git clone https://github.com/InfinityZero3000/John-Henry-Website.git
cd John-Henry-Website
  1. Start Database Services
docker-compose up -d postgres redis
  1. Configure Application Settings
cp .env.example .env
# Edit .env with your settings
  1. Apply Database Migrations
dotnet ef database update
  1. Install Dependencies & Run
dotnet restore
dotnet run
  1. Access the Application
  • Web Application: https://localhost:5001
  • API Documentation: https://localhost:5001/swagger
  • Admin Panel: https://localhost:5001/admin
  • Health Check: https://localhost:5001/health

Configuration

Database Configuration

{
  "ConnectionStrings": {
    "DefaultConnection": "Host=localhost;Database=johnhenry_db;Username=johnhenry_user;Password=YourPassword",
    "Redis": "localhost:6379"
  }
}

Authentication Configuration

{
  "Authentication": {
    "Google": {
      "ClientId": "your-google-client-id",
      "ClientSecret": "your-google-client-secret"
    }
  },
  "JWT": {
    "SecretKey": "your-jwt-secret-key",
    "Issuer": "JohnHenryFashion",
    "Audience": "JohnHenryFashionUsers"
  }
}

Development Environment

Docker Development Setup

The project includes a complete Docker development environment:

services:
  postgres:
    image: postgres:15
    environment:
      POSTGRES_DB: johnhenry_db
      POSTGRES_USER: johnhenry_user
      POSTGRES_PASSWORD: JohnHenry@2025!
    ports:
      - "5432:5432"

  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

  pgadmin:
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: thefirestar312@gmail.com
      PGADMIN_DEFAULT_PASSWORD: admin123
    ports:
      - "8080:80"

Development Tools

Database Management

  • pgAdmin: Web-based PostgreSQL administration (http://localhost:8080)
  • Entity Framework Tools: Migration and database management
  • Redis CLI: Command-line interface for Redis operations

Code Quality

  • EditorConfig: Consistent coding style
  • ESLint: JavaScript code quality
  • SonarQube: Code quality analysis
  • Unit Testing: Comprehensive test coverage

Project Structure

John-Henry-Website/
├── Controllers/           # MVC Controllers
│   ├── AdminController.cs
│   ├── ProductsController.cs
│   └── Api/              # API Controllers
├── Models/               # Domain Models
│   ├── DomainModels.cs
│   └── AdminModels.cs
├── Services/             # Business Logic Services
│   ├── AuthService.cs
│   ├── PaymentService.cs
│   └── EmailService.cs
├── Views/                # Razor Views
│   ├── Shared/
│   ├── Home/
│   └── Admin/
├── wwwroot/              # Static Assets
│   ├── css/
│   ├── js/
│   └── images/
├── Data/                 # Database Context
├── Migrations/           # EF Core Migrations
├── Middleware/           # Custom Middleware
├── EmailTemplates/       # Email Templates
└── docker-compose.yml    # Docker Configuration

Database Schema

Core Entities

User Management

  • ApplicationUser: Extended ASP.NET Identity user with custom fields
  • UserProfile: Additional user information and preferences
  • UserAddress: Multiple address management for users
  • UserRole: Role-based access control

Product Catalog

  • Product: Core product information and specifications
  • Category: Hierarchical product categorization
  • ProductVariant: Size, color, and style variations
  • ProductImage: Multiple product images and media
  • ProductReview: Customer reviews and ratings

Order Management

  • Order: Order header information and status
  • OrderItem: Individual items within an order
  • OrderStatus: Order lifecycle tracking
  • ShippingAddress: Delivery address information
  • PaymentTransaction: Payment processing records

Analytics & Reporting

  • PageView: Website analytics and user behavior
  • SalesReport: Aggregated sales data
  • UserActivity: User interaction tracking
  • SystemMetric: Performance monitoring data

Database Relationships

-- Example table relationships
ApplicationUser ||--o{ Order : "Places"
Order ||--o{ OrderItem : "Contains"
Product ||--o{ OrderItem : "Ordered as"
Product ||--o{ ProductReview : "Has reviews"
Category ||--o{ Product : "Categorizes"

Contributing

We welcome contributions to the John Henry Fashion Web Platform! Please follow these guidelines:

Development Workflow

  1. Fork the Repository
  2. Create a Feature Branch
    git checkout -b feature/your-feature-name
  3. Make Changes and Test
  4. Submit a Pull Request

Code Standards

  • Follow C# coding conventions
  • Write unit tests for new features
  • Update documentation for API changes
  • Ensure all tests pass before submitting

Pull Request Process

  1. Update the README.md with details of changes if applicable
  2. Update API documentation for any new endpoints
  3. Increase version numbers following semantic versioning
  4. Ensure the PR description clearly describes the changes

License

This project is licensed under the MIT License - see the LICENSE file for details.


Contact & Support

For questions, support, or business inquiries:

Community

  • GitHub Issues: Report bugs and request features
  • Discussions: Join community discussions
  • Wiki: Additional documentation and guides

Built with passion for modern e-commerce solutions. Star this repository if you find it useful!

GitHub stars GitHub forks GitHub watchers

About

JohnHenry/Freelancer - Web programming course project. Crawl data image, price, UI and upgrade feature

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors