Monolith
Monolith recipe is the default backend recipe provided by Baked which includes necessary layers and feature implementations for any backend application.
To create an application from this recipe, use Monolith() extension of Bake
class directly in Program.cs.
Bake.New
.Monolith(
business: c => c.DomainAssemblies([...])
)
.Run();
Changing Defaults
Use options: to change a default feature of this recipe, or to add a theme
which also adds the UI layer;
Bake.New
.Monolith(
business: c => c.DomainAssemblies([...]),
options: o =>
{
o.Database(c => c.PostgreSql());
o.Theme(c => c.Default(index: r => r.Index(), routes: [...]));
}
)
.Run();
Default database is SQLite, which requires
Database:Sqlite:FileNamesetting unless a file name is given, e.g.,o.Database(c => c.Sqlite("app.db"))
Layers
| Name | Run | Test |
|---|---|---|
| Buildtime | ✅ | ✅ |
| Data Access | ✅ | ✅ |
| Domain | ✅ | ✅ |
| HTTP Client | ✅ | ⛔ |
| HTTP Server | ✅ | ⛔ |
| Rest API | ✅ | ⛔ |
| Runtime | ✅ | ✅ |
| Testing | ⛔ | ✅ |
| UI | ✅ (When Theme Set) | ⛔ |
Features
When Test column have ✅ without a note, this means it inherits whatever Run column denotes.
Phase Execution Order
flowchart LR;
subgraph Generate
AD(AddDomainTypes)
BD(BuildDomainModel)
G(Generate)
C(Compile)
AD -->|IDomainTypeCollection| BD
BD -->|DomainModel| G
G -->|IGeneratedAssemblyCollection<br/>IGeneratedFileCollection| C
end
subgraph Start
CB(CreateBuilder)
BC(BuildConfiguration)
AS(AddServices)
B(Build)
PB(PostBuild)
R(Run)
CB -->|ConfigurationManager<br/>WebApplicationBuilder| BC
BC -->|GeneratedContext| AS
AS -->|IServiceCollection| B
B -->|IServiceProvider<br/>WebApplication| PB
PB --> R
end
Generate --> Start
Convention Order Matrix
flowchart LR
BIA(Infra)
BDA(Defaults)
BOA(Override)
BIC(Infra)
BDC(Defaults)
BOC(Override)
TIA(Infra)
TDA(Defaults)
TOA(Override)
TIC(Infra)
TDC(Defaults)
TOC(Override)
subgraph Business
direction LR
subgraph BA[Add]
direction TD
BIA --> BDA --> BOA
end
subgraph BC[Configure]
direction TD
BIC --> BDC --> BOC
end
end
subgraph Theme
direction LR
subgraph TA[Add]
direction TD
TIA --> TDA --> TOA
end
subgraph TC[Configure]
direction TD
TIC --> TDC --> TOC
end
end
BA --> BC
TA --> TC
Business --> Theme