$ show SynoCommunity/spkrepo
SynoCommunity/spkrepo is a production-grade web application for hosting and distributing Synology package (.spk) repositories. It provides a full DSM-compatible catalog API for NAS devices, an admin interface for package lifecycle management (upload, sign, activate, archive), user registration with role-based access, and background task processing via Celery. The system is built with a hexagonal (ports-and-adapters) architecture, separating domain logic from Flask web transports, SQLAlchemy persistence, and Celery task execution. It manages package metadata, versioning, firmware compatibility, and download statistics. The codebase is well-structured, with extensive test coverage including import isolation enforcement, Alembic migrations for PostgreSQL and SQLite, and CI/CD via GitHub Actions. Dependencies include Flask, Celery, PostgreSQL, Redis, Bootstrap, and Chart.js. The architecture is clean and modular, making it suitable for both small community repos and larger installations.
The LLM identified 3 files worth highlighting for reuse:
Handles all SPK file I/O operations: reading tar archives, extracting metadata (via sidecar JSON or in-file parsing), computing SHA-256 hashes, GPG signing and verification, and writing sidecar metadata. This adapter is isolated from the rest of the system (only depends on standard library and python-gnupg) and can be reused in any project that needs to process Synology .spk packages. It also handles partial data cleanup and concurrency-safe temp file management.
Implements the catalog generation logic for DSM compatibility. Maps architecture and language codes, determines package startability, and builds catalog entry dictionaries with metadata like version, description, and dependencies. This domain service is self-contained, using only domain primitives and a shared kernel. It can be extracted and reused for any catalog-format conversion or package metadata enrichment task.
Enforces the hexagonal architecture by testing that domain modules never import from adapters or views, and that application modules only import from domain. Uses AST parsing to verify import boundaries without runtime overhead. This pattern is non-obvious and reusable in any project that wants to maintain strict layer separation, especially when using a framework like Flask that can encourage tight coupling.