- 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
193 lines
4.4 KiB
Markdown
193 lines
4.4 KiB
Markdown
# 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>`
|