Features: - Multi-platform agents (Linux, macOS, Windows - AMD64 & ARM64) - Real-time CPU, RAM, and disk usage monitoring - Responsive web dashboard with live status indicators - Session-based authentication with secure credentials - Stale agent detection and removal (6+ months inactive) - Auto-refresh dashboard (5 second intervals) - 15-second agent reporting intervals - Auto-generated agent IDs from hostnames - In-memory storage (zero database setup) - Minimal dependencies (Chi router + Templ templating) Project Structure: - cmd/: Agent and Server executables - internal/: API, Auth, Stats, Storage, and UI packages - views/: Templ templates for dashboard UI - Makefile: Build automation for all platforms Ready for deployment with comprehensive documentation: - README.md: Full project documentation - QUICKSTART.md: Getting started guide - AGENTS.md: Development guidelines
1.6 KiB
Nerd Monitor - Agent Guidelines
Build & Test Commands
# Generate Templ templates (required before building)
make templ
# Build server and agent for current OS
make build
# Build individual components
make build-server
make build-agent
# Build for all platforms (Linux, macOS, Windows)
make build-all
# Clean build artifacts
make clean
Note: This Go 1.21 project uses Templ for templating. Always run make templ before building.
Code Style Guidelines
Imports: Standard library first, then third-party packages, then internal modules. Organize alphabetically within each group.
Formatting & Types: Use gofmt standards. Explicit struct field comments for exported types. Prefer error return values (no panic for recoverable errors).
Naming: CamelCase for exported symbols, lowercase for unexported. Receiver names as single letters (e.g., (m *Manager)). Constants use ALL_CAPS_SNAKE_CASE.
Error Handling: Define sentinel errors in dedicated files (e.g., auth/errors.go). Check errors explicitly; use http.Error(w, "message", status) for HTTP responses. Wrap errors with context when needed.
Project Structure:
cmd/: Executable entry points (server, agent)internal/: Packages (api, auth, stats, store, ui)views/: Templ templates (*.templ files)
Concurrency: Use sync.RWMutex for shared state. Always defer lock releases. Keep critical sections small.
HTTP: Use Chi router. Handlers follow func (h *Handler) Name(w http.ResponseWriter, r *http.Request). Set Content-Type headers explicitly. Validate query parameters early and return 400/404 appropriately.