How lovepurohit/clipify works
Project Type and Purpose
• Clipify is a lightweight, monolithic full-stack web application written in Go, using SQLite for storage.
• It provides a secure clipboard-sharing service across devices via HTTPS (and HTTP), serving a static web UI and a JSON-based API.
File Structure
• Top-level files:
• main.go – entry point, HTTP/HTTPS server setup, routing, handlers
• go.mod / go.sum – Go module dependencies
• Dockerfile & .goreleaser.yml – containerization and release automation
• localhost.crt/key/csr – self-signed SSL certs for HTTPS
• static/ – static assets (index.html, CSS, JS) for the frontend UI
• Hidden config:
• .github/workflows – CI/CD pipelines (release publishing)
• .gitignore, LICENSE, README.md
README for Additional Insights
• HTTP & HTTPS endpoints (ports configurable via CLIPIFY_HTTP_PORT and CLIPIFY_HTTPS_PORT)
• Frontend delivers copy/paste UI, language detection, and clip management features.
• Backend uses modernc.org/sqlite for persistent storage and logs metadata (timestamp, OS, detected language).
• Docker setup uses host networking to expose the same ports inside the container.
a. Main Components
• Client Devices (Desktop, Mobile browsers)
• Web Browser UI (static assets: index.html, CSS, JS)
• HTTP/HTTPS Layer (port 8080 / 8443)
• Clipify Go Server (request router, business logic, language detection, metadata capture)
• Database (SQLite file)
• SSL Certificates (localhost.crt, localhost.key)
• (Optional) Docker Host / Container
b. Relationships & Interactions
• Client → Browser UI: GET / → static index.html
• Browser UI → Go Server API: POST /api/clip, GET /api/clips, DELETE /api/clips
• Go Server → SQLite: SQL read/write operations for clip storage
• Go Server logs metadata to SQLite
• Go Server serves static files directly from the embedded static/ folder
• Docker container binds host network to Go Server’s HTTP/HTTPS ports
c. Architectural Patterns & Design Principles
• Monolithic three-tier pattern: Presentation (static UI), Application (Go HTTP handlers), Data (SQLite).
• Embedded static assets—no external CDN.
• Environment-driven configuration for ports.
• Secure by design: HTTPS enforced with self-signed certs.
d. Key Technologies & Frameworks
• Go 1.23 (net/http package, custom handlers)
• modernc.org/sqlite (Go binding for SQLite)
• Docker (containerization, host networking)
• GitHub Actions & GoReleaser (CI/CD)