Contributing
⚠️ Hinweis: Dies ist ein proprietäres Projekt. Contributions sind nur für autorisierte Team-Mitglieder möglich.
Vielen Dank für dein Interesse an der Entwicklung der IMVEE SOCsuite! Dieses Dokument beschreibt die Entwicklungs-Richtlinien und Best Practices für unser Team.
📋 Inhaltsverzeichnis
- Code of Conduct
- Entwicklungsumgebung
- Git Workflow
- Code Standards
- Testing Guidelines
- Pull Request Process
- Commit Message Guidelines
- Branch Naming
🤝 Code of Conduct
Grundprinzipien
- Respekt: Behandle alle Teammitglieder mit Respekt und Professionalität
- Qualität: Code Quality > Speed. Lieber länger, aber sauber
- Security First: Security-Aspekte haben höchste Priorität
- Dokumentation: Code ohne Dokumentation ist unvollständig
- Testing: Kein Code ohne entsprechende Tests
- Kommunikation: Bei Unklarheiten sofort kommunizieren
🛠️ Entwicklungsumgebung
Voraussetzungen
# Node.js & pnpm
node --version # >= 20.0.0
pnpm --version # >= 9.0.0
# Go
go version # >= 1.23
# Docker
docker --version
docker-compose --versionSetup
# Repository clonen
git clone https://github.com/IMVEE-SOCsuite/IMVEE.SOCsuite.V0.2.git
cd IMVEE.SOCsuite.V0.2
# Dependencies installieren
pnpm install
# Environment setup
cp .env.example .env
# .env anpassen mit eigenen Werten
# Infrastruktur starten
pnpm docker:up
# Development Server starten
pnpm devIDE Setup (VS Code empfohlen)
Empfohlene Extensions:
- ESLint
- Prettier
- Go
- Docker
- GitLens
- Error Lens
- Auto Rename Tag
- Tailwind CSS IntelliSense
# VS Code settings sind bereits im Repository (.vscode/)
# Automatisches Format on Save ist aktiv🌳 Git Workflow
Wir verwenden Git Flow mit folgenden Branches:
Branch-Struktur
main → Production-ready Code
├── develop → Hauptentwicklungszweig
├── feature/* → Neue Features
├── bugfix/* → Bug Fixes
├── hotfix/* → Kritische Production Fixes
└── refactor/* → Code RefactoringWorkflow
-
Feature entwickeln
# Von develop abzweigen git checkout develop git pull origin develop git checkout -b feature/JIRA-123-feature-name # Entwickeln... git add . git commit -m "feat(module): add new feature" # Push git push origin feature/JIRA-123-feature-name -
Pull Request erstellen
- PR von
feature/xxxnachdevelop - Mindestens 1 Code Review erforderlich
- Alle Tests müssen grün sein
- CI/CD Pipeline muss erfolgreich durchlaufen
- PR von
-
Nach Merge
# Branch lokal löschen git checkout develop git pull origin develop git branch -d feature/JIRA-123-feature-name
📝 Branch Naming
feature/JIRA-123-short-description
bugfix/JIRA-456-bug-description
hotfix/critical-security-issue
refactor/improve-performance
docs/update-readmeFormat: <type>/<ticket-id>-<short-description>
💻 Code Standards
TypeScript / React
// ✅ GOOD
interface User {
id: string;
email: string;
role: UserRole;
}
export function UserProfile({ user }: { user: User }) {
// Frühe Returns
if (!user) {
return <EmptyState />;
}
return (
<Card>
<CardHeader>
<CardTitle>{user.email}</CardTitle>
</CardHeader>
</Card>
);
}
// ❌ BAD
function userProfile(u) { // No types
if (u) {
return <div>{u.email}</div>; // No semantic HTML
}
return null;
}Best Practices:
- Typed Props: Immer TypeScript Interfaces für Props
- Named Exports: Bevorzugt über default exports
- Functional Components: Keine Class Components
- Hooks: Custom Hooks für wiederverwendbare Logik
- Component Composition: Small, focused components
- Error Boundaries: Für kritische Components
Go
// ✅ GOOD
type UserService struct {
repo UserRepository
}
func (s *UserService) GetUser(ctx context.Context, id string) (*User, error) {
if id == "" {
return nil, ErrInvalidUserID
}
user, err := s.repo.FindByID(ctx, id)
if err != nil {
return nil, fmt.Errorf("find user: %w", err)
}
return user, nil
}
// ❌ BAD
func getUser(id string) *User { // No context, error handling
return getUserFromDB(id)
}Best Practices:
- Context: Immer
context.Contextals ersten Parameter - Error Wrapping:
fmt.Errorfmit%wfür Error Chains - Interfaces: Small interfaces (1-3 methods)
- Struct Tags: JSON/DB tags für alle exported structs
- Package Structure: Clear separation of concerns
CSS / Tailwind
// ✅ GOOD - Semantic & organized classes
<div className="flex items-center justify-between gap-4 rounded-lg border bg-card p-4">
<h3 className="text-lg font-semibold">Title</h3>
</div>
// ❌ BAD - Unorganized, hard to read
<div className="p-4 flex bg-card border rounded-lg gap-4 items-center justify-between">
<h3 className="font-semibold text-lg">Title</h3>
</div>Class Order:
- Layout (flex, grid, block)
- Positioning (relative, absolute)
- Sizing (w-, h-)
- Spacing (p-, m-, gap-)
- Typography (text-, font-)
- Colors (bg-, text-, border-)
- Effects (shadow-, rounded-)
🧪 Testing Guidelines
Test Coverage
Minimum Coverage Requirements:
- Unit Tests: 80%+
- Integration Tests: Core flows abgedeckt
- E2E Tests: Critical user journeys
Test Structure
// Frontend Tests (Vitest + React Testing Library)
describe('UserProfile', () => {
it('should render user information', () => {
const user = { id: '1', email: 'test@example.com', role: 'admin' };
render(<UserProfile user={user} />);
expect(screen.getByText(user.email)).toBeInTheDocument();
});
it('should handle missing user gracefully', () => {
render(<UserProfile user={null} />);
expect(screen.getByText(/no user/i)).toBeInTheDocument();
});
});// Backend Tests (Go testing)
func TestUserService_GetUser(t *testing.T) {
tests := []struct {
name string
userID string
want *User
wantErr bool
}{
{
name: "valid user",
userID: "123",
want: &User{ID: "123", Email: "test@example.com"},
},
{
name: "empty id",
userID: "",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Test implementation
})
}
}Test Commands
# Frontend Tests
pnpm test # Run all tests
pnpm test:watch # Watch mode
pnpm test:coverage # Coverage report
# Backend Tests
cd apps/api
go test ./... # All tests
go test -v ./... # Verbose
go test -cover ./... # Coverage🔍 Code Review Guidelines
Als Reviewer
Check:
- ✅ Code folgt Projekt-Standards
- ✅ Alle Tests sind grün
- ✅ Keine Security-Issues (SQL Injection, XSS, etc.)
- ✅ Performance-Implikationen beachtet
- ✅ Dokumentation/Kommentare vorhanden
- ✅ Error Handling korrekt implementiert
- ✅ Keine Breaking Changes ohne Migration
Review-Kommentare:
# ✅ Constructive
"Consider using a custom hook here to avoid code duplication.
Example: useFetchUser()"
# ❌ Not Helpful
"This is bad"Als Author
- Respond to all comments: Auch wenn du nicht zustimmst
- Keep PRs small: Max. 400 Lines of Code
- Update PR description: Bei größeren Änderungen
- Self-review first: Review deinen eigenen Code vor Submit
📦 Pull Request Process
PR Checklist
Vor dem Erstellen eines PRs:
- Code kompiliert ohne Fehler
- Alle Tests sind grün (
pnpm test) - Linting ohne Fehler (
pnpm lint) - Type Checking ohne Fehler (
pnpm typecheck) - Code ist formatiert (
pnpm format) - Neue Features haben Tests
- Dokumentation ist aktualisiert
- CHANGELOG.md ist aktualisiert (für größere Features)
- .env.example aktualisiert (falls neue ENV Vars)
PR Template
## 🎯 Beschreibung
Kurze Beschreibung der Änderungen.
## 🔗 Related Issues
- Fixes #123
- Related to #456
## 🧪 Testing
Wie wurde getestet?
- [ ] Unit Tests
- [ ] Integration Tests
- [ ] Manual Testing
## 📸 Screenshots
(Falls UI-Änderungen)
## ⚠️ Breaking Changes
Gibt es Breaking Changes? Wenn ja, welche?
## 📝 Checklist
- [ ] Code reviewed by myself
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] CHANGELOG updated📝 Commit Message Guidelines
Wir verwenden Conventional Commits:
<type>(<scope>): <subject>
<body>
<footer>Types
feat: Neues Featurefix: Bug Fixdocs: Dokumentationstyle: Formatierung (keine Code-Änderung)refactor: Code Refactoringperf: Performance Improvementtest: Tests hinzufügen/ändernbuild: Build System (Webpack, pnpm, etc.)ci: CI/CD Konfigurationchore: Maintenance Tasks
Beispiele
# Feature
feat(auth): add JWT refresh token mechanism
Implements automatic token refresh before expiration.
Includes fallback to login if refresh fails.
Closes #234
# Bug Fix
fix(siem): resolve detection rule parsing error
Fixed regex pattern that caused rules to fail parsing
for certain log formats.
# Breaking Change
feat(api)!: change authentication endpoint structure
BREAKING CHANGE: Auth endpoint moved from /auth/login to /api/v1/auth/login
Migration: Update all API clients to use new endpointCommit Message Rules
-
Subject Line:
- Max 50 Zeichen
- Imperativ ("add", nicht "added")
- Kein Punkt am Ende
- Kleinbuchstaben nach Typ/Scope
-
Body (optional):
- Wrap at 72 characters
- Erkläre was und warum, nicht wie
-
Footer (optional):
- Breaking Changes
- Issue References
🚀 Release Process
Versioning (Semantic Versioning)
MAJOR.MINOR.PATCH
0.2.1- MAJOR: Breaking Changes
- MINOR: Neue Features (backward compatible)
- PATCH: Bug Fixes
Release Workflow
-
Version Bump
pnpm version:major # 0.2.0 → 1.0.0 pnpm version:minor # 0.2.0 → 0.3.0 pnpm version:patch # 0.2.0 → 0.2.1 -
CHANGELOG Update
- Alle Changes seit letztem Release auflisten
- Nach Type gruppieren (Features, Fixes, etc.)
-
Create Release PR
release/v0.2.1branch- Update package.json versions
- Update CHANGELOG.md
- PR nach
main
-
After Merge
- Tag erstellen:
git tag v0.2.1 - Push Tag:
git push origin v0.2.1 - GitHub Release erstellen
- Tag erstellen:
🔧 Troubleshooting
Häufige Probleme
Problem: pnpm install schlägt fehl
# Lösung: Cache clearen
pnpm store prune
rm -rf node_modules
pnpm installProblem: Docker Container starten nicht
# Lösung: Alte Container entfernen
pnpm docker:down
docker system prune -a
pnpm docker:upProblem: Type Errors nach Package Update
# Lösung: Type Definitionen regenerieren
pnpm typecheck --force📚 Weitere Ressourcen
- Architecture Documentation
- API Documentation
- Testing Guide
- Deployment Guide (Quelle:
./docs/DEPLOYMENT.md)
💬 Fragen?
Bei Fragen oder Problemen:
- 💬 Team Chat: Slack #socsuite-dev
- 📧 Email: dev-team@imvee.com
- 📅 Weekly Sync: Montags 10:00 Uhr
Danke fürs Lesen! 🚀
Denk dran: Qualität > Geschwindigkeit. Lieber einmal richtig als zweimal schnell.