feat: /src clean architecture scaffold — Core, Application, Infrastructure, Cloud, EdgeAgent, UI (Phase 1–3, 5–7)#22
Conversation
…, Cloud, EdgeAgent, Tests.Unit Agent-Logs-Url: https://github.com/akinbender/MakerPrompt/sessions/b6160242-d611-4cd5-aefd-669f3ced06f5 Co-authored-by: akinbender <40242943+akinbender@users.noreply.github.com>
…se Task.Run for telemetry persistence Agent-Logs-Url: https://github.com/akinbender/MakerPrompt/sessions/b6160242-d611-4cd5-aefd-669f3ced06f5 Co-authored-by: akinbender <40242943+akinbender@users.noreply.github.com>
|
@copilot # Agent Task: Complete Project Restructure with Logical Improvements You are a senior .NET architect tasked with fully restructuring the MakerPrompt project. The repository began as a single-client desktop app, but it has since evolved into a cross-platform 3D print farm solution. Your task is to create a brand-new project structure inside the existing repository under a new Do not keep old code unless it logically fits—this is a full rethink. Steps
|
… infrastructure stores, 50 new unit tests Agent-Logs-Url: https://github.com/akinbender/MakerPrompt/sessions/49d91096-22a4-435b-ad0d-36a1b88eb29e Co-authored-by: akinbender <40242943+akinbender@users.noreply.github.com>
Done in commits
Key architectural improvements made:
|
|
@copilot oki whats next? |
Here's what's left to complete the full restructure, in priority order: Phase 3 — Blazor UI project under Phase 4 — Notification service + remaining application services Phase 5 — EdgeAgent: camera / webcam support Phase 6 — Cloud API: authentication + member access Phase 7 — MAUI host under Want me to start on Phase 3 (the Blazor UI project)? |
|
@copilot lets do phase 3&7 with updated infra. MAUI Serial backend is so important dont mess up pls!! |
…/ serial, Cloud OIDC auth" Agent-Logs-Url: https://github.com/akinbender/MakerPrompt/sessions/905d1ff3-25bd-41d3-91f1-5bc466640ec6 Co-authored-by: akinbender <40242943+akinbender@users.noreply.github.com>
…D truncation Agent-Logs-Url: https://github.com/akinbender/MakerPrompt/sessions/905d1ff3-25bd-41d3-91f1-5bc466640ec6 Co-authored-by: akinbender <40242943+akinbender@users.noreply.github.com>
Done in commits Phase 3 —
Phase 7 —
Phase 6 — Cloud OIDC/JWT
|
|
@copilot implement phase 5 and phase 6 for SQLlite and InfluxDB as possible providers |
…DB stores, 82 tests Agent-Logs-Url: https://github.com/akinbender/MakerPrompt/sessions/1706cabd-c655-4242-a826-7f439d624e29 Co-authored-by: akinbender <40242943+akinbender@users.noreply.github.com>
Done in commit Phase 5 — Camera abstraction
Phase 6 persistence — SQLite + InfluxDB
Swap the store at DI registration in EdgeAgent Tests: 82 total (15 new) — |
|
@copilot did you also consider tests for the newly implemented code? |
Yes — 15 new tests were added alongside the Phase 5/6 code (commit
Each SQLite test uses a |
MakerPrompt has grown organically into a multi-backend printer farm ecosystem but lacks the architectural layering to support distributed scenarios (local edge agents, cloud telemetry, multi-printer providers). This PR creates a clean, additive
/srcfoundation alongside the existing projects — no existing code is deleted or modified.New projects
MakerPrompt.CoreMakerPrompt.ApplicationMakerPrompt.InfrastructureSerialCommunicationServiceBasefor Marlin G-code printers andMjpegCameraProviderfor webcam capture.MakerPrompt.Infrastructure.SqliteITelemetryStoreandICameraSnapshotStorevia rawMicrosoft.Data.SqliteMakerPrompt.Infrastructure.InfluxDbITelemetryStoreusingInfluxDB.Client 5.0.0— Line Protocol ingest, Flux queriesMakerPrompt.CloudMakerPrompt.EdgeAgentMakerPrompt.UI.ComponentsMakerPrompt.UI.BlazorMakerPrompt.UI.MAUIMakerPrompt.Tests.UnitKey architectural distinction formalized
The existing codebase conflated fleet enumeration with printer control. Core now makes this explicit:
Domain models migrated to Core
FilamentSpool,PrintJobUsageRecord,PrintProject/PrintJob,FarmConfiguration/PrinterConnectionDefinition,NotificationRecordCameraSnapshot— domain model for webcam/MJPEG frames (CameraId, Label, JpegData, Width, Height, CapturedAt)New Core abstractions
IFilamentInventoryStore— spool CRUD + deduction (clamped, never negative)IPrintJobAnalyticsStore— record storage + per-printer / per-spool queriesIPrintProjectRepository— project CRUD + G-code file storageIFarmRepository— farm profile CRUDICameraProvider—CaptureSnapshotAsync,CheckAvailabilityAsync,IsAvailableICameraSnapshotStore—SaveAsync,GetLatestAsync,GetHistoryAsyncApplication services (migrated and improved from MakerPrompt.Shared)
FilamentInventoryService— inventory management with deduction business rule and change eventsAnalyticsService— total print-time and filament aggregation per printer/spoolPrintProjectService— project CRUD, job lifecycle (queue → print → complete/fail), G-code file dispatchFarmService— farm profiles, printer snapshots, JSON export/importSerial communication infrastructure (Phase 7)
SerialCommunicationServiceBaseinMakerPrompt.Infrastructure.Serialimplements the fullIPrinterCommunicationServicecontract for Marlin/RepRap firmware printers:protected const int DefaultBaudRate = 250_000shared by all platform implementationsMakerPrompt.UI.MAUI/Services/SerialCommunicationServiceis a partial class with per-platform transport implementations:System.IO.Ports.SerialPortwith async send/receive loopsUsbSerialForAndroid.NetdriverUsbSerialForMacOSdriverPlatformNotSupportedExceptionstubCamera / webcam support (Phase 5)
MjpegCameraProviderin Infrastructure handles both plainimage/jpegsnapshot endpoints andmultipart/x-mixed-replaceMJPEG streams (first JPEG frame extracted via SOI/EOI byte marker scan).InMemoryCameraSnapshotStoreuses a bounded ring buffer; history queries strip JPEG blobs to keep memory bounded.CameraPollingWorkerin EdgeAgent reads camera entries fromappsettings.json(EdgeAgent:Cameras[]), checks availability at startup, and captures on a configurableCameraIntervalSecondsinterval.Cloud API camera endpoints:
POST /api/camera/{id}/snapshot— EdgeAgent ingest (requiresmakerprompt:ingestscope)GET /api/camera/{id}/latest— returns rawimage/jpegbytes (MemberRead auth)GET /api/camera/{id}/history— metadata array without JPEG blobs (MemberRead auth)UI layer (Phase 3)
MakerPrompt.UI.Componentsis a Razor Class Library that depends only on Core + Application (no Infrastructure coupling). It contains:MakerPrompt.UI.Blazor(WASM host) andMakerPrompt.UI.MAUI(BlazorWebView host) both reference UI.Components and compose all layers via DI.Cloud API authentication (Phase 6)
MakerPrompt.CloudusesMicrosoft.AspNetCore.Authentication.JwtBearerwith OIDC-compatible configuration:MakerPrompt:Auth:Authority/MakerPrompt:Auth:Audience(appsettings or environment)EdgeAgentpolicy — requiresmakerprompt:ingestscope (machine-to-machine token); protects telemetry and camera ingest endpointsMemberReadpolicy — any authenticated user; protects telemetry and camera read endpoints/healthstays anonymousAuthorityis not configuredPersistence providers (Phase 6)
Two swappable
ITelemetryStoreimplementations replace the in-memory default in production:MakerPrompt.Infrastructure.SqliteSqliteTelemetryStore— JSON payload column for forward-compatible, schema-free telemetry rowsSqliteCameraSnapshotStore— BLOB column for JPEG data; metadata-only history queriesMicrosoft.Data.Sqlite; fully async (OpenAsyncthroughout); schema initialised on constructionMakerPrompt.Infrastructure.InfluxDbInfluxDbTelemetryStoreusingInfluxDB.Client 5.0.0EscapeFlux()Register either provider at the DI composition root in EdgeAgent or Cloud — no Core or Application changes required.
Dependency graph
Infrastructure (in-memory, Sqlite, InfluxDb) references only Core (clean arch rule enforced). Cloud, EdgeAgent, and UI hosts compose all layers.
Migration strategy
Old projects (
MakerPrompt.Shared,MakerPrompt.Blazor,MakerPrompt.MAUI) coexist unchanged during incremental migration. The solution file includes both old and new projects grouped under asrcsolution folder.Original prompt
Agent Task — Full Repository Audit + Architecture Restructure
You are a senior .NET software architect working on the MakerPrompt repository.
The project started as a replacement for an old application called Pronterface, but it evolved into a much larger cross-platform 3D printer farm ecosystem.
The current repository contains:
The codebase has grown organically and now requires a proper restructuring.
This is NOT a cosmetic refactor.
This is a controlled architectural rebuild while preserving working functionality.
Primary Goal
Create a new architecture inside the existing repository under: