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

25
.gitignore vendored Normal file
View File

@@ -0,0 +1,25 @@
# Frontend
frontend/node_modules/
frontend/.next/
frontend/out/
# Backend
backend/src/*/bin/
backend/src/*/obj/
# Environment
.env
.env.local
.env.production.local
.env.development.local
# IDE & Tools
.vs/
.vscode/
.claude/
*.swp
*.swo
# OS
Thumbs.db
.DS_Store

32
.woodpecker/deploy.yml Normal file
View File

@@ -0,0 +1,32 @@
when:
branch: [main, dev]
event: push
steps:
- name: deploy-prod
image: appleboy/drone-ssh
when:
branch: main
settings:
host: 31.131.18.254
username: deploy
key:
from_secret: ssh_key
script:
- cd /srv/apps/gb-site && git pull origin main
- cd /srv/apps/gb-site/deploy && docker compose -f docker-compose.prod.yml build --no-cache
- cd /srv/apps/gb-site/deploy && docker compose -f docker-compose.prod.yml up -d
- name: deploy-dev
image: appleboy/drone-ssh
when:
branch: dev
settings:
host: 31.131.18.254
username: deploy
key:
from_secret: ssh_key
script:
- cd /srv/apps/gb-site && git pull origin dev
- cd /srv/apps/gb-site/deploy && docker compose -f docker-compose.dev.yml build --no-cache
- cd /srv/apps/gb-site/deploy && docker compose -f docker-compose.dev.yml up -d

94
README.md Normal file
View File

@@ -0,0 +1,94 @@
# GoodBrick Project
Корпоративная инфраструктура для компании GoodBrick на базе self-hosted сервисов.
## 🚀 Deployed Services
| Service | URL | Status | Purpose |
|---------|-----|--------|---------|
| **Gitea** | https://git.goodbrick.com.ua | ✅ Running | Git сервер |
| **Uptime Kuma** | https://status.goodbrick.com.ua | ✅ Running | Мониторинг |
| **Woodpecker CI** | https://ci.goodbrick.com.ua | ✅ Running | CI/CD |
| **Production App** | https://new.goodbrick.com.ua | 🔨 TODO | Продакшн приложение |
| **Development App** | https://dev.goodbrick.com.ua | 🔨 TODO | Dev окружение |
## 📚 Documentation
- **[SERVER.md](./SERVER.md)** - Полная документация по серверу, сервисам, Docker, базам данных и troubleshooting
## 🖥️ Server Info
- **Host:** 31.131.18.254
- **SSH:** `ssh deploy@31.131.18.254` (key-based auth)
- **OS:** Linux
- **Docker Network:** `app-network`
## 🗄️ Databases
PostgreSQL 16 с отдельными базами для каждого сервиса:
- `gitea_db` - Gitea
- `prod_db` - Production app
- `dev_db` - Development app
Все credentials в `/srv/postgres/CREDENTIALS.txt` на сервере.
## 🔧 Stack
- **Reverse Proxy:** Caddy 2 (автоматический SSL)
- **Database:** PostgreSQL 16
- **Git:** Gitea
- **CI/CD:** Woodpecker CI
- **Monitoring:** Uptime Kuma
- **Container:** Docker + Docker Compose
## 📝 Quick Commands
### SSH в сервер
```bash
ssh deploy@31.131.18.254
```
### Просмотр всех контейнеров
```bash
ssh deploy@31.131.18.254 'docker ps'
```
### Просмотр логов
```bash
ssh deploy@31.131.18.254 'docker logs <container_name> --tail 50'
```
### Рестарт сервиса
```bash
ssh deploy@31.131.18.254 'cd /srv/<service> && docker compose restart'
```
## 🏗️ Project Structure
```
C:\Work\goodbrick\GBSite\
├── README.md ← Этот файл
├── SERVER.md ← Полная документация сервера
└── [project files] ← Файлы проектов
```
## 🔐 Security
- SSH: Только key-based аутентификация
- PostgreSQL: Изолированные пользователи для каждого приложения
- Docker: Все сервисы в изолированной сети `app-network`
- SSL: Автоматические сертификаты через Let's Encrypt
## 🎯 Next Steps
1. Deploy production app на `new.goodbrick.com.ua`
2. Deploy development app на `dev.goodbrick.com.ua`
3. Настроить CI/CD пайплайны в Woodpecker
4. Настроить email для Gitea
5. Настроить автобэкапы баз данных
---
**Документация актуальна на:** 2026-02-09
**Разработчик:** Ivan
**AI Assistant:** Claude Sonnet 4.5

