I recently built my first open-source project. It's called "Doclific" and it was originally an NPM module that could be used in the CLI to start a notion-like documentation editor. It worked great and got over 2k downloads in the first month. However, I soon realized that by keeping it as an NPM package, I could potentially be alienating quite a few devs. Thus, I started the journey of transitioning the TypeScript and oRPC backend into Golang...
To begin, it took a little bit to figure out how I wanted to structure the project originally. I'm familiar with how to structure Node projects, but not as familiar with Go. There were definitely some nuances, but eventually I figured it out.
The actual server setup, routes, and controllers were fairly simple as well. Coming from TypeScript primarily, it was easy to translate.
The hard parts came from the shell scripts needed for creating the releases and install. I'm not much of a bash guy, so this was a pain.
One thing I became more familiar with was checksum verification. When the release script runs, it generates a hash for the built files.
# ----------------------------
# Generate checksums
# ----------------------------
echo "🔐 Generating checksums"
cd "$DIST_DIR"
shasum -a 256 * > checksums.txt
cd ..
After that, when a user installs it, it will verify that the checksum of the install matches that of the checksum in GitHub.
# -----------------------------
# Verify checksum
# -----------------------------
info "Verifying checksum..."
# Determine command
if command -v sha256sum >/dev/null 2>&1; then
CHECKSUM_CMD="sha256sum -c -"
elif command -v shasum >/dev/null 2>&1; then
CHECKSUM_CMD="shasum -a 256 -c -"
else
err "No SHA256 checksum tool found. Please install sha256sum or shasum."
fi
# Run checksum verification
grep "$ARCHIVE" "$CHECKSUM_FILE" | $CHECKSUM_CMD || err "Checksum verification failed"
Previously, when a user wanted to download Doclific, they would have to use this command npm i -g doclific -- meaning they would have to have npm/node installed. Now, it can be installed with curl -fsSL https://raw.githubusercontent.com/muellerluke/doclific/main/scripts/install.sh | bash -- making it more accessible.
If you have any thoughts or suggestions, leave a comment!

Top comments (0)