How saini-prakhyat/fern-reporter works
Project Type and Purpose
• Fern-Reporter is a Go-based API server (Gin framework) that captures, stores, and exposes Ginkgo test metadata.
• It provides REST/GraphQL HTTP endpoints, a gRPC interface, embedded HTML views, and integrates with an external React-based UI (Fern-UI).
• A PostgreSQL database holds historical test, suite, spec, project and tag data.
File Structure
• Top-level: Dockerfiles, docker-compose.yaml, Makefile, config/.
• pkg/api: HTTP routers → handlers → server setup.
• pkg/graph: GraphQL schema, resolvers (gqlgen).
• grpcstart + grpcfiles/: gRPC server bootstrap and proto definitions.
• pkg/db: Database connection, migrations.
• pkg/auth: JWT middleware.
• pkg/views: Embedded HTML templates (insights.html, test_runs.html).
• config/: YAML/Go code for environment configuration.
• Main.go: entrypoint launching HTTP and gRPC servers.
README
• Describes two main components: API Server & Client Library.
• Lists endpoints: HTTP (port 8080), gRPC (port 50051), GraphiQL UI.
• Mentions Docker Compose with PostgreSQL.
• References external React frontend (Fern-UI).
a. Main Components
• Ginkgo Client (in a test suite)
• Fern-Reporter Service:
• HTTP API (Gin) → REST + GraphQL
• gRPC Server
• Embedded HTML Views
• Auth Middleware
• Config Loader
• PostgreSQL Database
• Fern-UI (React Frontend)
b. Interactions
• Ginkgo tests → send test metadata (HTTP POST or gRPC) → Fern Service
• Fern Service validates JWT (middleware) → writes/reads to PostgreSQL (pkg/db)
• GraphQL endpoint for ad-hoc queries (GraphiQL)
• HTTP endpoint serves embedded HTML at /reports/testruns
• Fern-UI queries REST/GraphQL for dashboards
• Docker Compose orchestrates Fern Service + Postgres
c. Architectural Patterns
• Layered MVC-style backend: routers → handlers → business logic → data layer
• Schema-first GraphQL generated by gqlgen
• Dual-protocol API (REST/GraphQL + gRPC)
• Environment-based configuration (config package + .yaml)
d. Key Technologies
• Go + Gin framework (HTTP)
• gqlgen (GraphQL)
• gRPC + protobuf
• PostgreSQL + Goose-style migrations
• Docker, Docker Compose
• JWT authentication
Essential Elements Checklist
• Component names & roles (API Server, gRPC Server, Auth Middleware, DB)
• Data flows and directions
• Protocols and ports
• External dependencies (Docker Compose, Fern-UI, Ginkgo client)
• Config/migrations path (config/, pkg/db/migrations)