FleetTUI is a terminal UI application for monitoring server fleets in real-time. Built with Go using the Charm stack (Bubble Tea, Lipgloss, Bubbles).
Repects KISS and Vim binding when adding new features
The project follows clean architecture principles with clear separation of concerns:
internal/
├── domain/ # Core business entities and logic
│ ├── node.go # Node entity with availability checks
│ └── metrics.go # Metrics types and configuration
├── ports/ # Interface definitions (primary/secondary adapters)
│ └── output/ # Output ports (SSH, config loader interfaces)
├── adapters/ # Implementation of ports
│ ├── input/ # TUI adapter (Bubble Tea)
│ └── output/ # SSH client, config loader implementations
├── service/ # Business logic layer
│ └── collector.go # Metrics collection orchestration
- Domain Layer: Pure business logic, no external dependencies
- Service Layer: Orchestrates domain operations, uses ports
- Adapters: Implement external interactions (SSH, files, TUI)
- Ports: Define contracts between layers
ALL new features in the following packages MUST have unit tests:
-
internal/domain/- Domain logic tests- Test all public methods
- Use table-driven tests
- Test edge cases (nil, empty, boundary values)
-
internal/adapters/output/config/- Config loader tests- Test file I/O with temporary files
- Test error handling (missing files, invalid YAML)
- Test default value application
-
internal/service/- Service layer tests- Use mocks for external dependencies
- Test concurrent operations
- Test error propagation
- Use table-driven tests for all test cases
- Use testify/mock (via mockery) for mocking interfaces
- Place tests in same package as code.
- Test both success and failure paths
Mocks are generated using mockery. Configuration is in .mockery.yaml.
# Generate/update all mocks
mockery --allALL code changes MUST be formatted and linted before submission:
gofmt -w . && golangci-lint run# Run all tests
go test ./...
# Run specific package tests
go test ./internal/domain/...
go test ./internal/adapters/output/config/...
go test ./internal/service/...When adding features to domain, config, or service layers:
- Write the implementation
- Write comprehensive tests (table-driven)
- Generate mocks if new interfaces are added
- Run linters && formatters
- Ensure all tests pass
# Build
go build .
# Run
go run ./!\ Never commit the code or push by yourself.