How dhimanabhi/policy-reporter-ui works
Main Components
• Frontend: Built with Vue/Nuxt, it handles user interaction, visualization (charts, graphs, dashboards), and routing between different pages for policies, resources, sources, and targets.
• Backend: Written in Go, it serves API endpoints, handles authentication (OAuth2/OpenID Connect), interacts with underlying data sources (possibly through Kubernetes integration), and manages configuration, logging, and reporting.
• External Services: Although not directly visible, external dependencies are implied by authentication (‘backend/pkg/auth’) and Kubernetes integrations. There is also an integration point with the underlying “Policy Reporter” data source.
• Build & Deployment Pipeline: GitHub workflows (in the .github directory and Makefile) that indicate CI/CD operations and dependency management.
Project Architecture & Relationships
• The frontend communicates with the backend APIs via HTTP calls. The “frontend/modules/core/api.ts” and corresponding composables show where calls are made to the backend.
• The backend is structured into several packages (api, auth, config, kubernetes, reports, server, service, and utils) to clearly separate concerns:
• The “backend/pkg/api” folder handles API interactions including client/proxy handling.
• The “backend/pkg/auth” package manages authentication logic (sessions, middleware, and permissions).
• The “backend/pkg/server” likely sets up the HTTP server and REST endpoints.
• The “backend/pkg/reports” handles report generation and processing.
• The configuration files (e.g., config.example.yaml in the backend and various environment examples in the frontend) indicate environment-driven setups.
• The GitHub workflows and Makefile indicate a structured build/deployment process.
Important Architectural Patterns & Design Principles
• Separation of concerns is evident by distinct modules (frontend vs. backend) and even within the backend where you see segregation by responsibilities (authentication, configuration, API handling).
• The frontend likely employs a component-based architecture leveraging Vue’s composition API (with composables and plugins).
• In the backend, modularization via packages promotes clean code practices and easier maintenance.
• Use of middleware for authentication suggests a layered approach to managing requests.