Why I Built a Zero-Dependency, Single-File Go Clipboard for Terminal Junkies
If you spend most of your day inside a terminal, you already know the frustration of moving snippets, quick logs, or config chunks between a remote headless server and your local machine.Existing clipboard or pastebin tools usually require full browser sessions, bloated client apps, database setups, or heavy third-party npm packages. I wanted something dead-simple: No signup, no database, zero dependencies, and fully operable via curl.That’s why I built cpynet as a single-file Go binary. Here is the technical breakdown of why I wrote it this way and what I learned along the way. The Problem: Friction in the Terminal WorkflowWhen SSH'd into a production box or a remote VPS, copying text out or pushing small configurations can quickly turn into a chore.Traditional pastebins force you through web UIs, cookie banners, or bloated frontend frameworks.Standard sharing mechanisms often touch the OS clipboard, which can be restricted or blocked in secure/headless environments.Most open-source utilities require a complex Docker-compose file with external databases (PostgreSQL/Redis) just to store a few lines of text.I wanted a utility where I could just pipe text directly from the command line, get a self-destructing secure link, and close the loop instantly.Why Go and Why "Zero-Dependency"?To keep cpynet lightweight and bulletproof, I set a few strict constraints from day one:Single Binary Distribution: It compiles down to a single standalone file. No external runtimes, no missing DLLs, no node_modules. Deployment is literally a matter of moving the binary or running it directly.Pure Standard Library: The entire backend relies almost exclusively on Go's robust standard library. Avoiding external package bloat keeps the attack surface minimal and eliminates supply-chain vulnerabilities.Memory-Only Operation: Text snippets aren't written to a persistent disk database. They stay strictly in memory, configured to auto-delete the exact second they are read or when their TTL expires.Under the Hood: How It Handles DataTo keep things secure without over-engineering, cpynet supports client-side or server-side safeguards depending on how you use it:One-Time Reads: By default, a snippet burns instantly after its first read. Once fetched, it's wiped permanently from memory.Terminal-First Design: Instead of fighting with restricted OS clipboards, everything flows cleanly as plain text over standard HTTP/curl requests.AES-256-GCM Encryption: For sensitive chunks, data can be encrypted on the fly so the server never actually sees the plaintext.Here is a quick look at how clean and straightforward handling raw endpoints is in pure Go without dragging in heavy framework overhead:Gopackage main
import (
"fmt"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("CPYNET: Fast, zero-dependency CLI clipboard utility."))
})
fmt.Printf("Server listening on port %s...\n", port)
if err := http.ListenAndServe(":"+port, mux); err != nil {
fmt.Fprintf(os.Stderr, "Error starting server: %v\n", err)
os.Exit(1)
}
}
Final Thoughts Building tools like cpynet isn't just about writing code; it's about removing friction from daily developer workflows. When you strip away databases, frameworks, and unnecessary abstractions, you end up with software that is fast, predictable, and actually fun to maintain.If you want to check it out, give it a spin at cpynet.com or try piping something via your terminal.I’d love to hear how other systems engineers handle quick snippet sharing in their workflows—let me know in the comments!