Dotnet6.GraphQL4.WebApplication
This project exemplifies the implementation and dockerization of a simple Razor Web MVC Core consuming a full GraphQL 4 Web API, build in a .NET 6 multi-layer project, considering development best practices, like SOLID and DRY, applying Domain-Driven concepts in a Onion Architecture.
Install / Use
/learn @AntonioFalcaoJr/Dotnet6.GraphQL4.WebApplicationREADME
Dotnet6.GraphQL4.WebApplication
This project exemplifies the implementation and dockerization of a simple Razor Web MVC Core consuming a full GraphQL 4 Web API, build in a .NET 6 multi-layer project, considering development best practices, like SOLID, KISS and DRY, applying Domain-Driven concepts in a Onion Architecture.
Give a Star! :star:
|WebAPI|
|:----:|
|
|
|WebMVC|
|
|
Oldest version: Dotnet5.GraphQL3.WebApplication
|WebAPI||
|:----:|--- |
|WebMVC|
|

Running
Development (secrets)
To configure database resource, init secrets in ./src/Dotnet6.GraphQL4.Store.WebAPI, and then define the DefaultConnection:
dotnet user-secrets init
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "Server=localhost,1433;Database=Store;User=sa;Password=!MyComplexPassword"
After this, to configure the HTTP client, init secrets in ./src/Dotnet6.GraphQL4.Store.WebMVC and define Store client host:
dotnet user-secrets init
dotnet user-secrets set "HttpClient:Store" "http://localhost:5000"
AppSettings
If you prefer, is possible to define it on WebAPI appsettings.Development.json and WebMVC appsettings.Development.json files:
WebAPI
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost,1433;Database=Store;User=sa;Password=!MyComplexPassword"
}
}
WebMCV
{
"HttpClient": {
"Store": "http://localhost:5000"
}
}
Production
Considering use Docker for CD (Continuous Deployment). On respective compose both web applications and sql server are in the same network, and then we can use named hosts. Already defined on WebAPI appsettings.json and WebMVC appsettings.json files:
AppSettings
WebAPI
{
"ConnectionStrings": {
"DefaultConnection": "Server=mssql;Database=Store;User=sa;Password=!MyComplexPassword"
}
}
WebMCV
{
"HttpClient": {
"Store": "http://webapi:5000"
}
}
Docker
The ./docker-compose.yml provide the WebAPI, WebMVC and MS SQL Server applications:
docker-compose up -d
It's possible to run without a clone of the project using the respective compose:
version: "3.7"
services:
mssql:
container_name: mssql
image: mcr.microsoft.com/mssql/server
ports:
- 1433:1433
environment:
SA_PASSWORD: "!MyComplexPassword"
ACCEPT_EULA: "Y"
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$$SA_PASSWORD" -Q "SELECT 1" || exit 1
interval: 10s
timeout: 3s
retries: 10
start_period: 10s
networks:
- graphqlstore
webapi:
container_name: webapi
image: antoniofalcaojr/dotnet6-graphql4-webapi
environment:
- ASPNETCORE_URLS=http://*:5000
ports:
- 5000:5000
depends_on:
mssql:
condition: service_healthy
networks:
- graphqlstore
webmvc:
container_name: webmvc
image: antoniofalcaojr/dotnet6-graphql4-webmvc
environment:
- ASPNETCORE_URLS=http://*:7000
ports:
- 7000:7000
depends_on:
- webapi
networks:
- graphqlstore
healthchecks:
container_name: healthchecks-ui
image: xabarilcoding/healthchecksui
depends_on:
mssql:
condition: service_healthy
environment:
- storage_provider=SqlServer
- storage_connection=Server=mssql;Database=Store;User=sa;Password=!MyComplexPassword
- Logging:LogLevel:Default=Debug
- Logging:Loglevel:Microsoft=Warning
- Logging:LogLevel:HealthChecks=Debug
- HealthChecksUI:HealthChecks:0:Name=webapi
- HealthChecksUI:HealthChecks:0:Uri=http://webapi:5000/healthz
- HealthChecksUI:HealthChecks:1:Name=webmvc
- HealthChecksUI:HealthChecks:1:Uri=http://webmvc:7000/healthz
ports:
- 8000:80
networks:
- graphqlstore
networks:
graphqlstore:
driver: bridge
GraphQL Playground
By default Playground respond at http://localhost:5000/ui/playground but is possible configure the host and many others details in ../DependencyInjection/Extensions/ApplicationBuilderExtensions.cs
app.UseGraphQLPlayground(
options: new()
{
BetaUpdates = true,
RequestCredentials = RequestCredentials.Omit,
HideTracingResponse = false,
EditorCursorShape = EditorCursorShape.Line,
EditorTheme = EditorTheme.Dark,
EditorFontSize = 14,
EditorReuseHeaders = true,
EditorFontFamily = "JetBrains Mono"
},
path: "/ui/playground");
Health checks
Based on cloud-native concepts, Readiness and Liveness integrity verification strategies were implemented.
/health
Just check if the instance is running.
/health/live
Check if the instance is running and all the dependencies too.
/health/ready
Check if the instance and all the dependencies are ready to attend to all functionalities.
Web API
http://localhost:5000/health/ready
{
"status": "Healthy",
"totalDuration": "00:00:00.2344435",
"entries": {
"Sql Server (Ready)": {
"data": {},
"duration": "00:00:00.2251420",
"status": "Healthy",
"tags": [
"ready"
]
}
}
}
Web MVC
http://localhost:7000/health/ready

Dump configuration
It is possible to dump the state of the environment configuration in through the middleware resource /dump-config in both applications.
public void Configure(IApplicationBuilder app)
{
app.UseEndpoints(endpoints =>
{
endpoints.MapDumpConfig(
pattern: "/dump-config",
configurationRoot: _configuration as IConfigurationRoot,
isProduction: _env.IsProduction());
});
}
Highlights
UnitOfWork + Execution Strategy + Transaction Scope
The implementation of the UnitOfWork gives support to the `Exec
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
Languages
Security Score
Audited on Nov 5, 2025
