feat: initial Go project scaffold with build/test/release pipeline

- Go module: github.com/netcell-it/deklarix
- cmd/server/main.go: HTTP entry point with /health endpoint
- scripts/build.sh: cross-compile amd64 + arm64
- scripts/test.sh: go vet + race tests + build-check
- scripts/release.sh: full release flow (test → build → tag → push)
- packaging/DEBIAN: .deb control template
- design/enterprise.css: enterprise design system from enconf
- CLAUDE.md: complete build/test/release documentation
- .claude/settings.local.json: Claude Code permissions
This commit is contained in:
2026-08-26 22:16:44 +02:00
parent a04e805fe1
commit 11cf9083fa
10 changed files with 4807 additions and 0 deletions

30
.gitignore vendored Normal file
View File

@@ -0,0 +1,30 @@
# Build output
dist/
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
*.out
# Go workspace
go.work
go.work.sum
# Environment
.env
.env.local
*.local
# IDE
.idea/
.vscode/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db

11
.mcp.json Normal file
View File

@@ -0,0 +1,11 @@
{
"mcpServers": {
"architect": {
"type": "stdio",
"command": "node",
"args": [
"/var/www/architect-center/mcp-proxy.js"
]
}
}
}

192
CLAUDE.md Normal file
View File

@@ -0,0 +1,192 @@
# Deklarix
> Projekt für deklarix.de und deklarix.com
---
## Stack
| Backend | Frontend (geplant) |
|---------|---------------------|
| Go 1.26 | React 19, TypeScript 5.9 |
| net/http (Standard-Library-first) | Vite 8, Tailwind CSS |
| SQLite (geplant) | enterprise.css Design-System (enconf-Pattern) |
**Pfad:** `/var/www/deklarix` | **Git:** `https://git.netcell-it.de/projekte/deklarix` | **Branch:** `main`
---
## Projektstruktur
```
/var/www/deklarix/
├── cmd/
│ └── server/
│ └── main.go # Entry Point
├── internal/
│ ├── config/ # Konfiguration (env-basiert)
│ ├── handler/ # HTTP Handler
│ └── middleware/ # Auth, Logging, CORS
├── design/
│ └── enterprise.css # Gemeinsames Design-System (enconf-Basis)
├── packaging/
│ └── DEBIAN/
│ └── control.tmpl # .deb Package-Control-Template
├── scripts/
│ ├── build.sh # Cross-Compile amd64 + arm64
│ ├── test.sh # Tests + vet + build-check
│ └── release.sh # Vollständiger Release-Prozess
├── go.mod
├── go.sum
└── CLAUDE.md
```
---
## Go Commands
```bash
export PATH=$PATH:/usr/local/go/bin # Immer setzen!
# Entwickeln
go run ./cmd/server/
# Tests
./scripts/test.sh
# oder direkt:
go test -race ./...
go vet ./...
# Build (amd64 + arm64)
./scripts/build.sh 1.0.0
# Build (nur amd64)
./scripts/build.sh 1.0.0 amd64
```
---
## Build & Release-Prozess
### Versioning (Semantic Versioning: MAJOR.MINOR.PATCH)
- **MAJOR** — Breaking changes, API-Inkompatibilitäten
- **MINOR** — Neue Features, rückwärtskompatibel
- **PATCH** — Bugfixes
### Release-Schritte
```bash
# 1. Alle Änderungen committen
git add -p && git commit -m "feat: ..."
# 2. Release-Skript (macht Tests → Build → Tag → Push)
./scripts/release.sh 1.2.0
# Danach liegt in dist/:
# deklarix_1.2.0_amd64
# deklarix_1.2.0_arm64
```
### Was das Release-Skript tut
1. Prüft: sauberer Git-Status (keine uncommitted changes)
2. Führt `./scripts/test.sh` aus (vet + race tests + build-check)
3. Kompiliert für `linux/amd64` und `linux/arm64`
4. Setzt Git-Tag `v<version>` mit Annotierung
5. Pusht `main` + Tag nach `origin`
---
## Testing-Pattern
```go
// Datei: internal/handler/health_test.go
package handler_test
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestHealth(t *testing.T) {
req := httptest.NewRequest(http.MethodGet, "/health", nil)
w := httptest.NewRecorder()
HealthHandler(w, req)
if w.Code != http.StatusOK {
t.Fatalf("expected 200, got %d", w.Code)
}
}
```
- Tests liegen neben dem Code: `handler/foo_test.go`
- Package: `package foo_test` (Black-Box-Test) oder `package foo` (White-Box)
- Race-Detector immer an: `go test -race ./...`
- Tabellenbasierte Tests für mehrere Inputs
---
## Design-System
Das Frontend folgt dem **Enterprise Light Theme** aus enconf (`design/enterprise.css`).
- **Primärfarbe:** `#1677ff` (Blau)
- **Sidebar:** Dunkel (`#0B1426``#101D33`) mit weißen Icons
- **Body:** `#F8FAFC` Hintergrund, `#334155` Text
- **Font:** Inter (von `/fonts/inter.css` oder Google Fonts)
- **Radius:** 6px / 8px / 10px
Für neue Frontend-Projekte unter `/var/www/deklarix`:
```bash
# Frontend-Scaffold (wenn benötigt)
npm create vite@latest frontend -- --template react-ts
cd frontend && npm install
# enterprise.css aus design/ einbinden
```
---
## Domains
| Domain | Verwendung |
|--------|-----------|
| deklarix.de | Primär |
| deklarix.com | Redirect / International |
---
## Wichtige Hinweise
### Go PATH
```bash
# Immer setzen — ist nicht im Standard-PATH des Servers
export PATH=$PATH:/usr/local/go/bin
```
### Git Push
```bash
git push origin main
# Remote: https://git.netcell-it.de/projekte/deklarix.git
```
### Server-Prozess
```bash
# Start (manuell)
PORT=8080 ./dist/deklarix_latest_amd64 &
# Logs prüfen
journalctl -u deklarix -f
```
---
## Vor Änderungen
1. `go vet ./...` — keine Fehler
2. `./scripts/test.sh` — alle Tests grün
3. Bestehenden Code lesen — nicht raten
## Nach Änderungen
1. `./scripts/test.sh` → 0 Fehler
2. `./scripts/build.sh <version>` → erfolgreich
3. Commit mit semantischer Message: `feat:`, `fix:`, `refactor:`, `docs:`
4. Bei Release: `./scripts/release.sh <version>`

