$ show KunMoe/kun-galgame-stickers
This repository is a production full-stack application for browsing, searching, downloading, and publishing galgame (visual novel) sticker packs. It is a pnpm monorepo containing a Nuxt 4 SSR frontend (`apps/web`) and a Go Fiber v3 API (`apps/api`) backed by PostgreSQL. The API exposes both internal service endpoints and a public read-only OpenAPI "face" for sticker content, while integrating with external ecosystem services: an OAuth 2.0 identity provider (PKCE, httpOnly session cookies, BFF pattern), a centralized content-addressed image service, a catalog service for games/characters, and a community service for comments, notifications, and reactions. Deployment is Docker images to GHCR via Dokploy, with versioned SQL migrations and GitHub Actions CI building all images on push to the `svelte-kit` branch. The backend is well-layered: handlers own HTTP concerns, services contain business logic without importing Fiber, repositories use GORM, and repeated cross-service communication is isolated in reusable `pkg` clients. Noteworthy engineering includes batch hydration for pack covers/tags/authors, trigram GIN search over flattened multilingual text, cursor pagination for notifications, and RFC 9457 problem-detail error responses in the public API. The frontend is organized into feature modules and includes a race-condition-safe catalog picker, OAuth PKCE utilities, and server-side OG image generation. The codebase is maintained and technically current, though some operational risks remain: dual error dialects between internal and public APIs, silent degradation when optional upstream services are down, and a few hardcoded backfill mappings in one-time scripts.
The LLM identified 4 files worth highlighting for reuse:
Standalone Go client for the ecosystem's centralized image service. It handles upload, reference-ping to avoid TTL deletion, and constructs CDN URLs from SHA-256 hashes. The package has zero external dependencies and is isolated in `pkg/`, making it directly reusable in any Go service that needs to talk to the same image service.
A well-crafted typed HTTP client for an external community service, with envelope decoding, configurable timeouts, S2S Basic auth, and sentinel errors (`ErrNotFound`, `ErrForbidden`, `ErrRateLimited`). It demonstrates a clean, reusable pattern for building resilient service-to-service clients with explicit error semantics.
Pure TypeScript implementation of PKCE code verifier/challenge generation plus safe return-URL validation for an OAuth Authorization Code flow. It depends only on Web Crypto primitives and is easily extracted into any browser or SSR Nuxt project needing OAuth PKCE support.
A searchable autocomplete component for selecting catalog works. It uses debounced queries and a ticket counter to discard stale async responses, preventing race-condition bugs in UI state. Although scoped to catalog works, the interaction pattern is directly reusable for any debounced remote-search selector.