An open API service indexing awesome lists of open source software.

https://github.com/managedcode/codeui


https://github.com/managedcode/codeui

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# CodeUI

A modern .NET 9 application with Aspire orchestration, Blazor Server-side rendering, and Central Package Management.

## ๐Ÿ—๏ธ Project Structure

```
CodeUI/
โ”œโ”€โ”€ CodeUI.slnx # Modern XML-based solution file (.NET 9+)
โ”œโ”€โ”€ Directory.Packages.props # Central Package Management configuration
โ”œโ”€โ”€ global.json # .NET 9 SDK enforcement
โ”œโ”€โ”€ CodeUI.AppHost/ # Aspire orchestration project
โ”œโ”€โ”€ CodeUI.Web/ # Blazor Server application
โ”œโ”€โ”€ CodeUI.Core/ # Core business logic and data models
โ”œโ”€โ”€ CodeUI.Orleans/ # Orleans grain definitions
โ”œโ”€โ”€ CodeUI.Tests/ # Unit tests using xUnit
โ”œโ”€โ”€ CodeUI.AspireTests/ # Integration tests using Aspire testing framework
โ””โ”€โ”€ README.md # This file
```

## ๐Ÿš€ Technology Stack

- **.NET 9.0** - Latest version of .NET with C# 13 language features
- **Aspire 9.4.1** - Latest .NET Aspire for cloud-native orchestration
- **Central Package Management** - Unified dependency management across solution
- **Blazor Server** - Server-side rendering with real-time updates
- **ASP.NET Core Identity** - Built-in authentication and authorization
- **Entity Framework Core** - Data access with SQLite database
- **Orleans** - Virtual Actor Model for distributed applications

## ๐Ÿ“‹ Prerequisites

**โš ๏ธ Important: You must install .NET 9 before you start!**

Before running this application, ensure you have:

