For architectural / AI design and RAG strategy details see AI-for-Dummies.
Quick anchors: Vision · Current RAG Wiring · Gap Analysis · Immediate Next Steps · Migration Path
Additional docs: Server CHANGELOG · Client CHANGELOG · Deployment Setup · Env Setup (Client) · Project Setup Tool · WebDeploy Guide
Vision (condensed): Upload / manage multiple books, take study notes referencing chapter + paragraph, query own + subscribed notes, get grounded answers with citations. Extensible, pluggable storage & vector layers, clean ingestion → enrichment → retrieval → answer pipeline.
Current RAG Wiring (summary)
builder.Services.AddSingleton<IBookDocumentStore, InMemoryBookDocumentStore>();
builder.Services.AddSingleton(typeof(IDocumentStore<>), typeof(InMemoryDocumentStore<>) );
builder.Services.AddSingleton<IChunker<BookDocument, BookChunk>, ParagraphChunker>();
builder.Services.AddSingleton<IVectorIndex, InMemoryVectorIndex>();
builder.Services.AddSingleton<IAdvancedRagService, HybridRagService>();
- In-memory stores & vector index (prototype).
- Paragraph-based chunking.
- HybridRagService orchestrates: chunk ensure -> (naive) embed+score -> prompt with citations.
Key Gaps (abbrev): embedding reuse, real ANN vector search, multi‑corpus (notes), access control, citations richness, caching, reranking, observability, background indexing.
Immediate Next Steps (top 5):
- Persist chunk embeddings in vector index.
- Add notes corpus (NoteDocument + store).
- Ownership / visibility metadata + filters.
- Real vector backend (pgvector / Azure AI Search / Qdrant).
- Reranking & richer citations.
Migration Path (snapshot)
Prototype → +Persisted Embeddings → +Notes & ACL → +Real Vector Search → +Hybrid+Rerank → +Background Indexing & Streaming
A hybrid framework notepad application built with .NET Aspire, ASP.NET Core Web API, Angular, and a resilient FTP blue/green deployment utility. This project was generated as an exercise in AI-assisted development using GitHub Copilot.
▶ Watch the setup video (demonstrates hybrid capabilities)
MIT License - see LICENSE file for details.
This solution now includes:
- NotebookAI.Server (former ApiService) – ASP.NET Core Web API (.NET 9) with Auth0 authentication.
- Angular Client (notebookai.client) – SPA front-end with Auth0 integration.
- Adventures.Shared – Shared utilities library (FTP abstraction, logging, retry policies, connection pooling, progress reporting).
- NotebookAI.Ftp – Stand‑alone deployment console using blue/green (slot) strategy with automatic rollback and health checks.
- Aspire AppHost & ServiceDefaults – Orchestration and standardized service configuration.
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Angular Web │ │ ASP.NET Core │ │ Auth0 │
│ Client │◄──►│ Web API │◄──►│ Authentication │
│ │ │ │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
│ Health / Notes API │
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ Aspire App │ │ In-Memory │
│ Host │ │ Database │
└─────────────────┘ └──────────────────┘
▲
│ Deployment (Blue/Green via FTP)
▼
┌─────────────────┐
│ FTP Deployment │ (NotebookAI.Ftp + Adventures.Shared)
│ Slots: base │
│ slot1 │ (staging)
│ slot2 │ (backup/rollback)
└─────────────────┘
- Robust FTP Abstraction:
IFtpClientAsyncwith FluentFTP implementation (FluentFtpClientAsync).- Connection lifecycle, existence checks, metadata, single & directory upload/download, recursive delete, move/rename, parallel batching, progress callbacks.
- Polly-based retries with exponential wait (configurable pattern ready).
- Connection Pooling: Scoped lifetime pooling (
PooledFtpClientAsync) with configurablePoolSize(default 8). - Dependency Injection Extensions:
AddFtp(...)forIServiceCollection,HostApplicationBuilder,IHostBuilder(and optionalWebApplicationBuildervia symbol) with options binding. - Blue/Green Deployment Utility (
NotebookAI.Ftp):- Uploads new build to staging slot (slot1).
- Validates staging (ensures files exist) before touching production.
- Backs up current production to backup slot (slot2) with rollback if partial moves fail.
- Promotes staging to production.
- Post-deploy health checks (configurable required files) – automatic rollback if failed.
- Cleans staging only after successful health & promotion.
- Progress logging via
ILogger+IProgress<FtpProgress>. - Parallel-friendly design (ready to leverage explicit parallel file upload if needed).
- Automatic Rollback: Restores contents from backup slot if validation or health fails.
- Progress & Logging: Unified structured logging (can replace logger in DI to adapt output, e.g., console UI or telemetry).
- Configuration Driven: FTP credentials & remote folder from user secrets / config section
Ftp.
Example UserSecrets (already supported):
"Ftp": {
"host": "your-ftp-host",
"remote-folder": "/global",
"port": 21,
"username": "user",
"password": "secret",
"site-url": "https://www.example.com"
}
Optional deployment settings:
"Deployment": {
"Parallelism": 8,
"HealthCheck": {
"Paths": ["index.html", "assets/app.js"]
}
}
If Deployment:HealthCheck:Paths is omitted, the deployment tool defaults to verifying index.html exists after promotion.
# From solution root
dotnet run --project NotebookAI.Ftp <optional-path-to-built-web-dist>
If no path is supplied, it attempts to locate notebookai.client/dist/notebookai.client automatically.
Deployment phases (all safe & reversible):
- Prepare folders (base, slot1, slot2).
- Clean staging slot only.
- Upload new artifacts to slot1 with progress.
- Validate staging.
- Backup production to slot2 (rollback on failure).
- Promote slot1 → base (rollback on failure mid-move).
- Health checks (rollback to slot2 if any fail).
- Clean staging slot.
- Secure Authentication (Auth0 JWT)
- Notes CRUD with User Isolation
- Global Exception Handling & Structured Logging
- Health Monitoring (API + Deployment health checks)
- Input Validation
- AI-Ready Services (extensible for future integrations)
- Modern Angular Frontend
- Aspire Orchestration (service defaults, local diagnostics)
- .NET 9.0 SDK (solution targets net9 + net8 where noted)
- Node.js 18+
- Auth0 account (for auth)
Clone & build:
git clone https://github.com/BillKrat/copilot-notepad.git
cd copilot-notepad
Configure Auth0 (as previously documented) and set UserSecrets for FTP & Auth0.
dotnet workload install aspire
(dotnet build)
dotnet run --project NotebookAI.AppHost
# API (Server)
dotnet run --project NotebookAI.Server
# Frontend
cd notebookai.client
npm install
npm start
- Deployment health checks are file-based (existence). Extend easily to HTTP probes or content validation by adding logic in
RunHealthChecksAsync. - Rollback strategy preserves previous production state until new deployment + health succeed.
You can further customize by:
- Adding named FTP clients (multiple endpoints) via distinct option registrations.
- Injecting custom progress loggers (implement
IProgress<FtpProgress>). - Adding bandwidth throttling or checksum verification (
FtpVerifymodes) where needed. - Enhancing health checks: e.g., HTTP GET to
site-urlvalidating status 200.
- GET /api/notes
- GET /api/notes/{id}
- POST /api/notes
- PUT /api/notes/{id}
- DELETE /api/notes/{id} (All require valid Auth0 JWT.)
copilot-notepad/
├── NotebookAI.AppHost/ # Aspire orchestration
├── NotebookAI.ServiceDefaults/ # Shared service defaults
├── NotebookAI.Server/ # ASP.NET Core Web API
│ ├── Program.cs
│ └── ...
├── Adventures.Shared/ # Shared libs (FTP abstraction, pooling, retry, logging)
├── NotebookAI.Ftp/ # Deployment console (blue/green + rollback)
├── notebookai.client/ # Angular client
└── CopilotNotepad.sln # Solution file
- HTTP-based post-deploy health checks
- Content hash verification during upload
- Incremental (delta) uploads
- CDN cache purge integration
- Automated test suite for deployment logic
Never commit real secrets. Use dotnet user-secrets for local dev. Rotate credentials if exposed.
- FluentFTP
- Polly
- Auth0
- .NET Aspire Team
Generated & iteratively evolved with GitHub Copilot.