27
cmd/server/main.go Normal file
View File

@@ -0,0 +1,27 @@
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
addr := ":" + port
mux := http.NewServeMux()
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
fmt.Fprintf(w, `{"ok":true}`)
})
log.Printf("Deklarix server starting on %s", addr)
if err := http.ListenAndServe(addr, mux); err != nil {
log.Fatal(err)
}
}

4398
design/enterprise.css Normal file

File diff suppressed because it is too large Load Diff

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module github.com/netcell-it/deklarix
go 1.26.6

View File

@@ -0,0 +1,7 @@
Package: deklarix
Version: VERSION
Architecture: ARCH
Maintainer: NetCell IT <team@netcell-it.de>
Description: Deklarix — deklarix.de / deklarix.com
Deklarix Software Package.
Depends:

52
scripts/build.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env bash
# Deklarix — Build-Skript (amd64 + arm64)
#
# Verwendung:
# ./scripts/build.sh [version] # Beide Architekturen
# ./scripts/build.sh [version] amd64 # Nur amd64
# ./scripts/build.sh [version] arm64 # Nur arm64
#
# Ausgabe: dist/deklarix_<version>_<arch>
#
# Release-Prozess:
# 1. VERSION erhöhen (Semantic Versioning: MAJOR.MINOR.PATCH)
# 2. ./scripts/build.sh <version>
# 3. ./scripts/test.sh
# 4. git tag v<version> && git push origin v<version>
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
VERSION="${1:-0.0.1}"
ARCH_FILTER="${2:-both}"
GRN='\033[0;32m'; BLD='\033[1m'; NC='\033[0m'
log() { echo -e "${GRN}[build]${NC} $*"; }
export PATH=$PATH:/usr/local/go/bin
command -v go >/dev/null || { echo "Go nicht gefunden — PATH: $PATH"; exit 1; }
mkdir -p "$REPO_DIR/dist"
log "Version: $VERSION | Go: $(go version)"
ARCHS=()
case "$ARCH_FILTER" in
amd64) ARCHS=("amd64") ;;
arm64) ARCHS=("arm64") ;;
*) ARCHS=("amd64" "arm64") ;;
esac
for ARCH in "${ARCHS[@]}"; do
OUT="$REPO_DIR/dist/deklarix_${VERSION}_${ARCH}"
log "Baue $ARCH$OUT"
GOARCH=$ARCH GOOS=linux go build \
-ldflags="-X main.Version=${VERSION} -s -w" \
-o "$OUT" \
./cmd/server/
log "$ARCH fertig: $(du -sh "$OUT" | cut -f1)"
done
log "Build abgeschlossen ✓"

