$ show appleboy/gorush
Gorush is a push notification microserver written in Go that delivers notifications to iOS (APNS), Android (FCM), and Huawei (HMS) devices. It exposes both an HTTP REST API (built with Gin) and a gRPC interface for high-performance integration. The system is designed for production use with configurable queue backends (local in-memory, NSQ, NATS, Redis), multiple workers, and pluggable statistics storage (memory, Redis, BoltDB, BuntDB, LevelDB, BadgerDB). It supports concurrent iOS push limiting, automatic retry on failure, feedback webhooks for asynchronous error reporting, and Prometheus metrics for monitoring. The architecture follows a clean producer-consumer pattern: incoming push requests are validated and enqueued, then processed asynchronously by workers that dispatch to platform-specific push services. The codebase is well-structured with clear separation of concerns across packages (app/, config/, core/, notify/, router/, rpc/, storage/, logx/, metric/, status/). It includes comprehensive test coverage, CI/CD pipelines, Docker/Kubernetes/AWS Lambda deployment support, and security scanning. The configuration system uses Viper with YAML files and environment variable overrides, with built-in validation and sensitive field redaction for safe API exposure.
The LLM identified 4 files worth highlighting for reuse:
Defines a typed Platform enum with text and JSON marshaling/unmarshaling, supporting both string and legacy numeric formats. Self-contained and extractable for any Go project needing a strongly-typed enum with serialization.
Contains self-contained validation functions (ValidatePort, ValidateAddress, ValidatePIDPath) that perform input validation and security checks (path traversal prevention, sensitive directory protection). Also provides SanitizedCopy() for redacting sensitive configuration fields before exposure via API.
A logging module that detects terminal capability for color output, supports JSON and text formats, and provides token/message redaction for privacy. Implements a clean abstraction over logrus with configurable log levels and output paths. The token hiding and terminal detection patterns are reusable.
A thread-safe in-memory implementation of the Storage interface using atomic integers and a concurrent map. Demonstrates a simple yet effective pattern for key-value storage with atomic increments, easily extractable for any project needing lightweight counters.