422
SERVER.md Normal file
View File

@@ -0,0 +1,422 @@
# GoodBrick Server Infrastructure
## SSH Access
- **Host:** 31.131.18.254
- **User:** deploy
- **Auth:** SSH key (already configured, no password needed)
- **Command:** `ssh deploy@31.131.18.254`
## Server Structure
### Base Directory: `/srv`
```
/srv/
├── apps/ # Empty, ready for applications
├── gitea/ # Git server
├── postgres/ # PostgreSQL database
├── proxy/ # Caddy reverse proxy
├── uptime-kuma/ # Status monitoring
└── woodpecker/ # CI/CD server
```
## Docker Network
- **Network name:** `app-network` (external, shared)
- All services connected to this network
- Containers communicate by name (e.g., `postgres`, `gitea`, `caddy`)
## Live Services
### Production URLs
- **Gitea:** https://git.goodbrick.com.ua
- **Uptime Kuma:** https://status.goodbrick.com.ua
- **Woodpecker CI:** https://ci.goodbrick.com.ua ✅ Working!
- **Production App:** https://new.goodbrick.com.ua (TODO)
- **Development App:** https://dev.goodbrick.com.ua (TODO)
All domains point to `31.131.18.254` via A records.
---
## Service Details
### 1. Caddy (Reverse Proxy)
- **Location:** `/srv/proxy`
- **Container:** `caddy`
- **Image:** `caddy:2`
- **Ports:** 80, 443 (public)
- **Config:** `/srv/proxy/Caddyfile`
- **SSL:** Automatic via Let's Encrypt
#### Caddyfile Routes
```caddyfile
git.goodbrick.com.ua {
reverse_proxy gitea:3000
}
status.goodbrick.com.ua {
reverse_proxy uptime-kuma:3001
}
ci.goodbrick.com.ua {
reverse_proxy woodpecker-server:8000 {
flush_interval -1 # For SSE support
}
}
new.goodbrick.com.ua {
reverse_proxy new:3000
}
dev.goodbrick.com.ua {
reverse_proxy dev:3000
}
```
**Important Notes:**
- Use container names (not `127.0.0.1` or `localhost`)
- `flush_interval -1` required for Woodpecker's Server-Sent Events
**Restart:**
```bash
ssh deploy@31.131.18.254 'cd /srv/proxy && docker compose restart'
```
---
### 2. PostgreSQL
- **Location:** `/srv/postgres`
- **Container:** `postgres`
- **Image:** `postgres:16`
- **Port:** 127.0.0.1:5432 (localhost only)
- **Data:** `/srv/postgres/data`
- **Credentials:** `/srv/postgres/CREDENTIALS.txt` (chmod 600)
#### Master Admin
```
Host: postgres:5432 (from containers) or 127.0.0.1:5432 (from host)
User: app
Password: zYWT5JWu3iAbbW7mOyd1
Database: app
```
#### Application Databases
**Gitea:**
```
User: gitea_user
Password: gitea_pass_zYWT5JWu3iAbbW7m
Database: gitea_db
Connection String: postgres://gitea_user:gitea_pass_zYWT5JWu3iAbbW7m@postgres:5432/gitea_db
```
**Production App:**
```
User: prod_user
Password: prod_pass_kL9mN2pQ7xR8sT4v
Database: prod_db
Connection String: postgres://prod_user:prod_pass_kL9mN2pQ7xR8sT4v@postgres:5432/prod_db
```
**Development App:**
```
User: dev_user
Password: dev_pass_vB6nM3qP8yW2rT9k
Database: dev_db
Connection String: postgres://dev_user:dev_pass_vB6nM3qP8yW2rT9k@postgres:5432/dev_db
```
**Important:**
- Each app has its own isolated database and user
- Users cannot access other databases
- PostgreSQL only accessible via Docker network
**Restart:**
```bash
ssh deploy@31.131.18.254 'cd /srv/postgres && docker compose restart'
```
---
### 3. Gitea (Git Server)
- **Location:** `/srv/gitea`
- **Container:** `gitea`
- **Image:** `gitea/gitea:latest`
- **URL:** https://git.goodbrick.com.ua
- **Admin:** admin (set during installation)
- **Ports:**
- 127.0.0.1:3002:3000 (HTTP)
- 127.0.0.1:2222:22 (SSH)
- **Database:** gitea_db (PostgreSQL)
- **Data:** `/srv/gitea/data`
#### OAuth Application for Woodpecker
- **Client ID:** 157422cf-7391-4fb0-8f2d-27083676dda6
- **Redirect URI:** https://ci.goodbrick.com.ua/authorize
**Config:**
```yaml
environment:
- GITEA__server__DOMAIN=git.goodbrick.com.ua
- GITEA__server__ROOT_URL=https://git.goodbrick.com.ua/
- GITEA__webhook__ALLOWED_HOST_LIST=* # Allows webhooks to Woodpecker
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=postgres:5432
- GITEA__database__NAME=gitea_db
- GITEA__database__USER=gitea_user
```
**Restart:**
```bash
ssh deploy@31.131.18.254 'cd /srv/gitea && docker compose restart'
```
---
### 4. Uptime Kuma (Monitoring)
- **Location:** `/srv/uptime-kuma`
- **Container:** `uptime-kuma`
- **Image:** `louislam/uptime-kuma:2`
- **URL:** https://status.goodbrick.com.ua
- **Port:** 127.0.0.1:3001:3001
- **Data:** `/srv/uptime-kuma/data`
**Restart:**
```bash
ssh deploy@31.131.18.254 'cd /srv/uptime-kuma && docker compose restart'
```
---
### 5. Woodpecker CI ✅
- **Location:** `/srv/woodpecker`
- **Containers:** `woodpecker-server`, `woodpecker-agent`
- **Image:** `woodpeckerci/woodpecker-server:latest` (v2.8.3), `woodpeckerci/woodpecker-agent:latest`
- **URL:** https://ci.goodbrick.com.ua
- **Port:** 127.0.0.1:8000:8000
- **Data:** `/srv/woodpecker/data`
**Config:**
```yaml
environment:
# Server
- WOODPECKER_OPEN=true
- WOODPECKER_HOST=https://ci.goodbrick.com.ua
- WOODPECKER_GITEA=true
- WOODPECKER_GITEA_URL=https://git.goodbrick.com.ua
- WOODPECKER_GITEA_CLIENT=157422cf-7391-4fb0-8f2d-27083676dda6
- WOODPECKER_GITEA_SECRET=gto_2r3udrnmvtebt37v35bzl375eq5bumxqu2dpwwdfflbumnp5fy7q
- WOODPECKER_AGENT_SECRET=supersecrettoken123
- WOODPECKER_ADMIN=admin
# Agent
- WOODPECKER_SERVER=woodpecker-server:9000
- WOODPECKER_AGENT_SECRET=supersecrettoken123
```
**Status:** ✅ Working! Login with Gitea account.
**Important Notes:**
- Uses OAuth authentication via Gitea
- Agent connects to server on port 9000 (gRPC)
- Agent has access to Docker socket for running builds
- Version 2.8.3 fixes JavaScript security issues (v2.7.2 had SES errors)
**Restart:**
```bash
ssh deploy@31.131.18.254 'cd /srv/woodpecker && docker compose restart'
```
---
## Common Commands
### View all containers
```bash
ssh deploy@31.131.18.254 'docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"'
```
### View container logs
```bash
ssh deploy@31.131.18.254 'docker logs <container_name> --tail 50'
ssh deploy@31.131.18.254 'docker logs <container_name> -f' # Follow logs
```
### Restart a service
```bash
ssh deploy@31.131.18.254 'cd /srv/<service> && docker compose restart'
```
### Restart all services
```bash
ssh deploy@31.131.18.254 'cd /srv/postgres && docker compose restart && \
cd /srv/gitea && docker compose restart && \
cd /srv/uptime-kuma && docker compose restart && \
cd /srv/woodpecker && docker compose restart && \
cd /srv/proxy && docker compose restart'
```
### Access PostgreSQL CLI
```bash
ssh deploy@31.131.18.254 'docker exec -it postgres psql -U app -d app'
```
### Check Docker network
```bash
ssh deploy@31.131.18.254 'docker network inspect app-network'
ssh deploy@31.131.18.254 'docker ps --format "{{.Names}}\t{{.Networks}}"'
```
### Test container connectivity
```bash
ssh deploy@31.131.18.254 'docker exec <container1> ping -c 2 <container2>'
```
---
## Troubleshooting
### Issue: Container can't reach another container
**Symptoms:** "connection refused", "no such host"
**Check:**
```bash
# Verify all containers are in app-network
ssh deploy@31.131.18.254 'docker ps --format "{{.Names}}\t{{.Networks}}"'
```
**Solution:**
1. Ensure all docker-compose.yml files have:
```yaml
networks:
app-network:
external: true
```
2. Restart the affected service
---
### Issue: "dial tcp: lookup <service> on 127.0.0.11:53: no such host"
**Cause:** Container not in app-network
**Solution:**
```bash
ssh deploy@31.131.18.254 'cd /srv/<service> && docker compose down && docker compose up -d'
```
---
### Issue: Caddy shows "502 Bad Gateway"
**Causes:**
1. Target service is down
2. Target service not in app-network
3. Wrong port/container name in Caddyfile
**Check:**
```bash
# Check if target is running
ssh deploy@31.131.18.254 'docker ps | grep <service>'
# Check Caddy logs
ssh deploy@31.131.18.254 'docker logs caddy --tail 50'
# Test direct connection
ssh deploy@31.131.18.254 'docker exec caddy wget -O- http://<container>:<port>'
```
---
### Issue: Woodpecker shows blank page or JavaScript errors
**Symptoms:** "SES Removing unpermitted intrinsics", SyntaxError
**Solution:**
1. Update to latest version (2.8.3+)
2. Ensure Caddy has `flush_interval -1` for SSE support
3. Clear browser cache (Ctrl+Shift+R)
---
### Issue: SSL certificate not working
**Cause:** Usually DNS propagation or Let's Encrypt rate limits
**Check:**
```bash
# Check Caddy logs
ssh deploy@31.131.18.254 'docker logs caddy | grep -i certificate'
# Check if domain resolves
nslookup <domain>
```
**Solution:** Wait for DNS propagation (up to 24h) or check DNS A records.
---
## Security Notes
1. **PostgreSQL:**
- Not exposed to internet (127.0.0.1 only)
- Separate users for each application
- Credentials stored in `/srv/postgres/CREDENTIALS.txt` (chmod 600)
2. **SSH:**
- Key-based authentication only
- User `deploy` has Docker permissions
3. **Docker Network:**
- All containers isolated in `app-network`
- No direct internet access except through Caddy
4. **Secrets:**
- Never commit credentials to git
- Store sensitive data in environment variables
- Use `.env` files (gitignored)
---
## Next Steps / TODO
- [ ] Deploy production app to `new.goodbrick.com.ua` (port 3100)
- [ ] Deploy development app to `dev.goodbrick.com.ua` (port 3200)
- [ ] Set up email for Gitea (optional)
- [ ] Configure Woodpecker pipelines for repositories
- [ ] Set up automatic backups for PostgreSQL databases
- [ ] Configure monitoring alerts in Uptime Kuma
---
## File Locations Summary
```
Server (31.131.18.254):
├── /srv/
│ ├── apps/
│ ├── gitea/
│ │ ├── docker-compose.yml
│ │ └── data/
│ ├── postgres/
│ │ ├── docker-compose.yml
│ │ ├── data/
│ │ └── CREDENTIALS.txt ← All DB credentials
│ ├── proxy/
│ │ ├── docker-compose.yml
│ │ ├── Caddyfile ← All routes
│ │ ├── data/
│ │ └── config/
│ ├── uptime-kuma/
│ │ ├── docker-compose.yml
│ │ └── data/
│ └── woodpecker/
│ ├── docker-compose.yml
│ └── data/
Local:
└── C:\Work\goodbrick\GBSite\
├── SERVER.md ← This file
└── README.md ← Project overview
```
---
**Last Updated:** 2026-02-09
**Maintained by:** Claude AI Assistant

