Skip to content

Commit 9cf0b54

Browse files
committed
feat: update documentation to include .NET Aspire architecture and Redis caching strategy
1 parent 1d0301d commit 9cf0b54

File tree

6 files changed

+618
-32
lines changed

6 files changed

+618
-32
lines changed

.github/copilot-instructions.md

Lines changed: 86 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,74 @@ This is "Copilot That Jawn" - a comprehensive ASP.NET Core web application that
1010

1111
## Technology Stack
1212
- **Framework**: ASP.NET Core 9.0+ with Razor Pages
13-
- **Architecture**: Razor Pages application with MVC controllers for complex operations
13+
- **Architecture**: .NET Aspire cloud-native application stack with Razor Pages application and MVC controllers for complex operations
14+
- **Orchestration**: .NET Aspire AppHost for service orchestration and configuration
1415
- **Content Storage**: Markdown files in Content/ directory for tips, tutorials, and guides
1516
- **Database**: Entity Framework Core (SQL Server or SQLite for development) for dynamic data
1617
- **Frontend**: Bootstrap 5, modern responsive design with CSS Grid/Flexbox
1718
- **JavaScript**: Vanilla JS with modern ES6+ features, minimal dependencies
19+
- **Cloud Services**: Azure integration through .NET Aspire service defaults and components
20+
21+
## .NET Aspire Architecture
22+
23+
This application is built using .NET Aspire, Microsoft's cloud-native application stack that provides a consistent, opinionated set of tools and patterns for building observable, production-ready apps.
24+
25+
### Aspire Project Structure
26+
```
27+
├── AppHost/ # .NET Aspire orchestration project
28+
│ ├── AppHost.cs # Application composition and service configuration
29+
│ ├── appsettings.json # Aspire host configuration
30+
│ └── infra/ # Infrastructure templates for deployment
31+
├── Web/ # Main web application project
32+
├── ServiceDefaults/ # Shared service configuration and extensions
33+
├── ContentLoader/ # Background service for content processing
34+
└── Shared/ # Shared models and utilities
35+
```
36+
37+
### Key Aspire Components Used
38+
- **Service Discovery**: Automatic service discovery and configuration
39+
- **Service Defaults**: Shared telemetry, health checks, and service configuration
40+
- **Resource Management**: Simplified resource provisioning and management
41+
- **Observability**: Built-in logging, metrics, and distributed tracing
42+
- **Development Dashboard**: Real-time monitoring and debugging during development
43+
44+
### Aspire Development Best Practices
45+
46+
#### AppHost Configuration
47+
- Define all services and their dependencies in `AppHost.cs`
48+
- Use environment-specific configuration for different deployment targets
49+
- Leverage Aspire's built-in resource templates for databases, caching, messaging
50+
- Configure service-to-service communication through Aspire's service discovery
51+
52+
#### Service Defaults Integration
53+
- All projects should reference the `ServiceDefaults` project
54+
- Use `builder.AddServiceDefaults()` in each service's `Program.cs`
55+
- Implement consistent logging, health checks, and telemetry across services
56+
- Follow Aspire's conventions for configuration and dependency injection
57+
58+
#### Running the Application
59+
- **Primary Development Command**: `dotnet run --project AppHost`
60+
- **Alternative**: Use `dotnet watch run --project AppHost` for development with hot reload
61+
- **Aspire Dashboard**: Access the development dashboard at the URL shown in console output
62+
- **Service Monitoring**: Use the Aspire dashboard to monitor service health, logs, and metrics
63+
64+
#### Resource Management
65+
- Define infrastructure requirements in the AppHost project
66+
- Use Aspire's resource provisioning for local development dependencies
67+
- Leverage infrastructure templates in `infra/` directory for cloud deployment
68+
- Configure connection strings and service endpoints through Aspire's configuration system
69+
70+
#### Testing with Aspire
71+
- Use Aspire's testing utilities for integration tests
72+
- Test service communication through Aspire's service discovery
73+
- Validate configuration and resource dependencies
74+
- Implement health checks for all services
75+
76+
### Deployment Considerations
77+
- Aspire applications can be deployed to various cloud platforms
78+
- Infrastructure templates generate appropriate deployment artifacts
79+
- Service configuration is managed through Aspire's configuration system
80+
- Observability and monitoring are built-in through Aspire's telemetry
1881

1982
## Project Structure Guidelines
2083

@@ -198,22 +261,30 @@ Content/
198261
### Development Workflow Best Practices
199262

