$ show hunvreus/devpush
This repository implements a self-hosted deployment platform alternative to services like Vercel or Netlify. It enables users to deploy GitHub repositories with zero-downtime updates, instant rollback, and preview deployments for branches. The platform provides team-based access control, custom domain support with automatic Let's Encrypt SSL, storage provisioning (databases/volumes), and real-time log aggregation via Loki. Built with FastAPI, SQLAlchemy, and ARQ for background jobs, the architecture separates concerns into routers, services, models, utilities, and workers. Infrastructure is orchestrated via Docker Compose, including Traefik for routing, PostgreSQL for primary data, Redis for caching/job queue, and Loki/Alloy for logs. Key entry points include the main FastAPI app, API routers for auth/project/team/admin, and worker entrypoints for ARQ jobs and deployment monitoring.
The LLM identified 6 files worth highlighting for reuse:
Provides deterministic color assignment from strings using hashlib. Self-contained with no external dependencies beyond standard library. Extractable for any project needing consistent color generation (e.g., for avatars, labels, or UI elements). Demonstrates simple, reusable utility pattern.
Offers a paginate function that wraps SQLAlchemy select queries with limit/offset pagination. Minimal coupling (only uses SQLAlchemy types for annotations). Reusable in any FastAPI/SQLAlchemy project with minor adaptation (removing type hints if needed). Shows clean abstraction for a common data access pattern.
Implements get_environment_for_branch to map branch names to environment names (e.g., 'main' → 'production') with configurable fallbacks. Decoupled from web framework; only requires a mapping dictionary. Extractable for any CI/CD or deployment system needing branch-to-environment resolution. Demonstrates configuration-driven behavior isolation.
Contains safe_redirect function to validate redirect URLs and prevent open redirect vulnerabilities, plus a RedirectResponseX class. Uses only urllib.parse and Starlette dependencies. Easily portable to any web application requiring secure redirect handling. Exemplifies a focused security utility.
Provides functions to parse and structure Loki log streams (parse_log_line, extract_log_batch). Self-contained with standard library and regex. Reusable in any system ingesting Loki logs for log aggregation or display. Shows effective pattern for transforming semi-structured log data.
Auto-detects project types (Node.js, Python, etc.) via file presence, package checks, and path analysis with priority ordering. Framework-agnostic; only uses standard library and file operations. Extractable for any tool needing project type identification (e.g., CLI builders, CI systems). Demonstrates maintainable detection logic through configurable priorities.