13
backend/Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY src/GBSite.Api/*.csproj ./src/GBSite.Api/
RUN dotnet restore src/GBSite.Api/GBSite.Api.csproj
COPY . .
RUN dotnet publish src/GBSite.Api/GBSite.Api.csproj -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY --from=build /app .
EXPOSE 5000
ENV ASPNETCORE_URLS=http://+:5000
ENTRYPOINT ["dotnet", "GBSite.Api.dll"]

39
backend/GBSite.Api.sln Normal file
View File

@@ -0,0 +1,39 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GBSite.Api", "src\GBSite.Api\GBSite.Api.csproj", "{FF25E250-DE29-4251-A33F-BEB0A1F9C844}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Debug|x64.ActiveCfg = Debug|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Debug|x64.Build.0 = Debug|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Debug|x86.ActiveCfg = Debug|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Debug|x86.Build.0 = Debug|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Release|Any CPU.Build.0 = Release|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Release|x64.ActiveCfg = Release|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Release|x64.Build.0 = Release|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Release|x86.ActiveCfg = Release|Any CPU
{FF25E250-DE29-4251-A33F-BEB0A1F9C844}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FF25E250-DE29-4251-A33F-BEB0A1F9C844} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
EndGlobalSection
EndGlobal

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": "*"
}

View File

@@ -0,0 +1,28 @@
services:
gb-dev-frontend:
build: ../frontend
container_name: gb-dev-frontend
restart: unless-stopped
ports:
- "127.0.0.1:3200:3000"
environment:
- NODE_ENV=production
- INTERNAL_API_URL=http://gb-dev-backend:5000
networks:
- app-network
gb-dev-backend:
build: ../backend
container_name: gb-dev-backend
restart: unless-stopped
ports:
- "127.0.0.1:5200:5000"
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__Default=Host=postgres;Port=5432;Database=dev_db;Username=dev_user;Password=dev_pass_vB6nM3qP8yW2rT9k
networks:
- app-network
networks:
app-network:
external: true

View File

@@ -0,0 +1,28 @@
services:
gb-prod-frontend:
build: ../frontend
container_name: gb-prod-frontend
restart: unless-stopped
ports:
- "127.0.0.1:3100:3000"
environment:
- NODE_ENV=production
- INTERNAL_API_URL=http://gb-prod-backend:5000
networks:
- app-network
gb-prod-backend:
build: ../backend
container_name: gb-prod-backend
restart: unless-stopped
ports:
- "127.0.0.1:5100:5000"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ConnectionStrings__Default=Host=postgres;Port=5432;Database=prod_db;Username=prod_user;Password=prod_pass_kL9mN2pQ7xR8sT4v
networks:
- app-network
networks:
app-network:
external: true

2
frontend/.env.example Normal file
View File

@@ -0,0 +1,2 @@
# URL бэкенда для server-side запросов (внутри Docker network)
INTERNAL_API_URL=http://gb-prod-backend:5000

41
frontend/.gitignore vendored Normal file
View File

@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

19
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
EXPOSE 3000
CMD ["node", "server.js"]

36
frontend/README.md Normal file
View File

@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

23
frontend/components.json Normal file
View File

@@ -0,0 +1,23 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"iconLibrary": "lucide",
"rtl": false,
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"registries": {}
}

View File

@@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);
export default eslintConfig;

7
frontend/next.config.ts Normal file
View File

@@ -0,0 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
};
export default nextConfig;

11781
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

33
frontend/package.json Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.563.0",
"next": "16.1.6",
"radix-ui": "^1.4.3",
"react": "19.2.3",
"react-dom": "19.2.3",
"tailwind-merge": "^3.4.0"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.1.6",
"shadcn": "^3.8.4",
"tailwindcss": "^4",
"tw-animate-css": "^1.4.0",
"typescript": "^5"
}
}

View File

@@ -0,0 +1,7 @@
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default config;

1
frontend/public/file.svg Normal file
View File

@@ -0,0 +1 @@
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 391 B

View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

1
frontend/public/next.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 128 B

View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -0,0 +1,126 @@
@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";
@custom-variant dark (&:is(.dark *));
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar: var(--sidebar);
--color-chart-5: var(--chart-5);
--color-chart-4: var(--chart-4);
--color-chart-3: var(--chart-3);
--color-chart-2: var(--chart-2);
--color-chart-1: var(--chart-1);
--color-ring: var(--ring);
--color-input: var(--input);
--color-border: var(--border);
--color-destructive: var(--destructive);
--color-accent-foreground: var(--accent-foreground);
--color-accent: var(--accent);
--color-muted-foreground: var(--muted-foreground);
--color-muted: var(--muted);
--color-secondary-foreground: var(--secondary-foreground);
--color-secondary: var(--secondary);
--color-primary-foreground: var(--primary-foreground);
--color-primary: var(--primary);
--color-popover-foreground: var(--popover-foreground);
--color-popover: var(--popover);
--color-card-foreground: var(--card-foreground);
--color-card: var(--card);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--radius-2xl: calc(var(--radius) + 8px);
--radius-3xl: calc(var(--radius) + 12px);
--radius-4xl: calc(var(--radius) + 16px);
}
:root {
--radius: 0.625rem;
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.205 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.205 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.922 0 0);
--primary-foreground: oklch(0.205 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 10%);
--input: oklch(1 0 0 / 15%);
--ring: oklch(0.556 0 0);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
}
}

View File

@@ -0,0 +1,26 @@
import { NextResponse } from "next/server";
export async function GET() {
const apiUrl =
process.env.INTERNAL_API_URL || "http://localhost:5000";
try {
const res = await fetch(`${apiUrl}/api/health`, {
cache: "no-store",
});
const data = await res.json();
return NextResponse.json({
frontend: "ok",
backend: data,
});
} catch (error) {
return NextResponse.json(
{
frontend: "ok",
backend: "unreachable",
error: String(error),
},
{ status: 502 }
);
}
}

View File

@@ -0,0 +1,34 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "GoodBrick - \u0424\u0430\u0441\u0430\u0434\u043d\u0430\u044f \u043f\u043b\u0438\u0442\u043a\u0430",
description: "\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0444\u0430\u0441\u0430\u0434\u043d\u043e\u0439 \u043f\u043b\u0438\u0442\u043a\u0438 GoodBrick",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
);
}

19
frontend/src/app/page.tsx Normal file
View File

@@ -0,0 +1,19 @@
export default function Home() {
return (
<div className="flex min-h-screen items-center justify-center">
<main className="flex flex-col items-center gap-8 text-center">
<h1 className="text-5xl font-bold tracking-tight">GoodBrick</h1>
<p className="text-xl text-muted-foreground">
Производитель фасадной плитки
</p>
<div className="flex gap-4 text-sm text-muted-foreground">
<span>Next.js</span>
<span>+</span>
<span>shadcn/ui</span>
<span>+</span>
<span>.NET 9</span>
</div>
</main>
</div>
);
}

View File

@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}

34
frontend/tsconfig.json Normal file
View File

@@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts",
"**/*.mts"
],
"exclude": ["node_modules"]
}