200263
#### Running and Testing the Application
201-
- **Prefer `dotnet watch`**: Always use `dotnet watch run` for development instead of manually building, running, stopping, and restarting the application
202-
- **Hot Reload Benefits**: `dotnet watch` provides automatic rebuilding and browser refresh when files change, significantly improving development efficiency
203-
- **Recommended Commands**:
204-
- `dotnet watch run` - Start the application with hot reload
205-
- `dotnet watch test` - Run tests with automatic re-execution on file changes
206-
- `dotnet watch build` - Build with automatic rebuilding on changes
207-
208-
#### File Monitoring
209-
- `dotnet watch` automatically monitors C# files, Razor pages, CSS, JavaScript, and other static assets
210-
- Changes trigger automatic compilation and browser refresh
211-
- Reduces context switching and speeds up the development cycle
264+
- **Primary Development Command**: `dotnet run --project AppHost` - Starts the entire Aspire application stack
265+
- **With Hot Reload**: `dotnet watch run --project AppHost` - Starts with automatic rebuilding and browser refresh
266+
- **Aspire Dashboard**: Monitor services, logs, and metrics through the Aspire development dashboard
267+
- **Individual Service Testing**: Use `dotnet test` in specific project directories for unit tests
268+
- **Integration Testing**: Run full stack tests using Aspire's testing framework
269+
270+
#### Aspire-Specific Development Workflow
271+
- **Service Orchestration**: All services are managed through the AppHost project
272+
- **Configuration Management**: Use Aspire's configuration system for service settings and connection strings
273+
- **Service Discovery**: Services communicate through Aspire's built-in service discovery
274+
- **Observability**: Monitor application performance through the Aspire dashboard during development
275+
276+
#### File Monitoring and Hot Reload
277+
- Aspire's `dotnet watch` automatically monitors all projects in the application stack
278+
- Changes to any service trigger appropriate rebuilds and restarts
279+
- The Aspire dashboard provides real-time feedback on service status during development
280+
- Static assets (CSS, JS) are monitored and trigger browser refresh automatically
212281

213282
#### Development Environment Setup
214-
- Ensure the development environment is configured for optimal `dotnet watch` performance
215-
- Use the `--verbose` flag for debugging watch issues: `dotnet watch run --verbose`
216-
- Configure file exclusions in `.csproj` if needed to avoid unnecessary rebuilds
283+
- Ensure .NET 9.0+ SDK is installed for Aspire support
284+
- Use `dotnet run --project AppHost` as the primary development command
285+
- Configure the Aspire dashboard for optimal monitoring during development
286+
- Set up appropriate logging levels in `appsettings.Development.json` for each service
287+
- Use environment variables through Aspire's configuration system rather than direct file configuration
217288

218289
## Content Strategy
219290

docs/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Welcome to the documentation for "Copilot That Jawn"! This documentation explain
66

77
- [Project Overview](overview.md): General information about the project, its purpose, and structure
88
- [Technical Architecture](technical-architecture.md): Detailed explanation of the application architecture and technology stack
9+
- [Redis and Caching](redis-caching.md): Comprehensive guide to Redis configuration and caching strategy
910
- [Content Management](content-management.md): How content is organized, stored, and processed
1011
- [Development Workflow](development-workflow.md): Guide to setting up a development environment and contributing
1112
- [Markdown Format](markdown-format.md): Detailed guide to the Markdown format used for content
@@ -17,8 +18,9 @@ If you're new to the project, we recommend reading the documentation in this ord
1718
1. [Project Overview](overview.md)
1819
2. [Development Workflow](development-workflow.md)
1920
3. [Technical Architecture](technical-architecture.md)
20-
4. [Content Management](content-management.md)
21-
5. [Markdown Format](markdown-format.md)
21+
4. [Redis and Caching](redis-caching.md)
22+
5. [Content Management](content-management.md)
23+
6. [Markdown Format](markdown-format.md)
2224

2325
## Contributing
2426

