How mitsu3s/cadence works
Project Type and Purpose
• From the file tree and minimal README (“cadence”), we see this is a standalone backend microservice written in Go (“api/” directory), designed to receive and process events (via a webhook), expose health checks, log activity, and persist data to Google Firestore.
• Terraform is used to provision GCP resources (Cloud Run service, Firestore, IAM roles, workload-identity).
• CI/CD workflows (in .github/workflows) build, test, deploy both Go code and Terraform.
Main Components
a. API Service
• Go application packaged into a Docker container (api/Dockerfile)
• Endpoints:
– /events (api/handler/events.go)
– /webhook (api/handler/webhook.go)
– /health (api/handler/health.go)
• Core modules: server setup (api/server), request handlers (api/handler), logging (api/logger), data models (api/model), and storage interface (api/store).
b. Data Store
• Google Firestore (api/store/firestore.go implements store.Store)
c. Infrastructure as Code
• Terraform modules under terraform/ (cloud_run.tf, firestore.tf, iam.tf, workload_identity.tf, etc.)
d. CI/CD Pipelines
• GitHub workflows:
– go.yaml (build & test Go code)
– terraform.yaml (plan & apply infra)
– cloud-run.yaml (build Docker image and deploy to Cloud Run)
Interactions and Data Flow
• External clients (event producers) → invoke the webhook endpoint on the Cloud Run URL.
• The Go server receives the HTTP request, logs it, optionally transforms it into an Event model, and writes it to Firestore.
• Health probes call the /health endpoint.
• The Terraform pipeline provisions and updates the Cloud Run service and Firestore database.
• CI pipelines trigger on push/PR, run tests, then deploy code or infra.
Architectural Patterns & Design Principles
• Microservice / 12-factor app: stateless container, externalized config (api/config/env.go reads environment variables).
• Clean separation of concerns: handlers vs. server vs. store vs. model vs. logger.
• Infrastructure immutability via Terraform.
• Strong interface-driven design for storage layer (store.Store).