Scaffold a feature
Work in order; later steps depend on earlier ones. Conventions come from .claude/rules/; this is the wiring.
Decide
- Tenant or master DB? Almost always tenant (
ITenantEntity). Master (IMasterEntity) is platform data like tenants and subscriptions. The marker is all the DbContext needs; noDbSet. - Module:
Operations,Compliance,Financial,Identity,Tenancy,AI,Integrations,ReportingorWebsite(see module-layout.md). - New aggregate or child of an existing one. Inherit
AuditableEntityunless it's a trivial lookup.
Backend
- Entity:
src/Core/Logistics.Domain/Entities/{Module}/{Aggregate}/{Entity}.cs, namespaceLogistics.Domain.Entities. Enums inLogistics.Domain.Primitives/Enums/{Module}/{Aggregate}/. - EF configuration:
Logistics.Infrastructure.Persistence/Configurations/{Module}/{Aggregate}/{Entity}EntityConfiguration.cs,internal sealed, auto-discovered. Enums need no conversion (stored as snake_case). Uniqueness over a complex-type member needs an injected checker (seeIIftaTaxRateDuplicateChecker). - Migration:
migration-creator, e.g.AddSubcontractor. - Commands and queries in
Logistics.Application/Modules/{Module}/{Feature}/Commands|Queries/{Name}/: request,internal sealedhandler, validator if it has real rules. Requests are flat and bound directly as the body. Delete and GetById subclassDeleteTenantEntityHandler/GetTenantEntityByIdHandler(Common/Handlers/). Lists use an inline.Query()ending inToPagedResultAsync(req, x => x.ToDto(), ct); extract anIQueryableextension only when a filter is reused. - DTO and mapper:
src/Shared/Logistics.Shared.Models/{Feature}/{Entity}Dto.cs; Mapperly mapper beside the feature, ignoring navigations. - Controller:
Logistics.API/Controllers/{Module}/{Entity}Controller.cs, plural route,[Authorize(Policy = ...)]on every action. - Permissions:
add-permission(Permission.Subcontractor.View/Manage). - Tests:
test/Logistics.Application.Tests/{Module}/{Feature}/for handlers with real logic.
Frontend
bun run gen:api:livefromprivate/src/Client/Logistics.Angular(API running).- Page via
add-angular-page, shaped likepages/trailers/:{feature}.routes.ts,{x}-list,{x}-add,{x}-edit,{x}-details, optionalstore/. Lazy-register inapp.routes.ts, add the sidebar item. - SignalR-backed data needs a
ttl: 0rule incache.config.tsbefore the catch-all.
Finish
If any layer's name or location breaks the convention, add a row to .claude/feature-map.md. dotnet build, bun run lint, then exercise it end to end in the running app.