60
scripts/release.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/env bash
# Deklarix — Release-Skript
#
# Verwendung: ./scripts/release.sh <version>
# Beispiel: ./scripts/release.sh 1.2.0
#
# Was passiert:
# 1. Tests laufen
# 2. Build für amd64 + arm64
# 3. git tag v<version> wird gesetzt
# 4. git push origin main + git push origin v<version>
#
# Voraussetzungen:
# - Sauberer Git-Status (keine uncommitted changes)
# - Alle Tests grün
set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
VERSION="${1:-}"
if [[ -z "$VERSION" ]]; then
echo "Verwendung: $0 <version> (z.B. 1.0.0)"
exit 1
fi
GRN='\033[0;32m'; BLD='\033[1m'; NC='\033[0m'
log() { echo -e "${GRN}[release]${NC} $*"; }
cd "$REPO_DIR"
# Git-Status prüfen
if [[ -n "$(git status --porcelain)" ]]; then
echo "FEHLER: Uncommitted changes vorhanden — bitte erst committen"
git status --short
exit 1
fi
log "Release v${VERSION} wird vorbereitet..."
# Tests
log "Tests laufen..."
bash "$REPO_DIR/scripts/test.sh"
# Build
log "Build für alle Architekturen..."
bash "$REPO_DIR/scripts/build.sh" "$VERSION"
# Git Tag
log "Tag v${VERSION} setzen..."
git tag -a "v${VERSION}" -m "Release v${VERSION}"
# Push
log "Push main + Tag..."
git push origin main
git push origin "v${VERSION}"
log ""
log "Release v${VERSION} fertig ✓"
log "Binaries: dist/deklarix_${VERSION}_amd64 + _arm64"

27
scripts/test.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Deklarix — Test-Skript
#
# Führt alle Go-Tests aus + Vet + Build-Check.
# Wird auch im CI/vor jedem Release ausgeführt.
set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
export PATH=$PATH:/usr/local/go/bin
GRN='\033[0;32m'; RED='\033[0;31m'; NC='\033[0m'
log() { echo -e "${GRN}[test]${NC} $*"; }
fail() { echo -e "${RED}[FAIL]${NC} $*"; exit 1; }
cd "$REPO_DIR"
log "go vet ..."
go vet ./... || fail "go vet fehlgeschlagen"
log "go test ./... "
go test -race -count=1 ./... || fail "Tests fehlgeschlagen"
log "Build-Check (amd64) ..."
GOARCH=amd64 GOOS=linux go build -o /dev/null ./cmd/server/ || fail "Build fehlgeschlagen"
log "Alle Tests bestanden ✓"