- **[.NET 9.0 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)** - **REQUIRED**
- [Docker](https://docs.docker.com/get-docker/) (for Aspire orchestration)
- [Visual Studio 2022](https://visualstudio.microsoft.com/) or [VS Code](https://code.visualstudio.com/) (recommended)

## ๐Ÿ› ๏ธ Setup Instructions

### 1. Clone the Repository

```bash
git clone https://github.com/managedcode/CodeUI.git
cd CodeUI
```

### 2. Verify .NET 9 Installation

```bash
# Verify .NET 9 is installed
dotnet --version
# Should show 9.0.x or higher

# List installed SDKs
dotnet --list-sdks
# Should include 9.0.x
```

### 3. Install .NET Aspire Workload

```bash
dotnet workload update
dotnet workload install aspire
```

### 4. Restore Dependencies

```bash
# Use .slnx solution format for .NET 9
dotnet restore CodeUI.slnx
```

### 5. Build the Solution

```bash
# Use .slnx solution format for .NET 9
dotnet build CodeUI.slnx
```

## ๐Ÿƒโ€โ™‚๏ธ Running the Application

### Option 1: Run with Aspire Orchestration (Recommended)

```bash
dotnet run --project CodeUI.AppHost
```

This will:
- Start the Aspire dashboard at `http://localhost:18888`
- Launch the Blazor Server app
- Provide monitoring and observability features

### Option 2: Run Blazor Server App Directly

```bash
dotnet run --project CodeUI.Web
```

The application will be available at `http://localhost:5225` (or the port shown in the console).

## ๐Ÿ” Authentication

The application includes basic ASP.NET Core Identity authentication with:

- **Registration** - Create new user accounts
- **Login/Logout** - User authentication
- **In-Memory Database** - For development (switch to SQLite/SQL Server/PostgreSQL for production)
- **Relaxed Password Policy** - For development convenience

### Default Settings:
- Minimum password length: 6 characters
- No special character requirements
- No email confirmation required

## ๐Ÿ—๏ธ Project Details

### CodeUI.AppHost
- **Purpose**: Aspire orchestration host
- **Features**: Service discovery, monitoring, distributed tracing
- **Dependencies**: Aspire.Hosting

### CodeUI.Web
- **Purpose**: Blazor Server application
- **Features**: Interactive server-side rendering, authentication, responsive UI
- **Dependencies**: ASP.NET Core Identity, Entity Framework Core

### CodeUI.Core
- **Purpose**: Shared business logic and data models
- **Features**: Entity Framework DbContext, Identity models
- **Dependencies**: Entity Framework Core, ASP.NET Core Identity

### CodeUI.Orleans
- **Purpose**: Orleans grain definitions for distributed computing
- **Features**: Virtual Actor Model interfaces
- **Dependencies**: Microsoft.Orleans.Abstractions

## ๐Ÿงช Development

### Building

```bash
# Build entire solution using .slnx format
dotnet build CodeUI.slnx

# Build specific project
dotnet build CodeUI.Web
```

### Testing

```bash
# Run all tests using .slnx format
dotnet test CodeUI.slnx

# Run tests with coverage
dotnet test CodeUI.slnx --collect:"XPlat Code Coverage"
```

### Adding Migrations (when using a real database)

```bash
# Add migration
dotnet ef migrations add InitialCreate --project CodeUI.Core --startup-project CodeUI.Web

# Update database
dotnet ef database update --project CodeUI.Core --startup-project CodeUI.Web
```

## ๐Ÿ“ Key Files

- `CodeUI.slnx` - Modern XML-based solution file for .NET 9
- `Directory.Packages.props` - Central Package Management configuration
- `global.json` - .NET 9 SDK enforcement
- `CodeUI.AppHost/Program.cs` - Aspire orchestration configuration
- `CodeUI.Web/Program.cs` - Web application startup and services configuration
- `CodeUI.Core/Data/ApplicationDbContext.cs` - Entity Framework database context
- `CodeUI.Core/Data/ApplicationUser.cs` - Identity user model
- `CodeUI.Orleans/Grains/IHelloGrain.cs` - Sample Orleans grain interface

## ๐Ÿš€ Deployment

### Self-Contained Deployment (Recommended)

CodeUI supports self-contained deployment for production environments without requiring Docker or external dependencies.

#### Quick Start
```bash
# Build for all platforms
./deployment/scripts/build-all.sh

# Manual build commands
dotnet publish CodeUI.Web -c Release -r win-x64 --self-contained -p:PublishSingleFile=true
dotnet publish CodeUI.Web -c Release -r linux-x64 --self-contained -p:PublishSingleFile=true
dotnet publish CodeUI.Web -c Release -r osx-x64 --self-contained -p:PublishSingleFile=true
```

#### Platform Installation
- **Windows**: Run `install-windows.ps1` as Administrator
- **Linux**: Run `sudo ./install-unix.sh`
- **macOS**: Run `sudo ./install-unix.sh`

#### Features
- โœ… Single executable (~150MB per platform)
- โœ… SQLite database for data persistence
- โœ… Windows Service / systemd / LaunchDaemon auto-start
- โœ… No external dependencies required
- โœ… Production-ready configuration

See [deployment/README.md](deployment/README.md) for detailed instructions.

### Traditional Deployment

For development or containerized environments:

1. **Update Database Provider**: Change from In-Memory to SQL Server/PostgreSQL in `Program.cs`
2. **Configure Connection Strings**: Update `appsettings.json` with production database
3. **Security Settings**: Review and harden authentication settings
4. **Environment Variables**: Configure for production environment

## ๐Ÿค Contributing

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/your-feature-name`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin feature/your-feature-name`
5. Submit a pull request

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ“ž Support

For questions and support:
- Create an issue in the GitHub repository
- Check existing documentation and README
- Review the [.NET Aspire documentation](https://learn.microsoft.com/en-us/dotnet/aspire/)

---

**Happy Coding! ๐ŸŽ‰**