Initial project setup: Next.js frontend + .NET 9 backend

- Frontend: Next.js 16 + shadcn/ui + Tailwind CSS 4
- Backend: .NET 9 Web API with Npgsql health check
- Docker Compose for prod and dev environments
- Woodpecker CI pipeline for auto-deploy
- Health check endpoints for E2E testing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 15:39:37 +02:00
commit d307a3fbad
37 changed files with 13016 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
using Microsoft.AspNetCore.Mvc;
using Npgsql;
namespace GBSite.Api.Controllers;
[ApiController]
[Route("api/[controller]")]
public class HealthController : ControllerBase
{
private readonly IConfiguration _configuration;
public HealthController(IConfiguration configuration)
{
_configuration = configuration;
}
[HttpGet]
public async Task<IActionResult> Get()
{
var connectionString = _configuration.GetConnectionString("Default");
var dbStatus = "not configured";
if (!string.IsNullOrEmpty(connectionString))
{
try
{
await using var conn = new NpgsqlConnection(connectionString);
await conn.OpenAsync();
await using var cmd = new NpgsqlCommand("SELECT 1", conn);
await cmd.ExecuteScalarAsync();
dbStatus = "connected";
}
catch (Exception ex)
{
dbStatus = $"error: {ex.Message}";
}
}
return Ok(new
{
status = "healthy",
database = dbStatus,
environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "unknown"
});
}
[HttpGet("ping")]
public IActionResult Ping()
{
return Ok(new { status = "pong" });
}
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.4" />
<PackageReference Include="Npgsql" Version="10.0.1" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,6 @@
@GBSite.Api_HostAddress = http://localhost:5224
GET {{GBSite.Api_HostAddress}}/weatherforecast/
Accept: application/json
###

View File

@@ -0,0 +1,15 @@
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddOpenApi();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.MapControllers();
app.Run();

View File

@@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5224",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}