@@ -28,7 +30,8 @@ We welcome contributions to both the codebase and content. Please refer to the [
2830

2931
"Copilot That Jawn" is built with:
3032

31-
- **ASP.NET Core 9.0+** with Razor Pages
33+
- **ASP.NET Core 9.0+** with .NET Aspire cloud-native stack
34+
- **Redis** distributed caching for performance and scalability
3235
- **Markdown** content files with YAML frontmatter
3336
- **Bootstrap 5** for styling
3437
- **Modern JavaScript** for interactive features

docs/development-workflow.md

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,93 @@ This guide explains the recommended development workflow for contributing to the
1313
### Getting Started
1414

1515
1. Clone the repository:
16-
```
16+
```bash
1717
git clone https://github.com/yourusername/CopilotThatJawn.git
1818
cd CopilotThatJawn
1919
```
2020

2121
2. Restore packages:
22-
```
22+
```bash
2323
dotnet restore
2424
```
2525

26-
3. Run the application with hot reload:
27-
```
28-
dotnet watch run --project Web
26+
3. Run the application using .NET Aspire:
27+
```bash
28+
dotnet run --project AppHost
2929
```
3030

31-
4. Access the site at `https://localhost:5001` (or the port configured in your environment)
31+
4. Access the Aspire dashboard at the URL shown in the console output (typically `https://localhost:15888`)
32+
5. Access the main application at `https://localhost:5001` (or the port shown in the Aspire dashboard)
33+
34+
## .NET Aspire Development
35+
36+
The project uses .NET Aspire for service orchestration, which manages Redis, Azure Storage, and the web application.
37+
38+
### Aspire Dashboard
39+
40+
The Aspire dashboard provides:
41+
- **Service Status**: Monitor all running services (Web, Redis, Azure Storage)
42+
- **Logs**: Centralized logging from all services
43+
- **Metrics**: Performance metrics and health checks
44+
- **Resource Management**: View connection strings and service endpoints
45+
46+
### Redis Development
47+
48+
#### Local Redis Setup
49+
50+
Redis runs automatically through Aspire orchestration:
51+
52+
```bash
53+
# Start the full application stack (includes Redis)
54+
dotnet run --project AppHost
55+
56+
# Redis will be available at localhost:6379 (default port)
57+
# RedisInsight dashboard available through Aspire dashboard
58+
```
59+
60+
#### Redis Cache Management
61+
62+
The application provides several ways to interact with the Redis cache:
63+
64+
1. **Through the Application**: Content is automatically cached during normal operation
65+
2. **RedisInsight**: Visual Redis management tool accessible through Aspire dashboard
66+
3. **Cache Refresh API**: Manual cache refresh endpoint
67+
68+
#### Cache Refresh API
69+
70+
```bash
71+
# Refresh cache via API (requires API key in production)
72+
curl -X POST https://localhost:5001/api/cache/refresh \
73+
-H "X-API-Key: your-api-key"
74+
```
75+
76+
#### Monitoring Redis
77+
78+
- **Aspire Dashboard**: View Redis logs and metrics
79+
- **RedisInsight**: Inspect keys, values, and performance
80+
- **Application Logs**: ContentService logs cache hits/misses
3281

3382
## Using Hot Reload
3483

35-
The project is configured to take advantage of ASP.NET Core's hot reload capabilities:
84+
The project is configured to take advantage of ASP.NET Core's hot reload capabilities through .NET Aspire:
3685

3786
- **Automatic Rebuilding**: When you modify C# files, the application automatically rebuilds
3887
- **Browser Refresh**: Changes to Razor pages, CSS, and JavaScript trigger automatic browser refresh
3988
- **Content Updates**: Adding or modifying content files will be reflected in the application
89+
- **Service Orchestration**: All services (Web, Redis, Storage) are managed together
4090

4191
### Commands
4292

43-
- `dotnet watch run --project Web`: Start the application with hot reload
44-
- `dotnet watch test`: Run tests with automatic re-execution when code changes
45-
- `dotnet watch build`: Build with automatic rebuilding when code changes
93+
- `dotnet run --project AppHost`: Start the full application stack
94+
- `dotnet watch run --project AppHost`: Start with enhanced hot reload monitoring
95+
- `dotnet test`: Run tests for the entire solution
96+
97+
### Service Dependencies
98+
99+
The Aspire orchestration ensures proper startup order:
100+
1. Redis container starts and becomes ready
101+
2. Azure Storage emulator starts and becomes ready
102+
3. Web application starts and connects to dependencies
46103

47104
## Code Organization
48105

docs/overview.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ As the name suggests, "Copilot That Jawn" incorporates Philadelphia terminology
3636

3737
## Technology Stack
3838

39-
- **Framework**: ASP.NET Core 9.0+ with Razor Pages
40-
- **Architecture**: Razor Pages application with MVC controllers for complex operations
39+
- **Framework**: ASP.NET Core 9.0+ with .NET Aspire cloud-native stack
40+
- **Service Orchestration**: .NET Aspire AppHost for managing Redis, Azure Storage, and web application
41+
- **Caching**: Redis distributed caching with multi-layer caching strategy
4142
- **Content Storage**: Markdown files in Content/ directory processed with Markdig
4243
- **Frontend**: Bootstrap 5, modern responsive design with CSS Grid/Flexbox
4344
- **JavaScript**: Vanilla JS with modern ES6+ features, minimal dependencies
45+
- **Observability**: Built-in logging, metrics, and distributed tracing through Aspire

0 commit comments

Comments
 (0)