Core
Info
Architectural truth for
Corein theProjectsfeature. This leaf module contains the foundational endpoints for managing theProjectaggregate root.
Overview
In MILTON, the Project is the highest-level entity in the tenant space. Every Document, Section, ContentBlock, and Template is ultimately scoped to a Project. This feature slice handles the lifecycle and querying of projects.
Business Logic Intent
The logic in Projects/Core is straightforward and synchronous, primarily acting as a CRUD boundary over milton-db. However, it establishes the CQRS pattern used throughout the API: even synchronous HTTP endpoints delegate to Wolverine handlers via IMessageBus.InvokeAsync<T>.
When a Project is created, the system must also provision a default ProjectConfig entity. The ProjectConfig holds project-level settings such as Git repository links and LLM prompt overrides (managed in Features/ProjectConfig).
Endpoints & Flow
CreateProject: HTTP POST endpoint. DispatchesCreateProjectCommandto Wolverine.GetProjectsEndpoint: Fetches projects assigned to a specific user (via theUserIdroute param).ListProjectsEndpoint: Fetches all projects (tenant-scoped) with aggregated summary metadata (e.g., Repository count).
Sequence: Project Creation
sequenceDiagram participant Client participant Endpoint as CreateProject Endpoint participant Bus as Wolverine IMessageBus participant Handler as CreateProjectHandler participant DB as milton-db Client->>Endpoint: POST /projects { Title, Description } Endpoint->>Bus: InvokeAsync(CreateProjectCommand) Bus->>Handler: Handle(CreateProjectCommand) Handler->>DB: Check for duplicate Title alt Duplicate Exists Handler-->>Bus: return response (ProjectId = 0) Bus-->>Endpoint: CreateProjectResponse Endpoint-->>Client: 409 Conflict else Is Unique Handler->>Handler: Create Project Entity Handler->>Handler: Create default ProjectConfig Handler->>DB: Add & SaveChangesAsync() Handler-->>Bus: return response (ProjectId > 0) Bus-->>Endpoint: CreateProjectResponse Endpoint-->>Client: 200 OK end
Wolverine Contracts & Handlers
- Commands/Queries:
CreateProjectCommand,GetProjectsCommand,ListAllProjectsQuery - Handlers:
CreateProjectHandler,GetProjectsHandler,ListAllProjectsHandler
Domain Models
Project: The EF Core entity. IncludesTitle,Description, and a one-to-one relationship withProjectConfig.- Request / Response:
CreateProjectRequest,GetProjectsRequest,GetProjectResponse,CreateProjectResponse