@georgemandis/golinks@0.1.5Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
CLI tool for managing go links locally on your machine.
Go Links Server & CLI Tool
A simple go link redirect server built with Deno that allows you to create short
links accessible via a local hostname (e.g. go/<shortcut>) or CLI interface.
If have Deno installed and you don't want to pull down the code you can install the script like so:
deno install --global --allow-read --allow-write --allow-env --allow-net --allow-run jsr:@georgemandis/golinks
Run golinks
Features
- HTTP Server: Binds to port 80 (default)
- Web Management: Accessible at
http://go/_(or whatever hostname you choose) - Command Line Interface: Manage links from the terminal (see below)
- SQLite Storage: Links stored in
~/.golinks/db.sqlite - Click Tracking: Monitor link usage statistics
Setup
Quick Start (Development)
-
Add
goto your hosts file:echo "127.0.0.1 go" | sudo tee -a /etc/hosts -
Install and run:
# Start the server (requires sudo for port 80) deno task start
Global Installation
Use
Deno's install command
with the --global flag to install it globally.
-
Install globally:
deno install --global --allow-read --allow-write --allow-env --allow-net --allow-run --config deno.json --name golinks cli.tsYou can rename it to something else if you like.
-
Add
goto your hosts file (if not already done):echo "127.0.0.1 go" | sudo tee -a /etc/hostsThis step is very optional and you can change
goto something else if you like. -
Start the server:
golinks --serverOr, if you pulled down the source and opted not ot install it locally:
deno task start
Usage
Web Interface
Visit http://go/_ to:
- Add new links
- View existing links
- Delete links
- View statistics
Command Line
Development Usage
# Add a new link deno task cli --shortcut gh --url https://github.com # List all links deno task cli --list # Delete a link deno task cli --delete --shortcut gh # Show statistics deno task cli --stats # Show help deno task cli --help
Global CLI Usage (after global installation)
# Add a new link golinks --shortcut gh --url https://github.com # List all links golinks --list # Delete a link golinks --delete --shortcut gh # Show statistics golinks --stats # Start the server golinks --server # Open a shortcut directly in your browser golinks gh # Show help golinks --help
Using Links
Once created, access your links at:
http://go/gh→ redirects to GitHubhttp://go/docs→ redirects to your documentation- etc.
Or manage and use them via the CLI
golinks gh→ redirects to GitHubgolinks docs→ redirects to your documentation- etc.
API Documentation
This package provides a programmatic API for managing Go Links. View the full API documentation at JSR.io.
Basic Usage
import { GoLinksDB, type GoLink } from "@georgemandis/golinks"; const db = new GoLinksDB(); await db.init(); // Add a new link db.addLink("gh", "https://github.com", "GitHub homepage"); // Get a link const link = db.getLink("gh"); console.log(link?.url); // "https://github.com" // List all links const allLinks = db.getAllLinks(); // Update a link db.updateLink("gh", "https://github.com/myusername", "My GitHub profile"); // Delete a link db.deleteLink("gh"); // Clean up db.close();
Server Integration
import { handleRequest } from "@georgemandis/golinks"; // Use with Deno.serve Deno.serve({ port: 80 }, handleRequest);
Database Location
Links are stored in ~/.golinks/db.sqlite
Requirements
- Deno 1.40+
- sudo access (for binding to port 80)
goadded to your hosts file (Optionally)
Add Package
deno add jsr:@georgemandis/golinks
Import symbol
import * as golinks from "@georgemandis/golinks";
Import directly with a jsr specifier
import * as golinks from "jsr:@georgemandis/golinks";