---
alwaysApply: true
---

# Development Workflow and Commands

## Running Applications

### Backend API
```bash
dotnet watch run --project Ladaer.BackEnd/Ladaer.BackEnd.csproj
# Runs on: https://localhost:7284
# Swagger UI: https://localhost:7284/swagger/index.html
```

### Public Website
```bash
dotnet watch run --project ladaexpress.vn/ladaexpress.vn.csproj
# Runs on: https://localhost:7007
```

### Notification Service
```bash
dotnet watch run --project Ladaer.NotificationManagement/Ladaer.NotificationManagement.csproj
# Runs on: https://localhost:7229
```

## Database Operations

### Entity Framework Migrations
```bash
# Add new migration
dotnet ef migrations add [MigrationName] -p Ladaer.BackEnd\Ladaer.BackEnd.csproj

# Generate migration script
dotnet ef migrations script [FromVersion] [ToVersion] -o [OutputFile].sql -p Ladaer.BackEnd\Ladaer.BackEnd.csproj

# PowerShell migration script (custom)
Script-Migration -Project Ladaer.BackEnd -From [FromVersion] -To [ToVersion]
```

### Database Connection
- Connection string in [Ladaer.BackEnd/appsettings.json](mdc:Ladaer.BackEnd/appsettings.json)
- Development settings in [Ladaer.BackEnd/appsettings.Development.json](mdc:Ladaer.BackEnd/appsettings.Development.json)

## Publishing

### Backend API
```bash
dotnet publish Ladaer.BackEnd\Ladaer.BackEnd.csproj -c Release -o Ladaer.BackEnd\bin\Release\net9.0 -p:PublishReadyToRun=true
```

### Public Website
```bash
dotnet publish ladaexpress.vn\ladaexpress.vn.csproj -c Release -o ladaexpress.vn\bin\Release\net9.0 -p:PublishReadyToRun=true
```

## Git Workflow

### Branch Naming
- Feature branches: `feature/feature-name`
- Bug fixes: `bugfix/issue-description`
- Hotfixes: `hotfix/critical-issue`

### Commit Messages
- Use Vietnamese for business-related changes
- Use English for technical changes
- Format: `[Type] Description`

## Code Organization

### Adding New Features
1. Create model in appropriate DTO folder
2. Add service interface and implementation
3. Register service in [DependencyRegister.cs](mdc:Ladaer.BackEnd/Infrastructures/Startup/DependencyRegister.cs)
4. Create controller with proper authorization
5. Add XML documentation in Vietnamese

### File Structure
- Controllers: [Ladaer.BackEnd/Controllers/](mdc:Ladaer.BackEnd/Controllers/)
- Services: [Ladaer.BackEnd/Infrastructures/Services/](mdc:Ladaer.BackEnd/Infrastructures/Services/)
- DTOs: [Ladaer.BackEnd/Infrastructures/DTO/](mdc:Ladaer.BackEnd/Infrastructures/DTO/)
- Framework: [Lada.Framework/](mdc:Lada.Framework/)

## Testing

### Test Structure
- Test files in [Ladaer.BackEnd/Tests/](mdc:Ladaer.BackEnd/Tests/)
- xUnit framework for unit tests
- Example: [Lada.Framework/Tests/OrderFeeCalculationServiceTests.cs](mdc:Lada.Framework/Tests/OrderFeeCalculationServiceTests.cs)

## Documentation

### API Documentation
- Swagger/OpenAPI automatically generated
- XML documentation enabled in project files
- Vietnamese comments for business logic

### Project Documentation
- [CLAUDE.md](mdc:CLAUDE.md) - Development guide
- [docs/](mdc:docs/) - Feature documentation
- README files for specific features