# Ladaer-Backend Project Structure

## Solution Overview

The Ladaer-Backend solution consists of 4 main active projects:

### 1. Ladaer.BackEnd (Main API)

- **Type**: ASP.NET Core Web API (.NET 9.0)
- **Purpose**: Main backend API for the logistics system
- **Port**: https://localhost:7284 (Development)
- **Features**:
  - RESTful APIs for all business operations
  - Swagger/OpenAPI documentation
  - JWT authentication integration
  - Entity Framework Core with SQL Server
  - Hangfire background jobs
  - Media processing capabilities

### 2. Lada.Framework (Shared Library)

- **Type**: .NET 9.0 Class Library
- **Purpose**: Shared framework with common services and utilities
- **Version**: 1.3.33
- **Features**:
  - Common data models and DTOs
  - Shared services (Media, Configuration, etc.)
  - Database context and repositories
  - Identity management
  - Utility classes and extensions

### 3. ladaexpress.vn (Public Website)

- **Type**: ASP.NET Core MVC (.NET 9.0)
- **Purpose**: Public-facing website
- **Port**: https://localhost:7007 (Development)
- **Features**:
  - Product catalog
  - Service information
  - Customer portal
  - Responsive design
  - SEO optimization

### 4. Ladaer.NotificationManagement

- **Type**: ASP.NET Core Web API
- **Purpose**: Notification management service
- **Port**: https://localhost:7229
- **Features**:
  - Real-time notifications
  - Email/SMS integration
  - Push notifications
  - Notification templates

## Deprecated Projects

### LadaIdentity (Identity Server) - DEPRECATED

- **Status**: No longer used
- **Previous Purpose**: Authentication and authorization server using IdentityServer4
- **Replacement**: Built-in ASP.NET Core Identity in Ladaer.BackEnd
- **Migration**: Authentication functionality moved to main API project

## Key Dependencies

- **AutoMapper**: Object-to-object mapping
- **Dapper**: Micro ORM for database queries
- **Entity Framework Core**: Main ORM
- **Hangfire**: Background job processing
- **IdentityServer4**: Authentication framework
- **Swashbuckle**: Swagger/OpenAPI generation
- **SixLabors.ImageSharp**: Image processing
- **Xabe.FFmpeg**: Video processing
- **EPPlus**: Excel file processing

## Database

- **Provider**: SQL Server
- **Connection String**: LadaConnection in appsettings.json
- **Migration Assembly**: Ladaer.BackEnd
- **Approach**: Code First with Entity Framework Core

## Build and Run Commands

```bash
# Build entire solution
dotnet build Ladaer.sln

# Run main API
dotnet watch run --project Ladaer.BackEnd/Ladaer.BackEnd.csproj

# Run website
dotnet watch run --project ladaexpress.vn/ladaexpress.vn.csproj

# Add migration
dotnet ef migrations add <MigrationName> -p Ladaer.BackEnd\Ladaer.BackEnd.csproj

# Update database
dotnet ef database update -p Ladaer.BackEnd\Ladaer.BackEnd.csproj

# Publish for production
dotnet publish Ladaer.BackEnd\Ladaer.BackEnd.csproj -c Release -o publish
```

## Development URLs

- **Main API**: https://localhost:7284
- **API Documentation**: https://localhost:7284/swagger/index.html
- **Website**: https://localhost:7007
- **Notification Service**: https://localhost:7229
- **Hangfire Dashboard**: https://localhost:7284/hangfire
